mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-06 05:21:22 +03:00
Merge pull request #840 from chrisfraser/esp8266
Fix to Servo allowing write() to be called before attach()
This commit is contained in:
commit
b81fb95b24
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user