Skip to content

Make sure to check every pulse length immediately. #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions adafruit_irremote.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@

import array

__version__ = "0.0.0-auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_IRRemote.git"

class IRDecodeException(Exception):
"""Generic decode exception"""
pass
Expand Down Expand Up @@ -198,11 +201,12 @@ def read_pulses(self, input_pulses, max_pulse=10000, blocking=True):
If False, will return None if no pulses.
Defaults to True for backwards compatibility
"""
if not input_pulses and not blocking:
return None
received = []
while True:
while len(input_pulses) < 8: # not too big (slower) or too small (underruns)!
if not blocking:
return None
while not input_pulses:
pass
while input_pulses:
pulse = input_pulses.popleft()
if pulse > max_pulse:
Expand Down