From 12b15705740c5cad0c8bcf26d945b794cdc22733 Mon Sep 17 00:00:00 2001 From: MaderDash Date: Fri, 9 May 2025 07:59:28 -0500 Subject: [PATCH 1/2] I fixed the DHT11 NOT being refreshed at 1 second intervals. --- DHT.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/DHT.cpp b/DHT.cpp index a48ac74..1f920a3 100644 --- a/DHT.cpp +++ b/DHT.cpp @@ -43,6 +43,12 @@ DHT::DHT(uint8_t pin, uint8_t type, uint8_t count) { (void)count; // Workaround to avoid compiler warning. _pin = pin; _type = type; + // Adjust MIN_INTERVAL based on sensor type + if (_type == DHT11) { + _minInterval = 1000; // 1 second for DHT11 + } else { + _minInterval = 2000; // 2 seconds for other types + } #ifdef __AVR _bit = digitalPinToBitMask(pin); _port = digitalPinToPort(pin); From da3d9a7f0e25519e811dbd0bd4336e4131983a64 Mon Sep 17 00:00:00 2001 From: MaderDash Date: Fri, 9 May 2025 12:54:33 -0500 Subject: [PATCH 2/2] updated the header file. --- DHT.h | 1 + 1 file changed, 1 insertion(+) diff --git a/DHT.h b/DHT.h index 95570e1..28e8e98 100644 --- a/DHT.h +++ b/DHT.h @@ -76,6 +76,7 @@ class DHT { private: uint8_t data[5]; uint8_t _pin, _type; + uint32_t _minInterval; // Minimum interval between reads #ifdef __AVR // Use direct GPIO access on an 8-bit AVR so keep track of the port and // bitmask for the digital pin connected to the DHT. Other platforms will use