Handle Oregon EA4C temperatures over 100 degrees. This closes #261

This commit is contained in:
Micke Prag 2013-03-07 14:59:31 +01:00
parent 2effb362a0
commit 59e3ab8c16

View file

@ -34,6 +34,7 @@ std::string ProtocolOregon::decodeEA4C(const std::string &data) {
uint8_t checksumw = (value >> 4) & 0xF;
bool neg = value & (1 << 3);
int hundred = value & 3;
checksum += (value & 0xF);
value >>= 8;
@ -58,7 +59,7 @@ std::string ProtocolOregon::decodeEA4C(const std::string &data) {
return "";
}
double temperature = ((temp1 * 100) + (temp2 * 10) + temp3)/10.0;
double temperature = ((hundred * 1000) + (temp1 * 100) + (temp2 * 10) + temp3)/10.0;
if (neg) {
temperature = -temperature;
}