Skip to content

Commit

Permalink
Added support for bad wheater. Negative temperature properly handled. (
Browse files Browse the repository at this point in the history
  • Loading branch information
aquaticus authored and dgomes committed Sep 15, 2018
1 parent 7673528 commit ad82a02
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions digoo.cpp
Expand Up @@ -22,7 +22,7 @@

digoo::digoo() {
packet_size = 37;
END_PACKET = 3000;
END_PACKET = 3000;
MIN_PACKET = 650;
}

Expand All @@ -43,7 +43,9 @@ uint8_t digoo::getChannel(uint64_t packet) {
}

float digoo::getTemperature(uint64_t packet) {
float temperature = float((packet >> 12) & 0xFFF) / 10;
int16_t t = packet >> 12 & 0x0FFF;
t = 0x0800 & t ? 0xF000 | t : t;
float temperature = float(t) / 10;
return temperature;
}

Expand Down Expand Up @@ -87,4 +89,3 @@ void digoo::processPacket() {
}
#endif
}

0 comments on commit ad82a02

Please sign in to comment.