![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
First Commit
Dependencies: mbed Crypto_light mbed-rtos
Spin it 2 win it
Diff: main.cpp
- Revision:
- 24:0a0e22d4d8d3
- Parent:
- 23:58de87ec3997
- Child:
- 25:bf5fff055aef
--- a/main.cpp Tue Mar 20 18:25:44 2018 +0000 +++ b/main.cpp Tue Mar 20 18:38:08 2018 +0000 @@ -108,12 +108,12 @@ -//Global varible for the Bitcoin Key,maxspeed and rotations_pending +//Global varible for the Bitcoin Key,targetSpeed and rotations_pending volatile uint64_t newKey = 0; //check initialise value? **** -volatile float maxspeed = 0, rotations_pending = 0; +volatile float targetSpeed = 0, rotations_pending = 0; //mutex variables Mutex newKey_mutex; -Mutex maxspeed_mutex; +Mutex targetSpeed_mutex; Mutex rotations_pending_mutex; //Instantiate a Queue to buffer incoming characters @@ -168,7 +168,7 @@ if (!count) { putMessage(MSG_CUR_SPD, curSpeed); } - torque = (uint32_t)(KP*(maxspeed-abs(curSpeed))); + torque = (uint32_t)(KP*(targetSpeed-abs(curSpeed))); } } @@ -178,7 +178,7 @@ { uint64_t newKey_; uint32_t torque_; - float maxspeed_, rotations_pending_; + float targetSpeed_, rotations_pending_; //R if (sscanf(s, "R%f", &rotations_pending_)) { rotations_pending_mutex.lock(); @@ -187,11 +187,11 @@ putMessage(MSG_ROT_PEN, rotations_pending); //V } - else if (sscanf(s, "V%f", &maxspeed_)) { - maxspeed_mutex.lock(); - maxspeed = maxspeed_; - maxspeed_mutex.unlock(); - putMessage(MSG_MAX_SPD, maxspeed); + else if (sscanf(s, "V%f", &targetSpeed_)) { + targetSpeed_mutex.lock(); + targetSpeed = targetSpeed_; + targetSpeed_mutex.unlock(); + putMessage(MSG_MAX_SPD, targetSpeed); //K } else if (sscanf(s, "K%llx", &newKey_)) {