Skip to content

Commit e7695a9

Browse files
committed
Remove possible jerk due to force-cancelling duty cycle.
1 parent cc26161 commit e7695a9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

libraries/Servo/src/Servo.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,11 @@ void Servo::detach()
8585
{
8686
if (_attached) {
8787
_servoMap &= ~(1 << _pin);
88+
startWaveform(_pin, 0, REFRESH_INTERVAL, 1);
89+
delay(REFRESH_INTERVAL / 1000); // long enough to complete active period under all circumstances.
8890
stopWaveform(_pin);
8991
_attached = false;
9092
_valueUs = DEFAULT_NEUTRAL_PULSE_WIDTH;
91-
digitalWrite(_pin, LOW);
9293
}
9394
}
9495

0 commit comments

Comments
 (0)