adafruit / adafruit/Adafruit_CircuitPython_IRRemote
nbits throws exception when nbits is smaller that bytes*8
- Dominant language
- Python
- Stars
- 29
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
The following code generates the following exception
Code:
ir_tx_code = [0x00, 0xff, 0xaa, 0x55, 0x5A]
encoder.transmit(pulseout, ir_tx_code, nbits=32)
Exception:
Traceback (most recent call last):
File "nonblocking.py", line 31, in
File "adafruit_irremote.py", line 403, in transmit
IndexError: index out of range
The internal documentation suggests that the number of bits can be limited with the nbits option.
When used it throws a exception.
Lines 380, 381, 382 of the library should catch and adjust to enforce the option.
Bruce
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the failure with the example in nonblocking.py, then inspect the transmit logic around lines 380-382 of adafruit_irremote.py and the reported failure at line 403. Done means transmit accepts nbits=32 when the byte list contains more bits, avoids IndexError, and limits transmission to the requested bit count.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 85/100