Skip to content

feat(firmware): add MIDI over USB-C with a separate MIDI test package - #10

Merged
isod89 merged 5 commits into
isod89:mainfrom
VinSpee:fm/openpocket-upstream-midi
Nov 8, 2026
Merged

isod89 merged 5 commits into
isod89:mainfrom
VinSpee:fm/openpocket-upstream-midi

Conversation

@VinSpee

@VinSpee VinSpee commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

This adds MIDI over USB-C. The pedal now receives Program Change and Control Change on a chosen channel, using the Control Change map documented in docs/MIDI.md, and sends Program Change and Control Change when the preset or a knob changes. A MIDI clock sets the delay time. The channel and related settings are saved in the preset store, and a new MIDI page on the screen edits them. The update entry and the editor protocol keep working next to musical MIDI.

The firmware is released as a separately labelled "MIDI TEST" package (version 37), selected with ?channel=midi-test on the installer page, so the default installer package is unchanged. The Makefile, tools/op.mjs and CI build and upload it as its own artifact. docs/MIDI-TEST.md is the hardware checklist, and docs/MIDI.md also records why Bluetooth MIDI is deferred: the repository has no Bluetooth LE stack.

The decoder, map, send logic, store and UI are covered by new host simulators (tests/midisim.c, tests/midiio.c), and the full host test suite passes. It was proven on a real pedal over USB-C.

… send, settings byte, clock to delay time

firmware/px_midi.h has no hardware and is tested on a PC (tests/midisim.c). px_dly_value_for_ms picks the delay TIME
step nearest a time.
… pedal's changes out, MIDI page, settings in the store

usb.c is unchanged. Nothing emptied its MIDI input ring, which also stalls the editor's and the installer's SysEx when it
fills; px_midi_service now drains it every pass. FX held 0.8 s opens the MIDI page (channel, send, clock to delay); the
settings are one byte in the preset store's header (0 = defaults, as every earlier save).
…t, docs and the hardware test plan

OP_CHANNEL=midi-test builds firmware/openpocket-midi-test.bin and docs/firmware/midi-test/ with their own version and
manifest; the release files and the default manifest are not touched. docs/MIDI.md (design, CC map, Bluetooth findings and
future work), docs/MIDI-TEST.md (checklist for the captain), README and SOUNDS-AND-CONTROLS.
steponme82 added a commit to steponme82/openpocket that referenced this pull request Nov 6, 2026
…OME in the tuner)

isod89#8. With PC7 low after the first byte the LED map lit
every button on a BlackBox, and the map is the panel's order: bit 0
HOME, 1 FX, 2 AMP, 3 MOD, 4 DLY, 5 REV, 6 CAB, 7 none.

firmware/px_lights.h decides the lights once per main-loop pass from
the preset: AMP, MOD, DLY, REV and CAB lit while their block is on, FX
while any block of the FX button's group is on (drive, SFX, synth,
pitch, comp, gate, EQ: ui.h's UI_FXB, now shared with ui_fx_cycle),
HOME blinking at 2 Hz while the tuner is open. On the wire a 0 lights,
so the byte goes out inverted, and only when it changes (as the stock
firmware). The normal firmware calls leds_init after audio_start (all
off loaded, then PC7 low) and lights_update in the main loop; the
update screen turns them off (px_usb.h PX_LIGHTS_OFF, from ota_show).

Not in this change: a setting to switch the lights off. It belongs with
the settings store isod89#10 adds.

LED_BLINK (the test switch) is gone; LED_PROBE 1 still builds the LED
map. tests/lightsim.c: every block alone lights its own button, all on
lights the six and not HOME, HOME blinks at 2 Hz in the tuner only, bit
7 never lit, nothing written when nothing changes, lights_off, only
PC5..PC8 touched. Its expected bits are the LED map's, written out
again; 8 of 8 deliberate mistakes fail it. In run_tests.sh the step
keeps the test's exit code (a pipe into tail would hide it).

Not run on a pedal yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
steponme82 added a commit to steponme82/openpocket that referenced this pull request Nov 6, 2026
…OME in the tuner)

isod89#8. With PC7 low after the first byte the LED map lit
every button on a BlackBox, and the map is the panel's order: bit 0
HOME, 1 FX, 2 AMP, 3 MOD, 4 DLY, 5 REV, 6 CAB, 7 none.

firmware/px_lights.h decides the lights once per main-loop pass from
the preset: AMP, MOD, DLY, REV and CAB lit while their block is on, FX
while any block of the FX button's group is on (drive, SFX, synth,
pitch, comp, gate, EQ: ui.h's UI_FXB, now shared with ui_fx_cycle),
HOME blinking at 2 Hz while the tuner is open. On the wire a 0 lights,
so the byte goes out inverted, and only when it changes (as the stock
firmware). The normal firmware calls leds_init after audio_start (all
off loaded, then PC7 low) and lights_update in the main loop; the
update screen turns them off (px_usb.h PX_LIGHTS_OFF, from ota_show).

Not in this change: a setting to switch the lights off. It belongs with
the settings store isod89#10 adds.

LED_BLINK (the test switch) is gone; LED_PROBE 1 still builds the LED
map. tests/lightsim.c: every block alone lights its own button, all on
lights the six and not HOME, HOME blinks at 2 Hz in the tuner only, bit
7 never lit, nothing written when nothing changes, lights_off, only
PC5..PC8 touched. Its expected bits are the LED map's, written out
again; 8 of 8 deliberate mistakes fail it. In run_tests.sh the step
keeps the test's exit code (a pipe into tail would hide it).

Not run on a pedal yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@isod89
isod89 merged commit b755244 into isod89:main Nov 8, 2026
1 check passed
isod89 added a commit that referenced this pull request Nov 8, 2026
…e web installer (VinSpee)

Conflict: Makefile (.PHONY: package-test from #10 and flash).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LFaxqW3CpFrLCvqoteTUv9
isod89 added a commit that referenced this pull request Nov 8, 2026
Conflicts: Makefile, docs/BUILDING.md, tests/run_tests.sh, tests/test_op.mjs,
tools/op.mjs (the sim command beside flash and rescue), tests/edsim.c (v37's NAM slots
beside the simulator's screen). edsim.c now also includes px_midi.h for ui.h's MIDI
page (#10); test_sim.mjs takes the version from edsim.c instead of v36.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LFaxqW3CpFrLCvqoteTUv9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants