-
Notifications
You must be signed in to change notification settings - Fork 7
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
Below zero values don't make sense #5
Comments
Here's how I fixed it. I arrived at this after decompiling the Windows app that shipped with the device, hacking at it until I got it to work, and then trying to optimize and simplify it. Note that the manufacturer's Windows app even has a bug -- it returns an error when reading temps just under zero (between 0.0C and -1.0C, if I remember correctly -- whenever the high bit == 255). This is fixed in the following code: exports.toDegreeCelcius = function(hiByte, loByte) { I've tested with the full range of possible high+low bytes (0-255), and the results appear to be correct. There's probably a more concise way of representing this, but I haven't had much experience with bitwise operations like this before. |
Thanks, will incorporate your fix as soon as possible! |
I have submitted a pull request that contains this fix, as well as toDegreeFahrenheit() and a handful of other minor changes. |
When below zero is reached, the temperature jumps to -127 with the current conversion.
@TimPietrusky Your code uses the same conversion.
Any idea on how to fix this? Reading the raw values I'm not sure what the trick is.
The text was updated successfully, but these errors were encountered: