We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 23254ca + 125890e commit 5493703Copy full SHA for 5493703
adafruit_dht.py
@@ -138,7 +138,11 @@ def measure(self):
138
delay_between_readings = 0.5
139
if self._dht11:
140
delay_between_readings = 1.0
141
- if time.monotonic()-self._last_called > delay_between_readings:
+ # Initiate new reading if this is the first call or if sufficient delay
142
+ # If delay not sufficient - return previous reading.
143
+ # This allows back to back access for temperature and humidity for same reading
144
+ if (self._last_called == 0 or
145
+ (time.monotonic()-self._last_called) > delay_between_readings):
146
self._last_called = time.monotonic()
147
148
pulses = self._get_pulses()
0 commit comments