Skip to content

Button lights on the BlackBox: they follow the blocks (#8) - #17

Merged
isod89 merged 1 commit into
isod89:mainfrom
steponme82:button-lights
Nov 8, 2026
Merged

isod89 merged 1 commit into
isod89:mainfrom
steponme82:button-lights

Conversation

@steponme82

Copy link
Copy Markdown
Contributor

@isod89

The button lights work on my BlackBox. This is the driver from #8.

What they show:
1: AMP, MOD, DLY, REV and CAB are lit while their block is on
2: FX is lit while any block of the FX group is on (drive, SFX, synth, pitch, comp, gate, EQ). It's the same list the FX button cycles through, now UI_FXB in ui.h so both use it
3: HOME blinks while the tuner is open
4: all dark during an update

How:
1: px_leds.h drives the 595 the way you read it (DS PC8, SHCP PC5, STCP PC6). At init it loads the all-off byte, then drives PC7 low, like stock. PC7 is the lights' enable, not a screen line. lcd_init and input_init still set it high at boot, only their comments changed
2: px_lights.h builds the byte once per main loop pass and writes it only when it changes. On the wire a 0 lights, so it goes out inverted like stock
3: led_probe.h is the LED map build I used to read the bits (LED_PROBE 1, off by default). It can map a Pocket X too
4: tests/lpsim.c and tests/lightsim.c model the 595 with its enable on PC7. Both run in tests/run_tests.sh

Tested:
1: on my BlackBox the lights follow the blocks, also when I change preset, and HOME blinks in the tuner
2: the host tests all pass, and the two new tests catch all 19 deliberate mistakes I tried in the code
3: the CI build on my fork compiles with no warnings

Not tested on a Pocket X. The same firmware runs there and you found the same routine, but the bit order may be different. If you can, install it and check that each light sits on the right button. If not, LED_PROBE 1 gives the map in a minute.

Not in this PR: a setting to switch the lights off. It needs a place to save settings, and VinSpee's #10 adds the first one. I'll add it on top once #10 is in.

Heads up: #10 and #16 also add lines after the screen step in tests/run_tests.sh, so whichever goes in second gets a small conflict there. Keep both blocks.

🤖 Generated with Claude Code

@isod89

isod89 commented Nov 7, 2026

Copy link
Copy Markdown
Owner

@steponme82 NICE JOB! please read #16 more info about my current work. thank you so much for you help

@steponme82

Copy link
Copy Markdown
Contributor Author

@isod89

Thanks! No rush, v37 first.

1: once v37 is pushed I'll rebase #17 on it myself, so you don't have to deal with the conflicts
2: the lights-off setting comes after that, on top of the settings store from #10
3: since the memory layout is changing, keep in mind the 021 point I left on #16. On a BlackBox that ran 021, the install overwrites the first 16K of its VM

If a second pair of eyes helps with the NAM speed, I have JieLi's objdump running here and I can go through how 021 uses the vector unit and the second core. Tell me where to start.

The BlackBox's button lights hang on a 74HC595 on port C (DS PC8, shift
clock PC5, latch PC6), as the stock firmware drives it. PC7 is the
lights' enable, low = on. OpenPocket held PC7 high as a screen line, so
the lights stayed dark whatever the 595 held.

- px_leds.h: the 595 driver. leds_init loads the all-off byte with the
  lights disabled, then drives PC7 low, in the stock order.
- px_lights.h: what they show, once per main-loop pass. AMP, MOD, DLY,
  REV and CAB light while their block is on, FX while any block of its
  group is on (ui.h UI_FXB, shared with the FX button), HOME blinks in
  the tuner. The byte is written only when it changes. Off during an
  update (px_usb.h PX_LIGHTS_OFF).
- led_probe.h (LED_PROBE 1): the LED map build that read the bit order
  on a BlackBox: 0 HOME, 1 FX, 2 AMP, 3 MOD, 4 DLY, 5 REV, 6 CAB.
- tests/lpsim.c and tests/lightsim.c: a 595 model with its enable on
  PC7; both run from tests/run_tests.sh.

Confirmed on a BlackBox. Not tried on a Pocket X yet: the same firmware
runs there and the stock routine is the same, but its bit order may
differ.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
isod89 added a commit that referenced this pull request Nov 8, 2026
Conflict in firmware/openpocket.c: the lights' update and v37's '2C' status line kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LFaxqW3CpFrLCvqoteTUv9
@isod89
isod89 merged commit aca95fa into isod89:main Nov 8, 2026
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