Luka Slapnik / sbus_decode
Revision:
7:0a43fd370575
Parent:
6:c4c97ac35bc4
Child:
8:1294344216eb
diff -r c4c97ac35bc4 -r 0a43fd370575 SBUS.cpp
--- a/SBUS.cpp	Sat Jun 29 02:53:30 2019 +0000
+++ b/SBUS.cpp	Sat Jun 29 02:54:40 2019 +0000
@@ -78,9 +78,10 @@
         float buf;
         if(channel[i] > stickNeutralValue) buf = ((channel[i] - stickNeutralValue) / (float)(stickMaximumValue - stickNeutralValue));
         else buf = -((channel[i] - stickNeutralValue) / (float)(stickMinimumValue - stickNeutralValue));
+        buf = (int)(buf*100)/100.0f;
         switch(i) {
             case right_RL:
-                stickValue[analog_rx] = (int)(buf*100)/100.0f;
+                stickValue[analog_rx] = buf;
                 break;
             case right_UD:
                 stickValue[analog_ry] = buf;