Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: PositionSensor/PositionSensor.cpp
- Revision:
- 7:caebf421f288
- Parent:
- 2:eabe8feaaabb
- Child:
- 8:314074b56470
diff -r a6669248ce4d -r caebf421f288 PositionSensor/PositionSensor.cpp
--- a/PositionSensor/PositionSensor.cpp Fri Mar 18 12:07:14 2016 +0000
+++ b/PositionSensor/PositionSensor.cpp Wed Mar 30 06:50:11 2016 +0000
@@ -73,7 +73,7 @@
int raw = TIM2->CNT;
if (raw < 0) raw += _CPR;
if (raw >= _CPR) raw -= _CPR;
- float signed_elec = fmod((2.0f * (6.28318530718f * (raw) / (float)_CPR + _offset)), 6.28318530718f);
+ float signed_elec = fmod((10.0f * (6.28318530718f * (raw) / (float)_CPR + _offset)), 6.28318530718f);
if (signed_elec < 0) {
return signed_elec + 6.28318530718f;
} else {
@@ -84,7 +84,9 @@
void PositionSensorEncoder::ZeroEncoderCount(void){
if (ZSense->read() == 1){
if (ZSense->read() == 1){
+ ZTest->write(state);
TIM2->CNT=0;
+ state = !state;
}
}
}
\ No newline at end of file