Skip to content

Commit b81fb95

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

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

libraries/Servo/src/esp8266/Servo.cpp

Lines changed: 4 additions & 0 deletions
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)