hobbyking_cheetah source code modified 2020/12/15
Dependencies: mbed-dev-f303 FastPWM3
Diff: PositionSensor/PositionSensor.cpp
- Revision:
- 5:51c6560bf624
- Parent:
- 3:6a0015d88d06
- Child:
- 6:4ee1cdc43aa8
--- a/PositionSensor/PositionSensor.cpp Sat Mar 12 08:04:51 2016 +0000 +++ b/PositionSensor/PositionSensor.cpp Sat Mar 12 18:45:22 2016 +0000 @@ -70,7 +70,7 @@ int raw = TIM3->CNT-0x8000; if (raw < 0) raw += _CPR; if (raw >= _CPR) raw -= _CPR; - float signed_mech = fmod(((6.28318530718f*(raw)/(float)_CPR + _offset)), 6.28318530718f); //7 pole pairs + float signed_mech = fmod(((6.28318530718f*(raw)/(float)_CPR + _offset)), 6.28318530718f); if (signed_mech < 0){ return signed_mech + 6.28318530718f; }