adafruit-circuitpython-irremote 5.0.8__tar.gz → 5.0.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/PKG-INFO +1 -1
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/adafruit_circuitpython_irremote.egg-info/PKG-INFO +1 -1
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/adafruit_irremote.py +36 -14
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/pyproject.toml +1 -1
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/.gitattributes +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/.github/PULL_REQUEST_TEMPLATE/adafruit_circuitpython_pr.md +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/.github/workflows/build.yml +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/.github/workflows/failure-help-text.yml +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/.github/workflows/release_gh.yml +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/.github/workflows/release_pypi.yml +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/.gitignore +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/.pre-commit-config.yaml +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/.readthedocs.yaml +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/CODE_OF_CONDUCT.md +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/LICENSE +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/LICENSES/CC-BY-4.0.txt +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/LICENSES/MIT.txt +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/LICENSES/Unlicense.txt +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/README.rst +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/README.rst.license +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/adafruit_circuitpython_irremote.egg-info/SOURCES.txt +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/adafruit_circuitpython_irremote.egg-info/dependency_links.txt +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/adafruit_circuitpython_irremote.egg-info/requires.txt +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/adafruit_circuitpython_irremote.egg-info/top_level.txt +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/docs/_static/custom.css +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/docs/_static/favicon.ico +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/docs/_static/favicon.ico.license +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/docs/api.rst +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/docs/api.rst.license +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/docs/conf.py +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/docs/examples.rst +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/docs/examples.rst.license +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/docs/index.rst +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/docs/index.rst.license +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/docs/requirements.txt +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/examples/irremote_nonblocking.py +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/examples/irremote_simpletest.py +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/examples/irremote_transmit.py +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/optional_requirements.txt +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/requirements.txt +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/ruff.toml +0 -0
- {adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/setup.cfg +0 -0
{adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/adafruit_irremote.py
RENAMED
|
@@ -64,7 +64,7 @@ Implementation Notes
|
|
|
64
64
|
|
|
65
65
|
"""
|
|
66
66
|
|
|
67
|
-
__version__ = "5.0.
|
|
67
|
+
__version__ = "5.0.9"
|
|
68
68
|
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_IRRemote.git"
|
|
69
69
|
|
|
70
70
|
|
|
@@ -204,6 +204,8 @@ class NonblockingGenericDecode:
|
|
|
204
204
|
|
|
205
205
|
:param ~pulseio.PulseIn input_pulses: Object to read pulses from
|
|
206
206
|
:param int max_pulse: Pulse duration to end a burst. Units are microseconds.
|
|
207
|
+
:param float idle_timeout: Time with no new pulses that ends a burst. Units are seconds.
|
|
208
|
+
Must be longer than ``max_pulse``, or a pause inside a message would end it.
|
|
207
209
|
|
|
208
210
|
>>> pulses = PulseIn(...)
|
|
209
211
|
>>> decoder = NonblockingGenericDecoder(pulses)
|
|
@@ -218,11 +220,26 @@ class NonblockingGenericDecode:
|
|
|
218
220
|
... ...
|
|
219
221
|
"""
|
|
220
222
|
|
|
221
|
-
def __init__(self, pulses: list, max_pulse: int = 10_000) -> None:
|
|
223
|
+
def __init__(self, pulses: list, max_pulse: int = 10_000, idle_timeout: float = 0.020) -> None:
|
|
224
|
+
if idle_timeout * 1_000_000 <= max_pulse:
|
|
225
|
+
raise ValueError("idle_timeout must be longer than max_pulse")
|
|
222
226
|
self.pulses = pulses # PulseIn
|
|
223
227
|
self.max_pulse = max_pulse
|
|
228
|
+
self._idle_timeout_ns = int(idle_timeout * 1_000_000_000)
|
|
229
|
+
self._last_pulse_ns = 0 # when read() last found new pulses
|
|
224
230
|
self._unparsed_pulses = [] # internal buffer of partial messages
|
|
225
231
|
|
|
232
|
+
def _end_message(self):
|
|
233
|
+
# End of message! Decode it and return a BaseIRMessage.
|
|
234
|
+
try:
|
|
235
|
+
result = decode_bits(self._unparsed_pulses)
|
|
236
|
+
except FailedToDecode as err:
|
|
237
|
+
# If you want to debug failed decodes, this would be a good
|
|
238
|
+
# place to print/log or (re-)raise.
|
|
239
|
+
result = err.args[0]
|
|
240
|
+
self._unparsed_pulses.clear()
|
|
241
|
+
return result
|
|
242
|
+
|
|
226
243
|
def read(self) -> None:
|
|
227
244
|
"""
|
|
228
245
|
Consume all pulses from PulseIn. Yield decoded messages, if any.
|
|
@@ -230,24 +247,29 @@ class NonblockingGenericDecode:
|
|
|
230
247
|
If a partial message is received, this does not block to wait for the
|
|
231
248
|
rest. It stashes the partial message, to be continued the next time it
|
|
232
249
|
is called.
|
|
250
|
+
|
|
251
|
+
A message ends at a pulse longer than ``max_pulse``, or when no new
|
|
252
|
+
pulses have arrived for ``idle_timeout`` seconds. PulseIn records the
|
|
253
|
+
gap after the last message only when the next message starts, so
|
|
254
|
+
without the timeout the last message would wait for the next one.
|
|
233
255
|
"""
|
|
256
|
+
now = time.monotonic_ns()
|
|
257
|
+
found_pulses = False
|
|
234
258
|
# Consume from PulseIn.
|
|
235
259
|
while self.pulses:
|
|
260
|
+
found_pulses = True
|
|
236
261
|
pulse = self.pulses.popleft()
|
|
237
262
|
if pulse <= self.max_pulse:
|
|
238
263
|
self._unparsed_pulses.append(pulse)
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
self._unparsed_pulses.clear()
|
|
250
|
-
yield result
|
|
264
|
+
elif self._unparsed_pulses:
|
|
265
|
+
yield self._end_message()
|
|
266
|
+
# Otherwise it is a gap with nothing before it: the idle time
|
|
267
|
+
# before the first message, or a message that timed out.
|
|
268
|
+
|
|
269
|
+
if found_pulses:
|
|
270
|
+
self._last_pulse_ns = now
|
|
271
|
+
elif self._unparsed_pulses and now - self._last_pulse_ns >= self._idle_timeout_ns:
|
|
272
|
+
yield self._end_message()
|
|
251
273
|
|
|
252
274
|
|
|
253
275
|
class GenericDecode:
|
{adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/pyproject.toml
RENAMED
|
@@ -12,7 +12,7 @@ requires = [
|
|
|
12
12
|
[project]
|
|
13
13
|
name = "adafruit-circuitpython-irremote"
|
|
14
14
|
description = "CircuitPython library for infrared transmit and receive."
|
|
15
|
-
version = "5.0.
|
|
15
|
+
version = "5.0.9"
|
|
16
16
|
readme = "README.rst"
|
|
17
17
|
authors = [
|
|
18
18
|
{name = "Adafruit Industries", email = "circuitpython@adafruit.com"}
|
{adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/.gitattributes
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/.readthedocs.yaml
RENAMED
|
File without changes
|
{adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/CODE_OF_CONDUCT.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/LICENSES/MIT.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/README.rst.license
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/docs/api.rst
RENAMED
|
File without changes
|
{adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/docs/api.rst.license
RENAMED
|
File without changes
|
{adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/docs/conf.py
RENAMED
|
File without changes
|
{adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/docs/examples.rst
RENAMED
|
File without changes
|
|
File without changes
|
{adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/docs/index.rst
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{adafruit_circuitpython_irremote-5.0.8 → adafruit_circuitpython_irremote-5.0.9}/requirements.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|