We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi there, looking into work library I found a bug into the temperature computation, in particular when the temperature in negative.
if (v & 0x80000000) { // Negative value, drop the lower 18 bits and explicitly extend sign bits. v = 0xFFFFC000 | ((v >> 18) & 0x00003FFFF); }
The bug regards ((v >> 18) & 0x00003FFFF
Here you perform a bit shift of 18 position to maintain the 14 temperature bit, but if you use this mask 0x00003FFFF you maintain 18 bit.
The right operations is to get a negative temperature are:
if (v & 0x80000000) { // Negative value, drop the lower 18 bits and explicitly extend sign bits. v = 0xFFFFC000 | ((v >> 18) & 0x00003FFF); }
Thanks for you work Adafruit!
Best regards, Federico
The text was updated successfully, but these errors were encountered:
Hi! Is your issue a duplicate of ##13 ?
Martin
Sorry, something went wrong.
Should be fixed with #36 https://github.com/adafruit/Adafruit-MAX31855-library/releases/tag/1.1.1
No branches or pull requests
Hi there,
looking into work library I found a bug into the temperature computation, in particular when the temperature in negative.
if (v & 0x80000000) { // Negative value, drop the lower 18 bits and explicitly extend sign bits. v = 0xFFFFC000 | ((v >> 18) & 0x00003FFFF); }
The bug regards ((v >> 18) & 0x00003FFFF
Here you perform a bit shift of 18 position to maintain the 14 temperature bit, but if you use this mask
0x00003FFFF you maintain 18 bit.
The right operations is to get a negative temperature are:
if (v & 0x80000000) { // Negative value, drop the lower 18 bits and explicitly extend sign bits. v = 0xFFFFC000 | ((v >> 18) & 0x00003FFF); }
Thanks for you work Adafruit!
Best regards,
Federico
The text was updated successfully, but these errors were encountered: