Skip to content

Commit

Permalink
Negative temperature issue
Browse files Browse the repository at this point in the history
Thanks @benz
  • Loading branch information
couin3 committed Nov 27, 2020
1 parent ee41b77 commit 3e9ea1e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion RFLink/Plugins/Plugin_029.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ boolean Plugin_029(byte function, char *string)
// Now process the various sensor types
//==================================================================================
rc = (data[0] << 4) | (data[1] >> 4); // rolling code
byte bat = !((data[1] >> 3) & 0x1); // supposed bat bit
byte bat = !((data[1] >> 3) & 0x1); // supposed bat bit
int temp = 0;
unsigned int rain = 0;
byte hum = 0;
Expand All @@ -138,6 +138,11 @@ boolean Plugin_029(byte function, char *string)
unsigned int wgust = 0;

temp = (((data[1] & 0x3) << 8 | data[2]) - 400);
if (temp < 0)
{
temp *= -1;
temp += 0x8000;
}
hum = data[3];
wspeed = data[4] * 245;
wspeed /= 20;
Expand Down

0 comments on commit 3e9ea1e

Please sign in to comment.