Skip to content

Commit

Permalink
Fixed negative temperature calculation. Thanks @bxparks
Browse files Browse the repository at this point in the history
Version 6.2.1
  • Loading branch information
Naguissa committed Sep 14, 2019
1 parent 9e78d25 commit 8c1a48e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/uRTCLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ void uRTCLib::refresh() {

MSB = Wire.read(); //2's complement int portion
LSB = Wire.read(); //fraction portion
_temp = (MSB << 2) | (LSB >> 6); // 8+2 bits, *25 is the same as number + 2bitdecimals * 100 in base 10
_temp = 0b0000000000000000 | (MSB << 2) | (LSB >> 6); // 8+2 bits, *25 is the same as number + 2bitdecimals * 100 in base 10
if (MSB & 0b10000000) {
_temp = (_temp | 0b1111110000000000);
_temp--;
Expand Down

0 comments on commit 8c1a48e

Please sign in to comment.