forked from adafruit/DHT-sensor-library
Cause interrupts to be reenabled if a timeout occurs while waiting for the sensor.
This commit is contained in:
7
DHT.cpp
7
DHT.cpp
@ -140,7 +140,8 @@ boolean DHT::read(void) {
|
||||
|
||||
// Turn off interrupts temporarily because the next sections are timing critical
|
||||
// and we don't want any interruptions.
|
||||
noInterrupts();
|
||||
{
|
||||
InterruptLock lock;
|
||||
|
||||
// End the start signal by setting data line high for 40 microseconds.
|
||||
digitalWrite(_pin, HIGH);
|
||||
@ -193,9 +194,9 @@ boolean DHT::read(void) {
|
||||
// cycle count so this must be a zero. Nothing needs to be changed in the
|
||||
// stored data.
|
||||
}
|
||||
// Timing critical code is now complete.
|
||||
|
||||
// Re-enable interrupts, timing critical code is complete.
|
||||
interrupts();
|
||||
}
|
||||
|
||||
DEBUG_PRINTLN(F("Received:"));
|
||||
DEBUG_PRINT(data[0], HEX); DEBUG_PRINT(F(", "));
|
||||
|
Reference in New Issue
Block a user