arduino-libraries / Servo

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

Fix mbed not using REFRESH_INTERVAL #132

Open razvanphp opened 1 week ago

razvanphp commented 1 week ago

This pull request refactors the Servo library for mbed-based boards to utilize std::chrono durations instead of manual conversions with floating-point numbers. The 20ms interval was hardcoded for mbed platform only.

Changes:

Benefits:

Testing:

Notes:

This change aligns the Servo library with the updated mbed OS API that favours std::chrono durations since mbedOS 6.0.0, see

https://github.com/arduino/ArduinoCore-mbed/blob/702daa02e244fb8710b48599f38786a67c590699/cores/arduino/mbed/drivers/include/drivers/Ticker.h#L85-L122

github-actions[bot] commented 1 week ago

Memory usage change @ fab06090cb7e3cd20e0ed7bd7d9a22619e770766

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 :green_heart: -448 - -448 -0.05 - -0.05 0 - 0 0.0 - 0.0
arduino:mbed_nano:nanorp2040connect :green_heart: -1868 - -1868 -0.01 - -0.01 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`|-448|-0.05|0|0.0|-448|-0.05|0|0.0 `arduino:mbed_nano:nanorp2040connect`|-1868|-0.01|0|0.0|-1868|-0.01|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,-448,-0.05,0,0.0,-448,-0.05,0,0.0 arduino:mbed_nano:nanorp2040connect,-1868,-0.01,0,0.0,-1868,-0.01,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 ```
CLAassistant commented 1 week ago

CLA assistant check
All committers have signed the CLA.