Correct OW code in case of DHT reading error

This commit is contained in:
destroyedlolo 2018-03-24 13:46:19 +01:00
parent ac43646ce5
commit 28f9205701

View File

@ -92,6 +92,8 @@ void setup(){
void loop(){ void loop(){
delay(10); delay(10);
// No need to have a local copy of "state" as we are looking
// for only one value
if(state == DeviceState::CONVERTING){ // start conversion if(state == DeviceState::CONVERTING){ // start conversion
float temperature = 0; float temperature = 0;
float humidite = 0; float humidite = 0;
@ -103,10 +105,9 @@ void loop(){
Serial.println(err); Serial.println(err);
#endif #endif
temperature = 85; temperature = 85;
} else { } else
setTemperature( temperature ); setTemperature( temperature );
state = DeviceState::TEMPERATUREREADY; state = DeviceState::TEMPERATUREREADY;
OWSlave.beginWriteBit(1, true); OWSlave.beginWriteBit(1, true);
}
} }
} }