Ignore temperature readings of 0x7FF

This commit is contained in:
jazzpi 2022-07-19 19:34:09 +02:00
parent 5213a41174
commit 93bd0dfe76
1 changed files with 4 additions and 0 deletions

View File

@ -166,6 +166,10 @@ HAL_StatusTypeDef tmp144_recv_temps(TMP144Bus* bus) {
size_t buf_offset = headerlen + 2 * i; size_t buf_offset = headerlen + 2 * i;
uint16_t temp = uint16_t temp =
(bus->rxbuf[buf_offset] >> 4) | (bus->rxbuf[buf_offset + 1] << 4); (bus->rxbuf[buf_offset] >> 4) | (bus->rxbuf[buf_offset + 1] << 4);
if (temp == 0x7FF) {
// Extremely unlikely, probably the sensor is just broken
temp = 0;
}
temperatures[temperatures_offset + i] = temp; temperatures[temperatures_offset + i] = temp;
} }