Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

MAX_SERVOS limit when testing #67

Open
lfenster opened this issue Dec 16, 2020 · 0 comments · May be fixed by #110
Open

MAX_SERVOS limit when testing #67

lfenster opened this issue Dec 16, 2020 · 0 comments · May be fixed by #110
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@lfenster
Copy link

lfenster commented Dec 16, 2020

Is it possible to have a destructor for Servo that removes the motor from static list of Servos? The reason for asking is that I am artificially hitting the MAX_SERVOS limit when running unit tests for my solution. I have a test suite that initializes motors which contain Servos and then destructs the Motor to move on to the next test. See example below. B/c the Servo constructor adds to the static list of servos and caps it out at 48 (for the Mega 2560) after so many tests, the servos will stop attaching. Seems to me like there should be a destructor that does the cleanup for what the constructor is doing.

RUN_TEST(test_One);
RUN_TEST(test_Three);
RUN_TEST(test_RunTwoMotorsAsync);
RUN_TEST(test_ManualMotorReset);         
RUN_TEST(test_InitializeTwentyTwoMotors);
RUN_TEST(test_InitializeTwentyTwoMotorsAndMoveTwo);
@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Jul 19, 2022
fwacer added a commit to fwacer/Servo that referenced this issue Apr 25, 2023
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants