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

Why rpm is negated? #9

Open
aravindSolteq opened this issue Apr 28, 2021 · 0 comments
Open

Why rpm is negated? #9

aravindSolteq opened this issue Apr 28, 2021 · 0 comments

Comments

@aravindSolteq
Copy link

Why is this in vesc_packet.cpp

double VescPacketValues::rpm() const
{
int32_t v = static_cast<int32_t>((static_cast<uint32_t>((payload_.first + 23)) << 24) +
(static_cast<uint32_t>(
(payload_.first + 24)) << 16) +
(static_cast<uint32_t>((payload_.first + 25)) << 8) +
static_cast<uint32_t>(
(payload_.first + 26)));
return static_cast(-1 * v);
}

why is it returning -(1*v) instead of v directly? Is there any specific reason for negating the rpm value?

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