-
Notifications
You must be signed in to change notification settings - Fork 583
[BUG] Passing a new target to move() is sometimes ignored #404
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
Comments
You're right... no one has ever reported this before, I think because it is generally assumed that you either
To see the bug you're experiencing you must be passing the value sometimes, and sometimes not. As a workaround, I suggest just using In the next release, I think we'll probably place the target setting at the top of the function like you suggest to solve this edge case. In a future version of the API, I would remove the parameter to move() completely, as the semantics are confusing, and either just setting the member field directly or using a setter function like motor.setTarget() would be clearer, I feel. |
move setting target to start of move() #404
Solved for BLDCMotor, StepperMotor and HybridStepperMotor (drivers repository). DCMotor was not affected. Merged to dev branch. |
Agreed. |
Thanks for this. This one is an old and sneaky one! The parameter for |
In the new release v2.3.4 |
In
BLDCMotor::move()
, if you pass a new target as a parameter, it is sometimes ignored.This is due to this code being at the wrong place. I think it should be placed at the very top of the function.
Indeed, if either
(motion_cnt++ < motion_downsample)
or(!enabled)
, thenew_target
parameter is ignored.The text was updated successfully, but these errors were encountered: