Skip to content

Commit 71e9ff6

Browse files
committed
Servo bug that would sometimes cause skipping.
http://code.google.com/p/arduino/issues/detail?id=908
1 parent c540ac1 commit 71e9ff6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libraries/Servo/Servo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static inline void handle_interrupts(timer16_Sequence_t timer, volatile uint16_t
8989
}
9090
else {
9191
// finished all channels so wait for the refresh period to expire before starting over
92-
if( (unsigned)*TCNTn < (usToTicks(REFRESH_INTERVAL) + 4) ) // allow a few ticks to ensure the next OCR1A not missed
92+
if( ((unsigned)*TCNTn) + 4 < usToTicks(REFRESH_INTERVAL) ) // allow a few ticks to ensure the next OCR1A not missed
9393
*OCRnA = (unsigned int)usToTicks(REFRESH_INTERVAL);
9494
else
9595
*OCRnA = *TCNTn + 4; // at least REFRESH_INTERVAL has elapsed

0 commit comments

Comments
 (0)