Skip to content

Commit 10f18d0

Browse files
author
Richard Unger
committed
limit PWMSensor raw value to configured max
1 parent d622aa2 commit 10f18d0

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/sensors/MagneticSensorPWM.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ void MagneticSensorPWM::init(){
3535
float MagneticSensorPWM::getSensorAngle(){
3636
// raw data from sensor
3737
raw_count = getRawCount();
38+
if (raw_count > max_raw_count) raw_count = max_raw_count;
3839
return( (float) (raw_count - min_raw_count) / (float)cpr) * _2PI;
3940
}
4041

0 commit comments

Comments
 (0)