Skip to content

Fix issue with writing inital servo value before min/max is configured #2318

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

Merged
merged 1 commit into from
Mar 25, 2024

Conversation

jan019
Copy link
Contributor

@jan019 jan019 commented Mar 24, 2024

Summary

The call to function Servo::write() in Servo::attach() must be done after Servo::min and Servo::max are configured - Servo::write() uses the min/max for mapping the passed value if the value is passed in degrees. Therefore if inital value in attach is set in degress and min/max is not configured when call to Servo::write() is done, the mapping will not be correct.

Fixes: #2308

The call to function Servo::write() in Servo::attach() must be done
after Servo::min and Servo::max are configured - Servo::write() uses the
min/max for mapping the passed value if the value is passed in degrees.
Therefore if inital value in attach is set in degress and min/max
is not configured when call to Servo::write() is done, the mapping will
not be correct.

Resolves: stm32duino#2308
Copy link
Member

@fpistm fpistm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Thanks @jan019.

@fpistm fpistm added bug 🐛 Something isn't working fix 🩹 Bug fix labels Mar 25, 2024
@fpistm fpistm added this to the 2.8.0 milestone Mar 25, 2024
@fpistm fpistm merged commit f67f03b into stm32duino:main Mar 25, 2024
@fpistm fpistm removed the bug 🐛 Something isn't working label Jan 4, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
fix 🩹 Bug fix
Projects
Development

Successfully merging this pull request may close these issues.

Servo.attach() call to Servo::write() before min/max are configured leads to issue when writting angles in degrees
2 participants