1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-07 16:23:38 +03:00

Merge pull request #840 from chrisfraser/esp8266

Fix to Servo allowing write() to be called before attach()
This commit is contained in:
Ivan Grokhotkov 2015-09-30 22:48:32 +03:00
commit b81fb95b24

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