diff --git a/src/Servo.h b/src/Servo.h index 53ecb8e..ef09c80 100644 --- a/src/Servo.h +++ b/src/Servo.h @@ -108,7 +108,7 @@ class Servo uint8_t attach(int pin); // attach the given pin to the next free channel, sets pinMode, returns channel number or INVALID_SERVO if failure uint8_t attach(int pin, int min, int max); // as above but also sets min and max values for writes. void detach(); - void write(int value); // if value is < 200 its treated as an angle, otherwise as pulse width in microseconds + void write(int value); // if value is < 544 and desired arch is not nrf52, its treated as an angle between 0 and 180, where values higher than 180 are set to 180 and values less than 0 are set to 0; otherwise as pulse width in microseconds void writeMicroseconds(int value); // Write pulse width in microseconds int read(); // returns current pulse width as an angle between 0 and 180 degrees int readMicroseconds(); // returns current pulse width in microseconds for this servo (was read_us() in first release) diff --git a/src/avr/Servo.cpp b/src/avr/Servo.cpp index 11fecc5..5f2266b 100644 --- a/src/avr/Servo.cpp +++ b/src/avr/Servo.cpp @@ -264,7 +264,7 @@ void Servo::detach() void Servo::write(int value) { if(value < MIN_PULSE_WIDTH) - { // treat values less than 544 as angles in degrees (valid values in microseconds are handled as microseconds) + { if(value < 0) value = 0; if(value > 180) value = 180; value = map(value, 0, 180, SERVO_MIN(), SERVO_MAX()); diff --git a/src/mbed/Servo.cpp b/src/mbed/Servo.cpp index efb67f9..c29db2e 100644 --- a/src/mbed/Servo.cpp +++ b/src/mbed/Servo.cpp @@ -83,7 +83,6 @@ void Servo::detach() void Servo::write(int value) { - // treat values less than 544 as angles in degrees (valid values in microseconds are handled as microseconds) if (value < MIN_PULSE_WIDTH) { if (value < 0) diff --git a/src/megaavr/Servo.cpp b/src/megaavr/Servo.cpp index 59b3e44..d24702f 100644 --- a/src/megaavr/Servo.cpp +++ b/src/megaavr/Servo.cpp @@ -160,7 +160,6 @@ void Servo::detach() void Servo::write(int value) { - // treat values less than 544 as angles in degrees (valid values in microseconds are handled as microseconds) if (value < MIN_PULSE_WIDTH) { if (value < 0) diff --git a/src/sam/Servo.cpp b/src/sam/Servo.cpp index df5058f..34f5b10 100644 --- a/src/sam/Servo.cpp +++ b/src/sam/Servo.cpp @@ -228,7 +228,6 @@ void Servo::detach() void Servo::write(int value) { - // treat values less than 544 as angles in degrees (valid values in microseconds are handled as microseconds) if (value < MIN_PULSE_WIDTH) { if (value < 0) diff --git a/src/samd/Servo.cpp b/src/samd/Servo.cpp index d8e2ec4..99193f4 100644 --- a/src/samd/Servo.cpp +++ b/src/samd/Servo.cpp @@ -243,7 +243,6 @@ void Servo::detach() void Servo::write(int value) { - // treat values less than 544 as angles in degrees (valid values in microseconds are handled as microseconds) if (value < MIN_PULSE_WIDTH) { if (value < 0)