1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-27 21:16:50 +03:00

Fix to Servo allowing write() to be called before attach()

This commit is contained in:
Chris Fraser 2015-09-29 17:02:24 +02:00
parent 1bc87e7bff
commit d92f2f375e

View File

@ -146,6 +146,10 @@ Servo::Servo()
_servoIndex = s_servoCount++; _servoIndex = s_servoCount++;
// store default values // store default values
s_servos[_servoIndex].usPulse = DEFAULT_PULSE_WIDTH; s_servos[_servoIndex].usPulse = DEFAULT_PULSE_WIDTH;
// set default _minUs and _maxUs incase write() is called before attach()
_minUs = MIN_PULSE_WIDTH;
_maxUs = MAX_PULSE_WIDTH;
} }
else { else {
_servoIndex = INVALID_SERVO; // too many servos _servoIndex = INVALID_SERVO; // too many servos