arduino-libraries / Servo

Servo Library for Arduino
http://arduino.cc/
GNU Lesser General Public License v2.1
245 stars 255 forks source link

Fix map from microseconds to angle in renesas Servo::read #131

Open martincwilliams opened 1 month ago

martincwilliams commented 1 month ago

For the renesas implementation, Servo::read() reports a different value to what was previously set with Servo::write().

The value reported by read() is 1 less than the value written using write().

In the Servo::read function for renesas, the mapping from microseconds to angle is inconsistent with other implementations, such as avr, which add +1 to the microseconds value before mapping.

Tested on a Uno Rev 4 Wifi => value returned by read was equal to value written for all angles from 0 to 180.

github-actions[bot] commented 1 month ago

Memory usage change @ 009f3b9629975d1e049f9ec17ecc090b60c6dc24

Board flash % RAM for global variables %
arduino:avr:leonardo 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:avr:mega 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:avr:nano 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_nano:nano33ble 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_nano:nanorp2040connect 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A
arduino:mbed_portenta:envie_m7:target_core=cm4 N/A N/A N/A N/A
arduino:megaavr:nona4809 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:sam:arduino_due_x_dbg 0 - 0 0.0 - 0.0 N/A N/A
arduino:samd:mkrzero 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
Click for full report table Board|`examples/Knob`
flash|%|`examples/Knob`
RAM for global variables|%|`examples/Sweep`
flash|%|`examples/Sweep`
RAM for global variables|% -|-|-|-|-|-|-|-|- `arduino:avr:leonardo`|0|0.0|0|0.0|0|0.0|0|0.0 `arduino:avr:mega`|0|0.0|0|0.0|0|0.0|0|0.0 `arduino:avr:nano`|0|0.0|0|0.0|0|0.0|0|0.0 `arduino:mbed_nano:nano33ble`|0|0.0|0|0.0|0|0.0|0|0.0 `arduino:mbed_nano:nanorp2040connect`|0|0.0|0|0.0|0|0.0|0|0.0 `arduino:mbed_portenta:envie_m7`|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A `arduino:mbed_portenta:envie_m7:target_core=cm4`|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A `arduino:megaavr:nona4809`|0|0.0|0|0.0|0|0.0|0|0.0 `arduino:sam:arduino_due_x_dbg`|0|0.0|N/A|N/A|0|0.0|N/A|N/A `arduino:samd:mkrzero`|0|0.0|0|0.0|0|0.0|0|0.0
Click for full report CSV ``` Board,examples/Knob
flash,%,examples/Knob
RAM for global variables,%,examples/Sweep
flash,%,examples/Sweep
RAM for global variables,% arduino:avr:leonardo,0,0.0,0,0.0,0,0.0,0,0.0 arduino:avr:mega,0,0.0,0,0.0,0,0.0,0,0.0 arduino:avr:nano,0,0.0,0,0.0,0,0.0,0,0.0 arduino:mbed_nano:nano33ble,0,0.0,0,0.0,0,0.0,0,0.0 arduino:mbed_nano:nanorp2040connect,0,0.0,0,0.0,0,0.0,0,0.0 arduino:mbed_portenta:envie_m7,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A arduino:mbed_portenta:envie_m7:target_core=cm4,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A arduino:megaavr:nona4809,0,0.0,0,0.0,0,0.0,0,0.0 arduino:sam:arduino_due_x_dbg,0,0.0,N/A,N/A,0,0.0,N/A,N/A arduino:samd:mkrzero,0,0.0,0,0.0,0,0.0,0,0.0 ```