MorphGI / Mbed 2 deprecated LoCoMoTE_PeristalticPumpControl_v4

Dependencies:   mbed QEI FastAnalogIn mbed-rtos FastPWM

Files at this revision

API Documentation at this revision

Comitter:
dofydoink
Date:
Mon Apr 01 14:15:31 2019 +0000
Parent:
4:3bab17dfae4e
Commit message:
Fixed quantization error in sensor position message to ML. Was caused by incorrectly casting to an int (use brackets to force order of operations!).

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 3bab17dfae4e -r 4e710cef655e main.cpp
--- a/main.cpp	Wed Jan 30 13:05:42 2019 +0000
+++ b/main.cpp	Mon Apr 01 14:15:31 2019 +0000
@@ -481,7 +481,7 @@
     
     //printf("%f\r\n",dblPosD[intDemPosFilOrder]);
     
-    intFeedBack_pos = (int) dblPos[intPosFilOrder]/MAX_ACTUATOR_LENGTH*511;
+    intFeedBack_pos = (int) ((dblPos[intPosFilOrder]/MAX_ACTUATOR_LENGTH)*511);
     
     if(intFeedBack_pos>511)
     {