arduino-libraries / Servo

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

Resolves #67 by changing Servo constructors and adding destructors #110

Open fwacer opened 1 year ago

fwacer commented 1 year ago

Resolves #67 by changing Servo constructors and adding destructors. The constructor looks for an unused Servo to re-use first, before adding onto the end of the array.

So far this is untested on hardware.

I'm a little uncertain that changing "ServoCount" to "MAX_SERVOS" in the following lines is ok. As far as I can tell, it's just trying to keep the code from operating out of bounds on the servo array. https://github.com/arduino-libraries/Servo/blob/9fe754682b51fd532109fac86ff3d1991e978637/src/avr/Servo.cpp#L62 https://github.com/arduino-libraries/Servo/blob/9fe754682b51fd532109fac86ff3d1991e978637/src/avr/Servo.cpp#L57

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

github-actions[bot] commented 1 year ago

Memory usage change @ 987fb8f24ee9c582646fe0bd312a92082f92b113

Board flash % RAM for global variables %
arduino:mbed_nano:nano33ble :small_red_triangle: +264 - +272 +0.03 - +0.03 :green_heart: -8 - 0 -0.0 - 0.0
arduino:mbed_nano:nanorp2040connect :small_red_triangle: +270 - +270 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m7:target_core=cm4 N/A N/A N/A N/A
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A
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:mbed_nano:nano33ble`|272|0.03|-8|-0.0|264|0.03|0|0.0 `arduino:mbed_nano:nanorp2040connect`|270|0.0|0|0.0|270|0.0|0|0.0 `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:mbed_portenta:envie_m7`|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A
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:mbed_nano:nano33ble,272,0.03,-8,-0.0,264,0.03,0,0.0 arduino:mbed_nano:nanorp2040connect,270,0.0,0,0.0,270,0.0,0,0.0 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:mbed_portenta:envie_m7,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A ```