-
Notifications
You must be signed in to change notification settings - Fork 1k
Servo.attach() call to Servo::write() before min/max are configured leads to issue when writting angles in degrees #2308
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
Comments
Hi @jan019 |
Hi @fpistm, thanks for checking this out. I will submit a PR later today with configuring the values before the write call instead of after (I have tested this and it works well). |
jan019
added a commit
to jan019/Arduino_Core_STM32
that referenced
this issue
Mar 24, 2024
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
fpistm
pushed a commit
that referenced
this issue
Mar 25, 2024
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: #2308
tadtruex
pushed a commit
to TadAtThayer/Arduino_Core_STM32
that referenced
this issue
Apr 23, 2024
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
The Servo library calls the
write()
function within theattach()
functionArduino_Core_STM32/libraries/Servo/src/stm32/Servo.cpp
Line 124 in 641f3d8
this->min
andthis->max
valuesArduino_Core_STM32/libraries/Servo/src/stm32/Servo.cpp
Lines 126 to 127 in 641f3d8
write()
function to work correctly when the servo position is set in degrees. The functionwrite()
uses thethis->min
andthis->max
values to map the passed value in degrees between min and max https://github.com/stm32duino/Arduino_Core_STM32/blob/641f3d8883e9a7220f65dded355dc32e218a990d/libraries/Servo/src/stm32/Servo.cpp#L156/To Reproduce
The
write()
function should either not be called in theattach()
function at all, or it must be called afterthis->min
andthis->max
are configured.The text was updated successfully, but these errors were encountered: