chaeplin/PietteTech_DHT-8266

Watchdog is triggered on DHT.acquireAndWait(0); if no DHT22 is connected

Closed this issue · 8 comments

tzapu commented

If no DHT22 connected watchdog is triggered on DHT.acquireAndWait(0);
Using ESP8266

Requesting temperatures...

Soft WDT reset

ctx: cont 
sp: 3fff0b90 end: 3fff0d90 offset: 01b0

>>>stack>>>
3fff0d40:  402086f3 feefeffe 00000000 402085cb  
3fff0d50:  3ffefc84 3ffefaac 3ffefca4 4020280e  
3fff0d60:  feefeffe feefeffe feefeffe 3ffefd60  
3fff0d70:  3fffdad0 00000000 3ffefd59 40208c18  
3fff0d80:  feefeffe feefeffe 3ffefd70 40100b98  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)
tzapu commented

a reasonabe 2second timeout sorts the watchdog btw, not sure if it s worth doing anything when it s 0 and no dht is connected in the end...

@tzapu When I tested DHT.acquireAndWait(1000), timeout didn't work.

    acquire();
    uint32_t start = millis();
    uint32_t wrapper;
    while(acquiring() && (timeout == 0 || (millis() > start && (millis()-start) < timeout)));

It's millis. So moved.

    uint32_t start = millis();
    uint32_t wrapper;
    acquire();
    while(acquiring() && (timeout == 0 || (millis() > start && (millis()-start) < timeout)));

In example, without DHT.acquireAndWait, first report will be temp : 0, hum 0.

committed : af75855

tzapu commented

well, with timeout(2000) i was seeing random reads make it through and others failing so i reverted back to timeout(0) even though it would of failed without dht connected

thanks for the quick change, will play with it later
cheers

to check : piettetech#2

tzapu commented

i can confirm the timeout works as intended, set it to 5 secs, it returns after 5 secs
however, on 0 it it still throws exception on an esp.
adding a delay(0) in the while sorts it but i am not sure if it would effect anything else

while(acquiring() && (timeout == 0 || (millis() > start && (millis()-start) < timeout))) {
      delay(0);
 };

@tzapu delay(0) is added. Thank you.

e57ceb2

tzapu commented

all good, i guess this can be closed, lovely lib

i hope it helps with my deep sleeping dht issues, we ll see

@tzapu Thank you.