diff options
author | Cristian Maglie <c.maglie@bug.st> | 2012-06-27 13:51:16 +0200 |
---|---|---|
committer | Cristian Maglie <c.maglie@bug.st> | 2012-06-27 13:51:16 +0200 |
commit | 2d2050eabeaff7109ba89fdd0100556c981cf373 (patch) | |
tree | 1f6d9725b59aa02e5400a8117eeec3206d88047d /libraries/Servo/Servo.cpp | |
parent | 324023a67afd1691f12ead4388d7cdf1a9d1a6ef (diff) | |
parent | 31c24577835b0a9c7a1291ffbda1b61d96818511 (diff) |
Merged master
Diffstat (limited to 'libraries/Servo/Servo.cpp')
-rwxr-xr-x | libraries/Servo/Servo.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libraries/Servo/Servo.cpp b/libraries/Servo/Servo.cpp index acac29a..a716433 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
@@ -298,7 +298,7 @@ void Servo::writeMicroseconds(int value) {
// calculate and store the values for the given channel
byte channel = this->servoIndex;
- if( (channel >= 0) && (channel < MAX_SERVOS) ) // ensure channel is valid
+ if( (channel < MAX_SERVOS) ) // ensure channel is valid
{
if( value < SERVO_MIN() ) // ensure pulse width is valid
value = SERVO_MIN();
|