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

Fix negative watt values #5

Merged
merged 3 commits into from Sep 5, 2022
Merged

Fix negative watt values #5

merged 3 commits into from Sep 5, 2022

Conversation

dailow
Copy link
Contributor

@dailow dailow commented May 17, 2022

No description provided.

@jrouvier
Copy link
Owner

jrouvier commented Sep 5, 2022

@dailow, thanks for your patience.
Subtracting 0x1000000 is actually off by one, should actually subtract 0xFFFFFF. The "proper" way would actually be watts = ((~watts) & 0xFFFFFF) * -1, but watts -= 0xFFFFFF works as well and is much cleaner. I've taken the liberty of expanding the logic a bit so it will handle both of the most common ways of expressing negative numbers.

@jrouvier jrouvier merged commit b5c7aab into jrouvier:main Sep 5, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants