Skip to content

Crash due to PulseOut and HID interaction #4738

Closed
@dhalbert

Description

@dhalbert

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....

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions