Skip to content

Crash due to PulseOut and HID interaction #4738

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

Closed
dhalbert opened this issue May 10, 2021 · 1 comment · Fixed by #4798
Closed

Crash due to PulseOut and HID interaction #4738

dhalbert opened this issue May 10, 2021 · 1 comment · Fixed by #4798

Comments

@dhalbert
Copy link
Collaborator

dhalbert commented May 10, 2021

Originally posted by @jerryneedell in #4734 (comment)

OK -- one more example.
On the CPX, I created a new code.py that just just uses the neopixels. It runs fine with this PR.
I also ran some more test on the pirkey_m0 and it appears that the issue only occurs when I try to use irremote in the code.py. This is consistent with the CPX example as well. Given that, perhaps it is OK to move ahead with merging this PR and focusing on a potential issue with irremote.
Since the issue also occurs on the CPX, I will continue troubleshooting there to eliminate the pirkey_m0 from the equation.

It's not as simple as I had hoped -- loading the irremote_simpletest.py as code.py works OK on the CPX....I will see if I can identify the trigger of the failure.

using just this as code,py on te CPX does induce the failure.


import adafruit_irremote
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
import neopixel
import pulseio
import board
import time
import usb_hid


led = neopixel.NeoPixel(board.NEOPIXEL,10)

# The keyboard object!
time.sleep(1)  # Sleep for a bit to avoid a race condition on some systems
keyboard = Keyboard(usb_hid.devices)
keyboard_layout = KeyboardLayoutUS(keyboard)  # We're in the US :)

# our infrared pulse decoder helpers
pulsein = pulseio.PulseIn(board.REMOTEIN, maxlen=120, idle_state=True)
decoder = adafruit_irremote.GenericDecode()
# size must match what you are decoding! for NEC use 4
received_code = bytearray(4)

It is this line that induces the failure

decoder = adafruit_irremote.GenericDecode()

however - that is also present in the irremote_simpletest that works....
Possibly some interaction with irremote and usb_hid....

@dhalbert
Copy link
Collaborator Author

It turns out this is another manifestation of the bug in #4791, which should be fixed by #4798.

I tested the sample code above and it does not crash with #4798 applied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants