Skip to content

Commit 847ce95

Browse files
committed
Immediately pause pulse_in after initialization
Right now, pulse_in is active until the first reading and only paused after that. Let's immediately pause it to free up the CPU.
1 parent 35cc6b4 commit 847ce95

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

adafruit_dht.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def __init__(self, dht11, pin, trig_wait):
6767
# and we're better off having a running process
6868
if _USE_PULSEIO:
6969
self.pulse_in = PulseIn(self._pin, 81, True)
70+
self.pulse_in.pause()
7071

7172
def _pulses_to_binary(self, pulses, start, stop):
7273
"""Takes pulses, a list of transition times, and converts
@@ -114,7 +115,6 @@ def _get_pulses_pulseio(self):
114115
# specific length of time. Then the device sends back a
115116
# series HIGH and LOW signals. The length the HIGH signals
116117
# represents the device values.
117-
self.pulse_in.pause()
118118
self.pulse_in.clear()
119119
self.pulse_in.resume(self._trig_wait)
120120

0 commit comments

Comments
 (0)