Skip to content

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

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fwacer
Copy link

@fwacer fwacer commented Apr 25, 2023

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.

if( SERVO_INDEX(timer,Channel[timer]) < ServoCount && Channel[timer] < SERVOS_PER_TIMER) {

if( SERVO_INDEX(timer,Channel[timer]) < ServoCount && SERVO(timer,Channel[timer]).Pin.isActive == true )

Resolves arduino-libraries#67 by changing Servo constructors and adding destructors.
Constructor looks for an unused Servo to re-use first, before adding onto the end of the array.
@fwacer fwacer marked this pull request as draft April 25, 2023 06:46
@CLAassistant
Copy link

CLAassistant commented Apr 25, 2023

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link

Memory usage change @ 987fb8f

Board flash % RAM for global variables %
arduino:mbed_nano:nano33ble 🔺 +264 - +272 +0.03 - +0.03 💚 -8 - 0 -0.0 - 0.0
arduino:mbed_nano:nanorp2040connect 🔺 +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<br>flash,%,examples/Knob<br>RAM for global variables,%,examples/Sweep<br>flash,%,examples/Sweep<br>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

@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Apr 25, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MAX_SERVOS limit when testing
3 participants