Skip to content

Crash at initialisation when usb_midi is disabled in boot.py #33

Closed
@x-magic

Description

@x-magic

I know this is not a common use case but certainly can be addressed somehow.

When I disabled usb_midi in boot.py:

import usb_midi
usb_midi.disable()  # Midi interface

Then initialise adafruit_macropad in code.py:

from adafruit_macropad import MacroPad
macropad = MacroPad()

It throws an IndexError:

Traceback (most recent call last):
  File "code.py", line 13, in <module>
  File "adafruit_macropad.py", line 172, in __init__
IndexError: tuple index out of range

Which references

# Define MIDI:
self._midi = adafruit_midi.MIDI(
midi_in=usb_midi.ports[0],
# MIDI uses channels 1-16. CircuitPython uses 0-15. Ergo -1.
in_channel=midi_in_channel - 1,
midi_out=usb_midi.ports[1],
out_channel=midi_out_channel - 1,
)

Well this makes sense. As macropad lib also initialise hid devices and similar, I haven't tried if I disable HID would it crashes the library, too.

And of course if I simply get rid of adafruit_midi library, macropad lib crashes as well.

Maybe those things should really be modular? Thanks

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions