From d92f2f375e7ab2ab3ef8647093d46d4648d6620b Mon Sep 17 00:00:00 2001 From: Chris Fraser Date: Tue, 29 Sep 2015 17:02:24 +0200 Subject: [PATCH] Fix to Servo allowing write() to be called before attach() --- libraries/Servo/src/esp8266/Servo.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/Servo/src/esp8266/Servo.cpp b/libraries/Servo/src/esp8266/Servo.cpp index af8bf549e..9893156a3 100644 --- a/libraries/Servo/src/esp8266/Servo.cpp +++ b/libraries/Servo/src/esp8266/Servo.cpp @@ -146,6 +146,10 @@ Servo::Servo() _servoIndex = s_servoCount++; // store default values 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 { _servoIndex = INVALID_SERVO; // too many servos