Skip to content

Commit bebf023

Browse files
committed
Merge pull request #840 from chrisfraser/esp8266
Fix to Servo allowing write() to be called before attach()
2 parents e95a615 + a9d8725 commit bebf023

File tree

1 file changed

+4
-0
lines changed
  • hardware/esp8266com/esp8266/libraries/Servo/src/esp8266

1 file changed

+4
-0
lines changed

hardware/esp8266com/esp8266/libraries/Servo/src/esp8266/Servo.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ Servo::Servo()
146146
_servoIndex = s_servoCount++;
147147
// store default values
148148
s_servos[_servoIndex].usPulse = DEFAULT_PULSE_WIDTH;
149+
150+
// set default _minUs and _maxUs incase write() is called before attach()
151+
_minUs = MIN_PULSE_WIDTH;
152+
_maxUs = MAX_PULSE_WIDTH;
149153
}
150154
else {
151155
_servoIndex = INVALID_SERVO; // too many servos

0 commit comments

Comments
 (0)