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

TMC2208Stepper::VACTUAL is uint32_t, but must be signed datatype #281

Open
RalfR68 opened this issue Aug 10, 2023 · 0 comments
Open

TMC2208Stepper::VACTUAL is uint32_t, but must be signed datatype #281

RalfR68 opened this issue Aug 10, 2023 · 0 comments

Comments

@RalfR68
Copy link

RalfR68 commented Aug 10, 2023

VACTUAL is a signed 24 bit value (sign=motor run direction) and therefore needs to be declared as signed long, not unsigned. Currently, only positive values are returned, even if the motor runs in "negative" direction. This put me to trouble when using VACTUAL to run the motor, and using an interrupt routine to count INDEX pulses and checking VACTUAL sign to determine current direction.

File TMC2208Stepper.cpp (lines 328ff):
void TMC2208Stepper::VACTUAL(uint32_t input) // change to int32_t
uint32_t TMC2208Stepper::VACTUAL() // change to int32_t

Proof: When I typecast the return value of VACTUAL to (signed long), everything works fine.

PS: Great library, saved me loads of work! Great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant