catch minus zero deg on DHT22

This commit is contained in:
Arne Glaser 2021-02-17 09:25:18 +01:00
parent daf4c86055
commit d2164b66b7

View File

@ -110,7 +110,10 @@ float DHT::readTemperature(bool S, bool force) {
case DHT22: case DHT22:
case DHT21: case DHT21:
int16_t t = ((int16_t)data[2] << 8) | data[3]; int16_t t = ((int16_t)data[2] << 8) | data[3];
f = t * 0.1; if(data[2] == 0x80)
f = 0;
else
f = t * 0.1;
if (S) { if (S) {
f = convertCtoF(f); f = convertCtoF(f);
} }