@@ -91,12 +91,12 @@ void Servo::detach()
9191void Servo::write (int value)
9292{
9393 // treat values less than 544 as angles in degrees (valid values in microseconds are handled as microseconds)
94- if (value < MIN_PULSE_WIDTH ) {
94+ if (value < _minUs ) {
9595 // assumed to be 0-180 degrees servo
9696 value = constrain (value, 0 , 180 );
9797 // writeMicroseconds will contrain the calculated value for us
9898 // for any user defined min and max, but we must use default min max
99- value = improved_map (value, 0 , 180 , MIN_PULSE_WIDTH, MAX_PULSE_WIDTH );
99+ value = improved_map (value, 0 , 180 , _minUs, _maxUs );
100100 }
101101 writeMicroseconds (value);
102102}
@@ -113,7 +113,7 @@ int Servo::read() // return the value as degrees
113113{
114114 // read returns the angle for an assumed 0-180, so we calculate using
115115 // the normal min/max constants and not user defined ones
116- return improved_map (readMicroseconds (), MIN_PULSE_WIDTH, MAX_PULSE_WIDTH , 0 , 180 );
116+ return improved_map (readMicroseconds (), _minUs, _maxUs , 0 , 180 );
117117}
118118
119119int Servo::readMicroseconds ()
0 commit comments