Skip to content

Commit d4ff748

Browse files
authored
Merge pull request #13 from tannewt/fix_read
Make sure to check every pulse length immediately.
2 parents 084cbd6 + 525cbfa commit d4ff748

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

adafruit_irremote.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@
7474

7575
import array
7676

77+
__version__ = "0.0.0-auto.0"
78+
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_IRRemote.git"
79+
7780
class IRDecodeException(Exception):
7881
"""Generic decode exception"""
7982
pass
@@ -198,11 +201,12 @@ def read_pulses(self, input_pulses, max_pulse=10000, blocking=True):
198201
If False, will return None if no pulses.
199202
Defaults to True for backwards compatibility
200203
"""
204+
if not input_pulses and not blocking:
205+
return None
201206
received = []
202207
while True:
203-
while len(input_pulses) < 8: # not too big (slower) or too small (underruns)!
204-
if not blocking:
205-
return None
208+
while not input_pulses:
209+
pass
206210
while input_pulses:
207211
pulse = input_pulses.popleft()
208212
if pulse > max_pulse:

0 commit comments

Comments
 (0)