Skip to content
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

Velocity typecasting. #48

Open
Villyam opened this issue Nov 29, 2023 · 0 comments
Open

Velocity typecasting. #48

Villyam opened this issue Nov 29, 2023 · 0 comments

Comments

@Villyam
Copy link

Villyam commented Nov 29, 2023

https://github.com/trinamic/TMC-API/blob/8e53c85679a7ed8b047c77e97282e7f9d8e62fcd/tmc/ic/TMC5130/TMC5130.c#L226C33-L226C33
https://github.com/trinamic/TMC-API/blob/8e53c85679a7ed8b047c77e97282e7f9d8e62fcd/tmc/ic/TMC5130/TMC5130.h#L28

I think there should be (int32_t) instead of (uint32_t) like:
tmc5130->velocity = (int32_t) ((float32_t) ((XActual - tmc5130->oldX) / (float32_t) tickDiff) * (float32_t) 1048.576);
Because tmc5130->velocity is int32_t and it gave me 0 for negative velocity when testing.

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

No branches or pull requests

1 participant