From 71e9ff63f8ae3ede963cda5b16c63816128950f9 Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Tue, 8 May 2012 20:38:38 -0400 Subject: [PATCH] Servo bug that would sometimes cause skipping. http://code.google.com/p/arduino/issues/detail?id=908 --- libraries/Servo/Servo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Servo/Servo.cpp b/libraries/Servo/Servo.cpp index dbe3bedd9..a71643323 100755 --- a/libraries/Servo/Servo.cpp +++ b/libraries/Servo/Servo.cpp @@ -89,7 +89,7 @@ static inline void handle_interrupts(timer16_Sequence_t timer, volatile uint16_t } else { // finished all channels so wait for the refresh period to expire before starting over - if( (unsigned)*TCNTn < (usToTicks(REFRESH_INTERVAL) + 4) ) // allow a few ticks to ensure the next OCR1A not missed + if( ((unsigned)*TCNTn) + 4 < usToTicks(REFRESH_INTERVAL) ) // allow a few ticks to ensure the next OCR1A not missed *OCRnA = (unsigned int)usToTicks(REFRESH_INTERVAL); else *OCRnA = *TCNTn + 4; // at least REFRESH_INTERVAL has elapsed