hobbyking_cheetah source code modified 2020/12/15
Dependencies: mbed-dev-f303 FastPWM3
Diff: PositionSensor/PositionSensor.cpp
- Revision:
- 12:c473a25f54f7
- Parent:
- 11:c83b18d41e54
- Child:
- 13:a3fa0a31b114
diff -r c83b18d41e54 -r c473a25f54f7 PositionSensor/PositionSensor.cpp --- a/PositionSensor/PositionSensor.cpp Sun May 22 00:14:59 2016 +0000 +++ b/PositionSensor/PositionSensor.cpp Sun May 22 03:38:19 2016 +0000 @@ -140,9 +140,7 @@ } float PositionSensorEncoder::GetElecVelocity(){ - float rawPeriod = TIM2->CCR1; //Clock Ticks - float dir = (((TIM3->CR1)>>4)&1)*2-1; // +/- 1 - return dir*_ppairs*90000000.0f*(6.28318530718f/(float)_CPR)/rawPeriod; + return _ppairs*GetMechVelocity(); } float PositionSensorEncoder::GetMechVelocity(){