hobbyking_cheetah source code modified 2020/12/15

Dependencies:   mbed-dev-f303 FastPWM3

Revision:
23:2adf23ee0305
Parent:
22:60276ba87ac6
Child:
25:f5741040c4bb
--- a/PositionSensor/PositionSensor.cpp	Fri Mar 31 18:24:46 2017 +0000
+++ b/PositionSensor/PositionSensor.cpp	Wed Apr 05 20:54:16 2017 +0000
@@ -43,6 +43,7 @@
     MechPosition = position - MechOffset;
     float elec = ((6.28318530718f/(float)_CPR) * (float) ((_ppairs*angle)%_CPR)) - ElecOffset;
     if(elec < 0) elec += 6.28318530718f;
+    else if(elec > 6.28318530718f) elec -= 6.28318530718f ; 
     ElecPosition = elec;
     
     float vel;