eliteio / PietteTech_DHT

DHT Sensor Library for Spark Core
Other
9 stars 6 forks source link

Fix hang condition when no data is returned. #4

Closed jayennis22 closed 3 years ago

jayennis22 commented 3 years ago

When there is no response (and therefore no interrupt) from the DHT device after acquire() is triggered, the state machine is left in the RESPONSE state with the ISR attached. While the ISR is attached, calling attach() again doesn't actually signal the DHT device because pinMode doesn't set the pin to OUTPUT mode. This change detects that failure and resets the state machine and the detaches the ISR.