Fix error reporting for DHT bit read loop (#2344)

This commit is contained in:
besteru 2021-09-20 10:14:44 +03:00 committed by GitHub
parent 5f21b925da
commit 82eca13d7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -122,6 +122,8 @@ bool HOT ICACHE_RAM_ATTR DHT::read_sensor_(float *temperature, float *humidity,
break; break;
} }
} }
if (error_code != 0)
break;
start_time = micros(); start_time = micros();
uint32_t end_time = start_time; uint32_t end_time = start_time;
@ -136,6 +138,8 @@ bool HOT ICACHE_RAM_ATTR DHT::read_sensor_(float *temperature, float *humidity,
break; break;
} }
} }
if (error_code != 0)
break;
if (i < 0) if (i < 0)
continue; continue;