Skip to content

feat(firmware): Bluetooth test image (make bt): A2DP music, BLE MIDI footswitch, editor over Bluetooth - #30

Open
steponme82 wants to merge 118 commits into
isod89:mainfrom
steponme82:bt-audio
Open

steponme82 wants to merge 118 commits into
isod89:mainfrom
steponme82:bt-audio

Conversation

@steponme82

@steponme82 steponme82 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

@isod89 @VinSpee

A separate firmware image for Bluetooth, built with make bt (node tools/op.mjs bt). The release image doesn't change: its packages come out byte for byte as v42's (test build 28 had changed it a little, fixed in 40). The branch sits on v42, 117 commits ahead and none behind, so it merges as it is.

What the image does:
1: Music from the phone over Bluetooth (A2DP sink, SBC), the pairing kept, the last phone called back at power-on.
2: Bluetooth MIDI for a footswitch. The regular M-VAVE Chocolate is a peripheral only, so the pedal is its central: it finds it by name (FootCtrl), connects and subscribes. Presets by Program Change.
3: The web editor over Bluetooth MIDI on a second LE link, beside the footswitch and the music (MIDIWeb on an iPhone).
4: Its own models: LOW OCTAVE, SYN PAD and TREBLE BOOST (a germanium treble booster, new in 40). Tap tempo on CC 116, expression pedal on CC 117.
5: New in test build 40: footswitch controls learned on the pedal itself (the Chocolate talks to the pedal, so the editor's own learn never heard it), CC 118/119 for next and previous preset, a SETTINGS page with SWITCH (momentary or latching), INPUT (-10 to +10 dB), TAILS (delay and reverb ring out across switches and preset changes) and BT POWER, NAM captures renamed on the pedal.
6: New in test build 41: the Chocolate by USB cable, the pedal its USB MIDI host (felucca-bsp's opt-in host, its first run on hardware). A SETTINGS row, USB PORT, never saved: every power-on is the normal USB device. The pedal gives no 5 V on its port, so an OTG adapter with a charging input goes between. Also in this image: a computer's USB MIDI clock and CC 116 taps now carry their time (v42 gives them 0, so CLOCK > DELAY over USB never followed).
7: New in test build 42: LOW OCTAVE's octave out of the chain (no amp, cab, delay or reverb on the bass), and a SETTINGS row OUTPUT: MONO as before, STEREO (delay, reverb, seven modulations and the phone's music spread, the two channels summed being exactly the mono sound) or GTR+BASS (the guitar left, the bass right). The pedal's output is stereo; every image so far sent the same sound to both channels.
8: New in test build 43: USB audio, as the release's, now in this image too, with two more choices on SETTINGS: what the computer records (the pedal's sound, the DI, or both) and where the computer's sound comes back into the chain (the output as v42, the input, or right before any block of the preset), the guitar cut there while the computer plays. For guitar-to-MIDI: the DI to MIDI Guitar, its synth back before the pedal's delay and reverb.
9: New in test build 44, in this image only: SHIMMER's octave in tune (the plain shifter put it up to half a semitone off, by the note), BARITONE about 9 ms after the pick instead of 23, MONO SYNTH on a YIN tracker (the old one lost every note above about 600 Hz), SITAR and STRINGS rebuilt (an Indian sitar with jawari and sympathetic strings, an orchestral section), and a new TAPE FLUTE. The release's models are untouched: tests/ownfx_equiv.sh leaves these out by name.
10: New in test build 45, in this image only: MONO SYNTH holds through hum and noise, TAPE FLUTE plays the nearest semitone, WHAMMY's SHIFT is four intervals swept from the note at the heel, and a new WAH on the expression pedal.
11: New in test build 46: controls learned live on the pedal, each a preset's own: hold FX on a block's ON row or on a setting, then press a footswitch's switch or move its pedal. Saving a sound into another slot takes them along; the preset's MIDI table is on its MODEL row. Also GUITAR TONE and PICKUP in SETTINGS: the guitar's pickup as a lower input impedance would load it, as Helix's input impedance does.
12: New in test build 47: GUITAR TONE named by its sound (BRIGHT to MUDDY), SETTINGS walked with the footswitches, PLAY VIEW SWITCHES (the blocks the footswitch's switches drive, big on PLAY), and 12-STRING without the wobble (its DETUNE was 15 cents beating against the guitar's own octave).
13: New in test build 48: the learn as a guided page (pedal or switch, the controller, the value at the heel and at the toe with the pedal there, its own travel kept), and PRESET LVL down to silence, so a learned pedal can be a volume pedal.
14: New in test build 49: scenes, like Helix's snapshots for the blocks' on and off: four a preset, recalled by CC 65 to 68 or a learned switch, kept while playing, saved with the preset. CAB held turns PLAY's view between the chain, the switches and the scenes. To make room, this image's screen draws lowercase letters as capitals (11 KB of flash). Editor protocol 6: the editor shows and edits each preset's learned controls, its scenes and the new settings.
15: New in test build 50: names for the scenes, 3 letters each in every preset, typed in the web editor and shown on the pedal in place of SCENE 2.
16: New in test build 51: an expression pedal with two jobs, as a multi-effect's with its toe switch: the volume while an effect is off, that effect's setting while it is on (a wah's sweep, a whammy, any setting), so whatever turns the effect on, its footswitch or a scene, changes the pedal's job. A green or red line at the screen's edge says which. A SETTINGS row puts the volume right after the input (the default, as a guitar's own volume knob) or before the delay and reverb; the tails ring on in both.
17: Keys at power-on: CAB one core, DLY no footswitch search, REV Bluetooth off.

What it leaves out to fit the Bluetooth stack (the release image keeps all of it):
1: 8 of the 12 factory NAM models. It keeps TWIN, AC15, JCM900 and MARK IV, and a preset with another one plays a kept one. The 16 slots for your own captures are all there.
2: Delay times over 780 ms, on every delay type: TIME stops at 780 ms (REVERSE at 390 ms) instead of 2 s (1 s).
Everything else plays as the release: every model both images have gives the same output bit for bit (tests/ownfx_equiv.sh). Two cores, as the release.

Tested on my BlackBox, test build 38: about 2 hours of music with the Chocolate linked once and never dropped, the editor connected 8 times, no crash, peak DSP load 93%, no guard hits. Still open: 9 short music underruns in 2 hours. Test builds 43, 44, 46, 47 and 50 run on my BlackBox (45's changes came with 46, 48's and 49's with 50); 40 to 42 and 51 are checked on the computer only so far. With 43 the worst case VinSpee raised, USB audio and Bluetooth audio at once, applies: its load not measured yet.

What's in it:
1: firmware/bt/: the A2DP glue, two LE links, the central role and its ATT client, the editor over BLE, the log lines.
2: firmware/ble/ble_os.c: the timers safe in interrupts, the library's usr timeouts run by the 10 kHz tick.
3: third_party/jieli-bt: JieLi's classic controller and host, bitcode from the AC79 SDK archives third_party/jieli-ble already pins (Apache-2.0), and third_party/sbc-android, Android's SBC decoder (Apache-2.0).
4: The engine's additions behind the image's own flags, tools/log.mjs for the pedal's log, docs/BT-AUDIO-TEST.md with every test build's notes, host tests for the LE links, the central's filter and ATT client, the timers, TAILS, TREBLE BOOST, the USB MIDI host, the bass out of the chain, the stereo output, USB audio's return into the chain, the SYN fixes (tests/engine/synfix.c), the expression pedal's WHAMMY, WAH, PRESET LVL, two jobs and the volume's place (tests/engine/exp.c), and the live learn, its guided page and the scenes (tests/uisim.c, tests/midiio.c, tests/test_store.c).
5: The editor: TONE3000 in the same tab when a browser opens no second window, and file labels instead of script clicks; editor protocol 7 for the image's settings, each preset's learned controls (a two-job pedal among them), its scenes and their names (docs/EDITOR-PROTOCOL.md). pxt3k.js also has my fork's own TONE3000 key, picked by origin, for my test site: you may want to drop that line.

The history is long (test builds 1 to 51). Happy to squash it or split it into smaller PRs if you prefer.

🤖 Generated with Claude Code

VinSpee and others added 30 commits November 5, 2026 18:50
build: portable container build and one cross-platform entry point
Merge upstream main (OpenPocket v37) into the fork's main
… and clips; op.mjs dsp

The build also prints the RAM in use, so each change's cost can be read.
… less RAM)

The energy is still summed over all 1024 samples, in the same order, so the estimate is bit for bit the same.
…2 B less RAM)

The IR being loaded fills the first half of ir_X, which is cleared after the load; the scratch block now uses the second
half instead of its own static buffer.
fm1_cstart paints the main and the interrupt stacks before anything runs on them; PING counts the painted words left at
their bottom. It is what tells whether a buffer moved onto a stack still leaves room.
…f the 96 KB RAM)

v40 sized the RAM code window (RAMTEXT) at 88 KB and its code uses about 74 KB. The cabinet IR's input spectra
(ir_X), the wet lanes (px_wl) and three oversampling buffers (px_os_t, px_os_h, px_os_u) now sit after the code in it, in
.bss_hi, which fm1_cstart zeroes like .bss. The PC guard still covers only the code. Off the pedal (host tests, the
simulator) nothing changes.
…the 96 KB RAM)

NOINIT is not cleared at boot, so ble_os_init clears the task table before the main loop first polls it, and paints the
stacks so that their deepest use can be read. The normal firmware has no tasks: nothing changes there.
…s and the deepest task stack's unused bytes

So the heap and the task stacks can be sized from what the pedal used, not guessed.
…the 96 KB RAM)

Seven ways of the data cache run as RAM (px_cacheram.h). In the Bluetooth test image the tuner's buffers take the
first 8,016 B of it and the NAM network's vector unit gets the remaining 20,656 B (28,672 B before). If the cache RAM
fails to start, the tuner shows nothing instead of reading it. The normal firmware is unchanged.
Only the bench screen (BENCH_AT_BOOT, off in every shipped image) calls pxn_bench_layer and pxn_bench_part, at boot;
their two 768 B rings no longer stay in RAM for the whole run.
…ess RAM)

st_commit copied the first 34 slots into a static buffer to write them in one go. st_slot's rows are already contiguous,
so it now writes them from there, and the header from the stack. The flash operations (offsets, lengths, order) and
the flash contents are the same.
…ndow's (2,560 B out of the 96 KB RAM)

px_os_d and px_fqbuf (2,048 B) go after the pool's own buffers (2,096 B were free there), px_os_m (512 B) after the
earlier ones in the RAM code window (1,008 B were free). g_eng and the NAM buffers keep their addresses. fm1_cstart
zeroes the new pool tail like .bss.
ota_stage kept a 1 KB header and a 512 B block in static buffers. ota_session blocks the main loop while it runs, so
no NAM or IR upload (nm_stage) can run meanwhile: the firmware now lends it nm_stage. A half-sent model or IR is
lost if an update is started in the middle of it; its commit then fails its CRC check and is refused. ota.c keeps its
own buffer where no buffer is lent (the simulated pedal).
…of the 96 KB RAM; unverified on hardware)

v40 moved the RAM code out of 0x01C00000..0x01C08000 and left it free. The Bluetooth test image puts nm_stage (the
NAM and IR upload staging, also the update's staging) in its first 24 KB, the part v37's RAM code used at run time.
Whatever nm_stage holds is checked before it is used (CRC, read-back after the flash write), so if something else
wrote there after boot, an upload would be refused rather than the pedal misbehaving. The normal firmware is unchanged.
…nd memset (v40 call range)

v40 made memcpy and memset RAM code, within the call instruction's 4 MiB of the firmware's flash code. The Bluetooth
controller library's code lies after it, up to 0x020794A4, too far: its call to memcpy could not be linked once the
image fitted the RAM. tools/elfsym.py renames the library's memcpy and memset to ble_memcpy and ble_memset (flash
code, ble/ble_libc.c), the library's code goes last in the flash, and app.ld's call-range check covers the firmware's
own flash code (_etext_fw); the linker still refuses any call out of range. The normal firmware's layout is unchanged.
After the stack figures PING now sends a count and that many 2-byte figures: each block's share of an audio block's
time over the last second and the NAM network's (the engine's px_engine.pf, as the tuner page's footer shows it), the
network's way of running, its start-up timing of each way and where one core's time goes in it. op.mjs dsp prints them
per preset; docs/pxedit.js and tools/dsp.mjs find the stack figures before it by the count (tests/test_ping.mjs). It
costs no DSP time.
… 109.9% -> 96.8% of real time, bit-identical)

Measured on the pedal: a load or a 64-bit multiply-add costs 2 cycles, a multiply-add paired with a load also 2 (the
load is free), an ALU instruction 1. rdm (tools/gen_rdq.py --rdm) computes a 3-row layer's rows 0 and 1 two frames at a
time, so every load pairs with a multiply-add (rdl: 5 loads for 4), row 2 as before. post4 runs the post from the
layer's ring without a counter in memory, the residual's weights copied onto the stack so that their loads pair, and
LeakyReLU as smax(z, (z * 42949673) >> 32), equal to the C one for every z. The tap pointers are set by one step each
instead of two loops, and a division by 4 becomes a shift. rdot, rdq and rdl6/15 move to the flash (.text.pxn_cold):
they only serve the start-up check and timing now, and the RAM code window needs the room.

Each hand routine is checked against C at start-up and timed against the others, as before. PXN_HAND runs that check,
the timing and the dispatch on the PC (tests/engine/hand_test.c, in the host tests): C stand-ins that read exactly what
the hand code reads, under the address and undefined-behaviour sanitizers. It fails on the null residual pointer that
crashed a development image of post4 at boot. pxn_equiv / px_nam_equiv run the network with the routines in use against
C (on the PC: modes 0, 5, 9, 10 and 23 NAM presets through the engine, identical).

Start-up timing of the network on the pedal (% of real time): one core 109.9 -> 96.8, two cores 62.4 -> 55.3. The
engine's golden output is unchanged.
…his build

After a failed boot the firmware runs one boot in safe mode with the DSP off. It now skips the NAM hand routines' check
and timing there too: a routine that faults in its check (a development image of post4 did) then costs one boot, not
every one, and the pedal comes up with USB-MIDI between the failing boots, so the installer's rescue reaches it instead
of the pedal looping in its ROM loader (that needed the root-only UBOOT rescue). The CPU1 bar id changes from 27 to 402:
a bar left by the previous build would otherwise keep this one on one core until power-off.
…s DSP load, bit-identical)

The pipeline split the network between the cores by frames: both ran every layer on half of each 32-frame block, the
second waiting for the first at every layer, and the head ran on one core at the end. Now CPU0 runs the input and layers
0..s of each block and hands it over (pxn_lp_a); CPU1 runs layers s+1..22, the head and the output (pxn_lp_b) after the
effects after the amp, and goes on after the interrupt until the block's network blocks are done. a_dec waits only for
the output, the next a_enc collects the job. A layer of a block runs only after the same layer of the block before, and
layer s writes to a hand-over buffer that CPU1 copies into layer s+1's ring, so each ring belongs to one core at a time
and s may move between blocks: it follows the difference between CPU1's work (its waits taken out) and CPU0's share. The
load shown is the busier core's: CPU0 from a_enc (its wait for CPU1 included) plus a_dec's wait, or CPU1's work.
nam_run's output gain and tone stack move to the start of PX_PART_POST (the same operations in the same order).

The layer split's path runs from RAM; to make the room, the frame split's serving (now the fallback), the vector
unit's paths (never chosen) and the C versions of the hand routines (only used if a hand one fails its check) run from
the flash. The hand-over queue (6 KB) is in the cache RAM after the vector unit's buffers; the per-layer counters live
there too, so the RAM is unchanged for the Bluetooth image (90,556 B, 7,748 free) and +64 B for the release image.
PING's profile ends with the split (op.mjs dsp prints it).

Equivalence: tests/engine/lp_test.c (in the host tests, under the sanitizers): every factory model with the split moved
at random and the second core's blocks at random moments, and the pipeline on every NAM preset: the one-core output,
bit for bit. On the pedal a development build ran pxn_lp_equiv at boot (both cores really running, 64 blocks, the split
moved): 0 blocks differ. A version that measured CPU1's whole job span instead of its work drove the split to one end
(load 78-80 %); one that let a_dec wait for the whole job read 100-127 % and bypassed: both reverted before this one.
…s) feeds a synthetic guitar

With the layer split the load shown is the busier core's; PING's profile now ends with CPU0's and CPU1's own load and
their peaks since the preset was set (op.mjs dsp prints them). OP_TESTSIG 1, for measurement builds only (0 in every
release), replaces the input with plucked sawtooth notes and fifths at about -12 dBFS, so that the effects that work
only while something sounds (envelopes, pitch tracking, the synth's keys, tails) are measured as with a player. The DSP
path is unchanged.
…nk, SBC), make bt

The pedal shows up on a phone as "OpenPocket", pairs with no PIN (Secure Simple Pairing, Just Works) and plays the phone's music
into its output, mixed with the guitar, as the stock BlackBox firmware does. A test image of its own (make bt, OP_BT=1): the
release image and the BLE MIDI image build as before.

- The Bluetooth stack is the stock firmware's: JieLi's classic controller and host from the AC79 SDK (Apache-2.0 bitcode, the
  archives third_party/jieli-ble pins; the 34 classic members in third_party/jieli-bt, firmware/bt/members.txt). Its SDP record
  is the library's own, byte for byte the stock firmware's (JL_A2DP).
- It is the BLE test image with the classic stack in place of the LE one (OP_BLE_TEST + OP_BT_AUDIO): the same scheduler, radio
  start-up, stall watch, boot report and DIAG. firmware/bt/: the app (bt_a2dp.c), the system calls the stack needs
  (bt_glue.c, bt_lbuf.h), its configuration (bt_cfg.c, the SDK's values), stand-ins for what is left out (bt_stubs.c, typed
  from the library's declarations), the classic IRQs counted (bt_isr.S), the memory map (app-bt.ld).
- SBC: Android's decoder (third_party/sbc-android, Apache-2.0) behind firmware/bt/bt_sbc.c; summed to mono.
- The music path (firmware/px_bt_ring.h): the main loop decodes into a 58 ms ring; dsp_out reads it at a rate steered from the
  whole backlog (150 ms, mostly still encoded in the radio's receive pool), so the pedal follows the phone's clock; it is
  added after the volume, before the soft knee, at -6 dB.
- Memory: the flash window up to the package's app slot (0x9D740, this image only), the baseband's table and a 12 KB receive
  pool in the SRAM below the RAM, the ring above it (0x01C06000), four 2.75 KB task stacks in NOINIT.
- Host tests: tests/test_bt_ring.c (60 s, a jittered phone at 44.1 kHz, the pedal at 44,117.6 Hz: no underrun, 52 dB on a
  sine, 0.7 cents of wander, a pause handled), test_bt_sbc.c (Android's encoder -> A2DP packets -> the decoder: 64 dB),
  test_bt_lbuf.c, test_bt_sources.mjs. CI builds the image (artifact openpocket-bt-audio). Not run on a pedal yet:
  docs/BT-AUDIO-TEST.md says how to test and what to report.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…i3): the link line's rate and the stream's base rate in 32 bits

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…64-bit division, double multiply and conversions)

The toolchain has no runtime library. JieLi's link manager (lmp.c) scales a 16-bit value by a double and the pairing crypto
(bigint.c) divides 64-bit numbers: firmware/bt/bt_rt.c gives __udivdi3, __umoddi3, __divdi3, __moddi3, __floatunsidf,
__floatsidf, __fixunsdfsi, __fixdfsi and __muldf3 from integer operations only. tests/test_bt_rt.c: bit for bit against the
PC's arithmetic over a million random cases each, rounding and special values included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mpiler calls them (32-bit halves only)

__ashldi3, __lshrdi3, __ashrdi3: tests/test_bt_rt.c checks them against the PC's shifts (a million random cases).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ndefined, its call would go to address 0)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ide the ring (2.4 KB out of the 96 KB RAM)

The RAM is the image's tightest region (the BLE image leaves 7.7 KB); .bss_lo2 now holds the ring (5,120 B), the decoder's state
(1,888 B) and the mix buffer (512 B) of its 7,680. All three are set up by the code that uses them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
steponme82 and others added 7 commits November 12, 2026 22:48
…wer phone link, the footswitch at 28.75 ms

Test build 35 on the pedal: the editor, the Chocolate and the music worked together, but the LE links kept ending by
supervision timeout and coming back by themselves: both at once after 25 s side by side the first time, then in about 30
minutes the Chocolate 7 links and the phone about 10, with no save and nothing pressed; the music's link never dropped (UND 0,
DISC 0). An iPhone ran its link at 7.5 ms (four events in each of the Chocolate's 30 ms), with a supervision timeout of about
1 s, the Chocolate's 2 s. This commit is test build 36:

- LE_CEN_TIMEOUT 600: the footswitch's supervision timeout 6 s (2 s).
- LE_CEN_INTERVAL 23: 28.75 ms (30 ms), not a multiple of a phone's 7.5, 15 or 30 ms, so the two links' events slide past
  each other instead of overlapping for tens of seconds; the refusal of a faster request follows it.
- A phone's link (the pedal its peripheral) is asked, 3 s after it is made, for 15 to 30 ms and a 6 s supervision timeout
  when it is faster or less tolerant (gap_request_connection_parameter_update, within Apple's limits); PQ n/rc in the LE line,
  the phone's own update then as U.
- BT_TEST_BUILD 36, the KEYS text, docs/BT-AUDIO-TEST.md's section.

Not in it: the Bluetooth session's timer change (a921b80, the library's usr timeouts run from the 10 kHz tick). Two of those
callbacks take the LE baseband's lock (multilink_schedule.c adv_keep_open: ble_hw_enable; scan_or_init_win_close:
ble_hw_disable) and the tick runs above the LE event interrupt, which holds that lock: build 28's hang again. It is being
reworked.

Checked: the image built locally, no warnings, 600,360 bytes (44,568 free); node tools/op.mjs test, all passed (with 30 ms;
28.75 ms changes one constant the host tests do not reach).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he editor 2 packets out at most

Test build 36 crashed 87 s after power-on, with the Chocolate linked, the music playing and MIDIWeb's editor reading the
pedal: CRASH PC 0200109E (P33_SYSTEM_RESET, the library's fatal stop) RETS 0204D178 (inside le_hw_send_packet) VEC 63. Its
transmit buffer (hw_alloc_tx, size + 24, an lbuf) comes from the LE baseband's transmit DMA pool, which
config_btctler_le_acl_total_nums sizes (294 bytes each: 1,505 with 5) and which also holds the advertiser's 2 x 263 (since 35
it runs beside the footswitch's link) and the initiator's; build 36 slowed the phone to 30 ms, so the editor sent 4 packets
at a time (le_tx_inflight) instead of 1.

- config_btctler_le_acl_total_nums 8 (2,387 bytes, 882 more from the Bluetooth heap: HEAP 8880 on the pedal).
- le_tx_inflight 2 at most.
- BT_TEST_BUILD 37, the KEYS text, docs/BT-AUDIO-TEST.md's section.

On the pedal: no crash with the editor used hard (W404, ED 403/3684), the music clean (UND 0, DISC 0). The LE links still
end: the Chocolate's even with no phone linked (CD08/97413: 97 s, then supervision timeout, with the 6 s timeout), and it is
heard again only seldom (NM5 in about 11 minutes). The iPhone did not change its parameters on the request (PQ1/0, no U).

Checked: the image built locally, no warnings, 600,352 bytes (44,576 free); node tools/op.mjs test, all passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s run by the 10 kHz tick (for test build 37)

The LE controller's multi-link scheduler (mult_slave_or_master_event_enter, in the LE event interrupt) arms and deletes usr
and sys timeouts there for its advertising and connection-update windows. ble_os.c's timers were main-loop code: a slot
claimed with the interrupts on, ble_ms() read inside the interrupt, and the usr timeouts run from ble_poll a main-loop pass
late, tens of ms for 6 ms windows.

- timer_add, timer_del, sys_timer_re_run, sys_timer_modify and the usr table's add and delete claim their slot with the
  interrupts off, then put them back as they were (cpu_irq_disabled() before, sti only if they were on): never a bare
  enable, whatever an interrupt's entry left.
- No ble_ms() in an interrupt: a timer added or restarted there starts counting at the next ble_poll.
- The usr timeouts have their own table (16 slots, ids from 0x101), run every millisecond by the 10 kHz tick (bt_a2dp.c
  bt_stall_tick -> ble_usr_tick), never before their delay. Each callback runs with the interrupts as the tick found them,
  and the tick leaves them so. BT_USR_IN_TICK 0 runs them from ble_poll instead, as up to test build 36.
- The baseband's lock (bb_hdl + 33): every holder (RF_ble.c ble_event_irq_handler and ble_rx_irq_handler, from their first
  line to their last, and ble_hw_disable) takes it after a counted local_irq_disable, so the tick, which runs only with
  the interrupts on, cannot find it taken. scan_or_init_win_close (ble_hw_disable) and adv_keep_open (ble_hw_enable:
  register writes, no lock) run whole under their own local_irq_disable. Still, while that byte is set a due usr callback
  waits for the next millisecond rather than spin on it above its holder.
- sys_timeout_del given a usr id deletes it from the usr table (adv_keep_open deletes mult_adv_event_end's that way).
- The log's HCI line (line 5, bt_a2dp.c bt_timers_text, where the messages make room): TS and TU each table's slots in use
  / the most ever, TF the adds refused (a full table: that callback never comes), TI the adds from an interrupt, TR the
  usr timeouts run, TB the waits on the baseband's lock (0 expected).

The BLE image's timers are as they were: its IR and the release image's are identical to 014eb4a's.

Checked on a computer: test_ble_taskq built three times (the BLE image's; the Bluetooth image's, 31 timer checks; the
Bluetooth image's with BT_USR_IN_TICK 0, 32, added to run_tests.sh), its shim's cli and sti now keeping the enable bit that
cpu_irq_disabled() reads. The checks: adds and restarts from an interrupt; the interrupts left as found in an interrupt
entered with them off, inside a counted section and in the main loop; the tick's callbacks run with the interrupts as
found; a taken baseband lock waited out; the usr table's timing; deletes across the tables; full tables. Each of ten
mutations of the new code fails at least one. Also test_bt_le_links, test_bt_le_central, test_bt_ps, test_bt_rt,
ble_status, ble_vm, test_log.mjs; the Bluetooth image compiled with Apple clang (thumbv7em) in both settings, its
unresolved symbols the same 123. Not checked: the JieLi build and the pedal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he Chocolate's link holds)

Test build 37 held the music and the editor without a crash, but the Chocolate's link ended by supervision timeout about every
1.5 minutes, even with no phone linked and a 6 s timeout. The commit before this one (the Bluetooth session's ff8c60a,
cherry-picked as 7819e5a) makes the library's timers safe in interrupts and runs its usr timeouts, the multi-link scheduler's
advertising and connection-update windows (multilink_schedule.c), every millisecond from the 10 kHz tick instead of from
ble_poll, a main-loop pass late; a due one waits a millisecond if the baseband's lock is taken (TB). This commit makes it test
build 38: BT_TEST_BUILD 38, the KEYS text, docs/BT-AUDIO-TEST.md's section.

On the pedal, power-on, the Chocolate, then about 10 minutes of A2DP music: one link (K1), no drop, 20 presses (MIDI 20),
advertising beside it (HW 1:2/0), the music clean (UND 0, GAP 43/0); TS 2/3 TU 1/1 TF 0 TI 2333 TR 1166 TB 0. Still to try:
a longer run, and MIDIWeb's editor beside the Chocolate.

Checked: the image built locally, no warnings, 601,744 bytes (43,184 free); a flash erase or write runs with the interrupts
off (fm1_flash.h irq_save), so a timeout's flash code never runs in the tick then; node tools/op.mjs test, all passed (the
taskq tests with the tick and with BT_USR_IN_TICK 0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t-opened picker (MIDIWeb on an iPhone)

An iPhone reaches the pedal over Bluetooth MIDI only through an in-app Web MIDI browser such as MIDIWeb, and there the
editor could not add a capture at all: TONE3000's pop-up never opened (window.open returns null), and "Add .nam files"
opened no picker (a script's .click() on a hidden file input, with an accept filter iOS greys .nam out of).

TONE3000 in the same tab, when window.open returns null (the pop-up stays the default where it opens):
- the editor says so and asks first; pxt3k.js t3kSelectHere keeps the PKCE verifier, the state, the key and the address
  to come back to in this tab's sessionStorage, and goes to the same Select page (prompt=select_tone, the same
  redirect_uri, t3k.html, so the same TONE3000 registration serves both ways);
- t3k.html, opened by no window, checks the state (once, 30 min at most), signs in with that verifier, reads the tone and
  its A2 captures (the one there is, or the ones chosen there: Get, Get all), downloads them and makes them what the pedal
  stores (pxnam.js namEntry, shared with the Models section), then goes back to the editor, which puts them in the library
  before the pedal is connected and says so; the user connects and sends them from the library;
- the access token stays in t3k.html's memory and ends with it; nothing of the sign-in is left in storage.

The TONE3000 key by site (pxt3k.js T3K_SITE_KEYS, t3kClientFor): https://steponme82.github.io, where the fork publishes
the editor, uses its own app's publishable key (redirect URI https://steponme82.github.io/openpocket/t3k.html); every other
address, isod89's site included, keeps T3K_CLIENT_ID. Publishable keys only: PKCE, no secret.

Real file controls: Add .nam files, Add .wav files, an empty slot's button, "Replace with a file…" (a menu item) and the
presets' Import are labels of file inputs that are never redrawn (a picker open while the card is drawn again keeps its
input), visually hidden but not display:none, with no accept filter. A tap on a label is a tap on the input; Enter or
Space open it from the keyboard. Each file is checked after the pick: by its name (.nam or .json for captures, .wav for
IRs, .json for presets), then by its content as before.

Tests:
- test_editor_logic.mjs (no browser): the key by site and the redirect; t3kSelectHere's Select address (this site's key,
  the S256 of the verifier it keeps); t3kHere's checks (a matching answer, the request used once, a wrong state, an old
  request, a cancel, no tone, an error, the way back only to this site, a damaged request) and the note read once. Eight
  mutations of that logic each fail it. Passes, as test_editor.mjs does.
- test_editor_page.mjs: the labels and the inputs (no accept, not display:none), a .txt picked among .nam files refused
  by its name, the keyboard path, "Replace with a file…" from the menu, and the whole no-window path at phone width
  (window.open null: the dialog, TONE3000 simulated in the same tab, t3k.html's state check, the token exchange with the
  kept verifier and key, the choice of two captures, the return, the library, an empty sessionStorage, the pedal connected
  again and the capture sent). Not run yet: Playwright is not installed here (the container has none either).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and how)

MIDIWeb on an iPhone opened no picker for the editor's "Add .nam files", neither the old way (a script's click on a hidden
input) nor f25a720's (the input's label). docs/filetest.html offers three ways, a plain file field, a label and a script's
click, and shows which one brings a file back: whether the browser can pick files at all.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e site branch)

docs/filetest.html answered its question: MIDIWeb on an iPhone opens no file picker in any of its three ways. It stays on
the fork's site branch, not in what is proposed upstream.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@VinSpee

VinSpee commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

5: To fit the Bluetooth stack, the image keeps 4 factory NAM models (TWIN, AC15, JCM900, MARK IV) and the delay goes up to 780 ms. Two cores.

this says what it keeps, but what did it lose? and 780ms of what delay?

steponme82 and others added 3 commits November 15, 2026 10:21
…SWITCH, CC 118/119; the preset level in the editor

- The editor: the preset's level (the GT page's PRESET LVL, -15..+15 dB) under the preset's name, the same setting as the
  gate block's third, on desktop and phone layouts.
- Controls learned on the pedal (PX_OWN_FX): a controller's own CC number read as one of the pedal's before anything else
  (px_midi.h mid_map, px_midi_map_in), up to 8, modes press / each / value; kept in each copy of the preset store after
  sector 1's slots with their own mark and CRC (px_store.h), so other firmware never reads them and a power cut keeps the
  old table or the new one.
- Editor protocol 5: WATCH bit 1 pushes MIDI_IN (what a controller sent the pedal, its own number), MAP reads and writes
  the table and SWITCH. The editor's MIDI section learns a footswitch linked to the pedal (press vs each told apart from the
  release), lists the pedal's entries, and sets SWITCH.
- The MIDI page's SWITCH row: MOMENT (CC 8..19 flip on 0, as before) or LATCH (every message flips, for a switch that
  alternates 127 and 0), and the learned controls counted on its USB line. CC 118 / 119: the next / previous preset.
- The release image is untouched: every change is behind PX_OWN_FX.
- Tests: midiio (FX) for the table, LATCH and the steps; test_store (FX) for persistence, a bad CRC, a copy without the
  table, power cuts; uisim (FX) the MIDI page; test_editor (EDSIM_FX) MAP, MIDI_IN and a learned control over USB and BLE;
  test_editor_logic for the editor's helpers. tests/edsim.c "#cc N V" and tools/sim.mjs --fx with POST /api/cc/N/V.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the chain (-10..+10 dB)

As the official firmware's Input Gain: a digital gain at the input (px_audio.h a_in_k), set on the page FX opens (now titled
SETTINGS in this image, a row after SWITCH) and from the editor's MIDI section (editor protocol 5's MAP carries it), heard at
once, kept in the preset store's header (pad[2], a signed byte: 0 dB in every earlier save; clamped). The diagnostics page's
input meters still show the converter's level before it. Behind PX_OWN_FX: the release image is unchanged.

Tests: uisim (FX) the row, its steps and limits; test_store (FX) INPUT through a power cycle, a preset save and an out of
range byte; test_editor (EDSIM_FX) INPUT through MAP and a power cycle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…NAM names; the release image is v42's again

Build 39 was never released: its two commits and this one are test build 40 (BT_TEST_BUILD 40).

- TAILS (SETTINGS page, the editor's MIDI section, pad[2] bit 7): a DELAY or REVERB that goes off, by a switch or because
  the next preset has it off, stops taking the guitar and rings out with the type and settings it had, inline and in its
  wet lane, until it is quiet (15 s at most, then a 0.25 s fade). px_engine_tails / px_engine_ringing, engine/px_dsp.c
  px_tl; tests/engine/tails.c.
- BT POWER (HIGH, MID, LOW; pad[2] bits 5-6): the radio's highest transmit levels (bt/bt_a2dp.c BT_PWR), applied at once,
  for a pedal whose guitar ticks while the radio works.
- SETTINGS rows sized for seven, the editor's card for INPUT, TAILS and BT POWER (editor protocol 5 MAP, its reply too).
- TREBLE BOOST, a 5th DRV model (PX_OWN_FX only): a germanium treble booster of the Rangemaster kind, made by hand: the input
  capacitor's high-pass picked by RANGE (FULL 90 Hz, MID 450 Hz, TREBLE 1.6 kHz), a broad 2.6 kHz peak, lopsided soft
  clipping (BOOST 12..36 dB into it), a 6.5 kHz top. Its level at noon is the dry guitar's loudness at every RANGE (BS.1770
  over assets/loops, in front of TWIN + 1x12, as tools/calib_levels.py: TB_DB). tests/engine/treble.c; ownfx_equiv and
  equiv leave it out as the other own models. INFO reports "v42 FX2", so an editor that kept build 38's catalogue reads it
  again.
- NAM captures renamed on the pedal (NAM_RENAME 31, px_models.h nm_rename), and TONE3000 captures named from the tone's
  title (docs/pxlib.js smartName: "VOX AC30 VX" instead of "VX").
- The release image is v42's again, byte for byte (openpocket.bin d96b2adf, BlackBox_942.fwsc 998146cd): build 28's
  fallback for left-out factory models (pxn_fact, pxn_row) is compiled only when PXN_KEEP leaves some out.
- docs: BT-AUDIO-TEST.md (build 40's notes and checks, what the image leaves out: USB audio, 8 of 12 factory NAM models,
  delays over 780 ms), OWN-FX.md (TREBLE BOOST), MIDI.md, EDITOR-PROTOCOL.md, NAM.md; a local path out of the build 39
  notes. tools/sim wasm rebuilt (sources hash).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@steponme82

Copy link
Copy Markdown
Contributor Author

@VinSpee

Fair point, that line only said what stays. Compared to the release image the Bluetooth one leaves out:
1: USB audio, the pedal as a USB sound card. The Bluetooth stack takes the RAM it needs.
2: 8 of the 12 factory NAM models. It keeps TWIN, AC15, JCM900 and MARK IV, and a preset with another one plays one of these. The 16 slots for your own captures are all there.
3: Delay time. Every delay type stops at 780 ms (REVERSE at 390 ms) instead of 2 s (1 s): the delay buffer was cut to make room for BLE MIDI.

Everything else is the same engine: the models both images have give the same output bit for bit (tests/ownfx_equiv.sh). I put this in the description too.

@VinSpee

VinSpee commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

I actually don't think Bluetooth audio is worth those losses.

steponme82 and others added 14 commits November 15, 2026 15:28
…al its USB MIDI host

The pedal's USB-C port can be the USB MIDI host of the M-VAVE Chocolate (felucca-bsp's opt-in host,
firmware/bsp/chip/usb_host.c, never used by OpenPocket before), so the footswitch works by cable. Its
Program and Control Changes go into the ring USB MIDI fills and are read as a computer's: presets,
blocks, CC 116 / 117 / 118 / 119 and the controls learned on the pedal.

- SETTINGS (hold FX), last row USB PORT: COMPUTER / FOOTSW. Applied at once, never saved: every
  power-on is the normal USB device (installer, editor over USB, rescue untouched). Back: the same
  row, or power off and on. Not saved because the host code has never run on this hardware.
- The screen says what the host sees: SETTINGS' USB line (FOOTSW: STARTING, NOTHING ATTACHED,
  NO MIDI INTERFACE, LOW SPEED DEVICE, CONNECTED, LOST); PLAY's and a block page's footer notes
  (CONNECTED 3 s, NO MIDI / LOW SPEED 3 s, LOST until the footswitch is back).
- While the cable's footswitch is connected, Bluetooth's musical messages are not read (the pedal is
  also its BLE central: each press would act twice); lost, Bluetooth is read again. Nothing is sent
  to the footswitch.
- The host's clock: usb.c's fm1_ms was never advanced in OpenPocket and ms_now() wraps every 178.9 s,
  which would have stopped the host looking for a device for good. The USB interrupt now adds
  TIMER4's ticks to fm1_ms (px_usbhost.h pxu_ms_add); usb_host_task runs on it. Side effect in this
  image: USB MIDI clock and CC 116 taps from a computer now carry their time (always 0 before).
- The host's blocking waits on the main loop serve the radio (usb_host.c UH_IDLE, default unchanged).
- Power: the pedal does not drive VBUS. docs/BT-AUDIO-TEST.md says what goes between: a USB-C OTG
  adapter with a charging input (or a USB-C hub with a PD input), a charger or power bank in it.

Tests: tests/test_usb_host.c (the descriptor parser on the Chocolate's layout, HID at interface 0,
MIDI streaming at 2; the packets passed; the screen's state; the clock across TIMER4's wrap),
tests/uisim.c (the row, the lines, the notes), tests/midiio.c (read as a computer's, nothing sent,
Bluetooth not read twice). The release image is v42's byte for byte (firmware/openpocket.bin
d96b2adf7b1a25ba51e3a957939a4fc8c856e700747125df97917d7ddc78c56b).

Image (node tools/op.mjs bt): 610,752 B of 644,928 (34,176 free; the host about +4.6 KB); main RAM
22,176 free (the host 453 B); hi RAM 1,484 free (no RAM code added); NOINIT 120 free.
  58e632758c42dd9aec93a6420925d6d4680648b437eadd74ad39aa023c339886  firmware/openpocket-bt.bin
  037a2b6b54cb962dce272d2bb8e89f18d38914b619e513b82e906e806832675d  build/bt/BlackBox_942.fwsc
  74c3cac6d072232058d6c9fff00f54dd89880f5974b430138ddfe74125a4a338  build/bt/PocketX_942.fwsc

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ain, the stereo output

- LOW OCTAVE's octave leaves the chain at the PIT block and joins at its end (engine/px_dsp.c px_lo_*): no amp, cabinet, EQ,
  MOD, DELAY or REVERB touches it, its 41 Hz comes out whole; it follows the preset's LEVEL, MASTER, the tuner, the volume
  pedal and PIT's on/off fade. With the AMP on it gets +12 dB (PX_LO_OUTG), about what the amps add to the guitar on the DI
  loops (the eight fitted amps +12 to +17 dB, the NAM factory models +9 to +13 dB). With a NAM amp on two cores the octave
  waits in a queue between PRE and POST, a block apart: the same output bit for bit as one core.
- SETTINGS' OUTPUT row (and the editor's MIDI section, MAP flags bits 3-4, the store header's USB byte bits 2-3): MONO (the
  default, as every earlier image), STEREO, GTR+BASS (the guitar on the left, the octave alone on the right). The output
  stage now makes two channels (px_audio.h a_outr, a_resr: the same mutes, fades, volume and knee as the left).
- STEREO: the mono sound in the middle, and a side signal, + left and - right, so the two summed are exactly the MONO
  sound: DELAY's and REVERB's wet, TAILS included, a few ms late (px_side); seven MOD models (CE CHORUS's second voice at
  the LFO's other half, DIMENSION's two voices apart, FLANGER's other sweep, PHASE 90 and SMALL STONE and UNI-VIBE with a
  second chain, ROTARY's horn and drum from both sides); the tremolos and VIBRATO stay in the middle.
- The phone's music in true stereo in STEREO: the decoder keeps the side, (L - R) / 2 (bt_sbc_frame2), in a second ring at
  half the rate (px_bt_ring.h bt_ring_mix2, 2.5 KB in the RAM): one channel alone stays in its channel 47 dB at 1 kHz,
  19 dB at 5 kHz. MONO and GTR+BASS: the mono mix as before, bit for bit.
- Room for it: the editor's reply buffer back to the RAM (2.7 KB), and the oversampling's and lanes-off buffers (3.3 KB)
  from the RAM code window to the pool's free end (PX_LOB). Image 616,088 B (28.8 KB of flash free); free: the RAM code
  window 2,688 B, the pool 4,948 B, the RAM 5,216 B.
- Tests: tests/engine/bassout.c (22 checks), tests/uisim.c (the OUTPUT row), tests/test_store.c (OUTPUT kept),
  tests/test_editor.mjs (MAP), tests/test_bt_ring.c and tests/test_bt_sbc.c (the music's side). The release image is
  v42's byte for byte (firmware/openpocket.bin d96b2adf).
- docs: BT-AUDIO-TEST.md (test build 42), OWN-FX.md (the bass, the output's three ways), MIDI.md, EDITOR-PROTOCOL.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… back into the chain

USB audio, the release's (v42: a class-compliant sound card, 16 bit, 44.1 kHz both ways), now in the Bluetooth audio
image too (px_midi.h: OP_UAUDIO 0 only for the BLE image). Both rings in the engine pool's free end, the playback ring
512 frames (px_uaconf.h, usb.c FELUCCA_UAC_OUT_RING_ATTR, empty by default).

Three more settings, after USB AUDIO on SETTINGS (now 13 rows: the page shows 8 and scrolls) and in the editor's MIDI
section, one byte (px_midi.h px_ua_route) kept in the store's map record and sent after MAP's entries:
- USB SEND: OUTPUT (as v42; both channels when OUTPUT splits them), DI (the guitar as it enters the chain), DI + OUT;
- USB RETURN: OUTPUT (as v42), INPUT, or right before any block, wherever the preset's order puts it: the knob walks the
  preset's chain;
- GUITAR: MIX, or CUT from the return's place while the computer plays into the pedal.

The engine takes the computer's sound per call (px_engine_ret, PRE and POST each their own) and mixes it at its place
(px_rt_mix, RAM code), the guitar faded over 256 samples with LOW OCTAVE's octave and STEREO's side. CPU0 reads it in
a_block, as the music (px_uaudio.h px_ua_chain, px_ua_take: uac_play's priming and steering, mono at the input's scale).
With nothing given and the guitar kept the chain is build 42's bit for bit; the release image is v42's byte for byte.

Tests: tests/engine/usbret.c (new), test_usb_audio.c built as this image (send, the return over 10 minutes at +-300 ppm,
the cut), uisim (the rows, the scroll), test_store (the byte), test_editor (MAP's byte).
Image 622,312 B, RAM code window 1,752 B free, pool 852 B, main RAM 4,128 B.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r, MONO SYNTH's tracker, SITAR and STRINGS rebuilt, TAPE FLUTE

A player's verdict on models this image shared with the release, put right here (the release's engine is unchanged, bit for
bit; tests/ownfx_equiv.sh leaves these out by name):

- SHIMMER: its octave in tune. The plain shifter crossfaded taps out of phase, so the octave landed on a comb 86 Hz apart
  (E +41 cents, G -51 on held notes); its taps now come in in phase (ox_voice, ox_align: SOLA comparing 5.8 ms, reaching a
  period of 69 Hz), within 6 cents from 73 Hz to 988 Hz.
- BARITONE: 8 to 11 ms after the pick on average instead of 23 (window 448 instead of 1400, the first offset in phase).
- MONO SYNTH: YIN instead of zero crossings after a fixed 110 Hz low-pass (lost above 600 Hz) and no more wrong note at a
  phrase's start: in tune after 16.5 ms on average on twenty notes (84 before), no octave error.
- SITAR, rebuilt as an Indian sitar: the jawari as the note reading itself late in step with its wave, deepest while loud;
  six tarab strings an octave above KEY on its pentatonic, tuned between samples; the nasal formant and the bridge's sizzle.
- STRINGS, rebuilt as an orchestral section: the bow (the level held, swells, a turn at each pick), the rosin, the violins'
  body, four players with their own vibrato; OCTAVE: cellos, then violins.
- TAPE FLUTE, new (13th SYN type): a Mellotron-like flute on MONO's tracker; INFO reads v42 FX3 (the editor reloads).

Their levels at noon as TWIN + 1x12's (BS.1770 over the loops, px_trim.h). STRINGS' and TAPE FLUTE's samples, the tracker
and the search in the flash, ox_voice in the RAM code window (it was 1,080 bytes over with them inline).
Tests: tests/engine/synfix.c (new), ownfx_equiv (5,420 runs identical).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, scenes, GUITAR TONE, PLAY's views

A player's rounds on the Bluetooth image (the release's image is v42's byte for byte: openpocket.bin d96b2adf...; the engine's
release sound bit for bit, tests/ownfx_equiv.sh, 5,400 runs, leaving out by name what these change on purpose):

- 45: MONO SYNTH through hum and noise (YIN's relative threshold, a note let go after 8 unvoiced estimates), TAPE FLUTE on the
  nearest semitone, WHAMMY's four intervals swept from the note at the heel (PEDAL, a fourth knob), SFX's WAH on the
  expression pedal (CC 117).
- 46: controls learned live on the pedal, each a preset's own (hold FX on ON or a setting, then a controller's switch or
  pedal): px_midi.h mid_pl, record "OPPL"; copied with a save into another slot; a learned row says its number; the preset's
  MIDI table (hold FX on MODEL); IN-Z and PICKUP (a pickup's load as a filter on the input).
- 47: IN-Z named by its sound (GUITAR TONE: BRIGHT, NATURAL .. MUDDY), its value drawn as the knob turns; SETTINGS walked with
  the footswitches; a learned pedal's heel and toe; PLAY VIEW SWITCHES (the blocks the controllers' switches drive, big);
  12-STRING's DETUNE 0 to 3 cents without the swept unison copy.
- 48: the guided learn, a page of its own (PEDAL or SWITCH, the controller, the value at the heel and the toe with the pedal
  there: its own travel kept, record "OPP3"); PUSH confirms, HOME cancels, nothing else acts (47 took any other button as the
  whole range, still saying LEARNED); PRESET LVL down to -INF (1 to 19 fade 2 dB a step).
- 49: scenes, Helix's snapshots for the blocks' on and off: four a preset (px_midi.h px_sc, record "OPSC"), CC 65 to 68 or a
  learned switch, kept while playing, written by SAVE, opened in the scene saved; CAB held turns PLAY's view round (CHAIN,
  SWITCHES, SCENES); SETTINGS' SCENE+SWITCH and SCENE FOOTSW. The screen's fonts without lowercase in this image
  (tools/mkfont_caps.py, firmware/fonts_caps.h): 11 KB of flash.

INFO reads v42 FX6. Tests: tests/engine/synfix.c (7 to 9), tests/engine/exp.c (WHAMMY, WAH, PRESET LVL), tests/uisim.c (the
learn, its page, the table, PLAY's views, scenes), tests/midiio.c (live learn, ranges, the pedal's travel, scenes' CCs),
tests/test_store.c (the records, 47's read, GUITAR TONE's filter against the circuit).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es, GUITAR TONE and PLAY VIEW (editor protocol 6)

The Bluetooth audio image's test builds 46 to 49 added what the editor could neither see nor set: the controls learned on a
block page for one preset (with the setting at the heel and at the toe), the four scenes, and five SETTINGS rows.

Editor protocol 6 (firmware/px_editor.h, PX_OWN_FX only: the release image is byte-identical, openpocket.bin d96b2adf,
BlackBox_942.fwsc 998146cd):
- MAP (30): two settings bytes after the routing, both ways: GUITAR TONE and PICKUP (px_inz_pack), then PLAY VIEW,
  SCENE+SWITCH and SCENE FOOTSW. A write without them leaves them as they are; a value no build writes is refused.
  GUITAR TONE is heard at once (a_inz_apply); st_commit keeps all five.
- PL (32): a preset's own controls (px_midi.h mid_pl): read a preset's; learn one, in place of the preset's entry for the
  same control or the same row (px_midi_pl_put; a block's ON answers to its flip and its on/off number), with the setting
  at the heel and at the toe and where the pedal was at each; forget one. Each writes the flash, as a save. One entry a
  request: a request over Bluetooth MIDI is 160 bytes at most.
- SCENE (33): the playing preset's scenes (px_sc), as they play and as saved: recall one (ui_scene_recall, as CC 65 + n),
  set a scene's blocks (the scene playing switches them), forget one. SAVE keeps them (build 49's ED_SAVE).
- STATE's flag is the pedal's EDITED (ui_dirty: a recall is no change, a scene set is one), and a scene recalled on the
  pedal pushes STATE.

The editor (docs/):
- MIDI: the five settings rows. "Learned by the pedal, only in NN NAME": the preset's own controls, how a switch acts, a
  pedal's setting at the heel and at the toe in the setting's own words, forget. "A control I teach works only in NN" now
  also puts a control heard through the pedal into that preset's own table. Scene 1 to 4 can be learned, on the pedal and
  through the page.
- Sound: the scenes under the chain, each recalled with a tap, with the blocks it turns on; "Edit scenes": a grid where
  the scene playing's column is the blocks themselves and another scene's is set there, and a scene can be forgotten.
- docs/EDITOR-PROTOCOL.md: protocol 6.

Tests:
- test_editor.mjs, section 8 (the Bluetooth audio image's simulator, a store of its own, then a power cycle): MAP's
  settings bytes (the defaults, set, left as they are, refused); PL (a pedal heard between its heel's and toe's values, a
  switch, a scene, one control a row and one row a control, refused entries, forgetting, the 64 places); SCENE (set,
  recalled with SCENE WINS, recalled by CC 65 and by a preset's own control, the push, SAVE making a recall no change, set
  and forgotten, a fifth refused); SAVE into another slot taking both along; all of it after the power cycle.
- test_editor_logic.mjs: scenes as targets, a preset's own entry.

Checked on a computer: test_editor.mjs (plain, BLE, Bluetooth audio image over BLE: 121 checks), test_editor_logic.mjs,
`op.mjs package` (the release image unchanged), `op.mjs bt` (the image 634,816 B: 10,112 B of flash free, 660 B more than build 49's; main RAM 1,280 B free, 128 B more,
ed_dirty's own copy of the preset gone), `op.mjs test` (exit 0; its page tests skipped: no Playwright there either). Not checked: the page tests
(Playwright is not installed here), the pedal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…DIO-TEST.md, the published image's figures

MIDI.md said the web editor does not show each preset's own learned controls: with editor protocol 6 it lists them (their heel
and toe editable), learns one for this preset only, shows the scenes in its Sound view and holds the new settings rows.
BT-AUDIO-TEST.md, "Test build 49": the editor's part, and the image with it (634,816 bytes, 10,112 free; RAM 1,280 free).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…very preset

The player's choice after the costs: free text, typed in the web editor, shown on the pedal. Every preset's four names of 8
letters (1.7 KB) do not fit the store's 744 bytes left nor its RAM; 3 letters for all 52 presets do (624 bytes):

- px_midi.h px_scn (the playing preset's, as it plays) and px_scn_saved (as its slot has them): 24 bytes of RAM, loaded with
  the preset (PX_SC_LOAD now also px_scn_load); px_scene_label gives a name, else SCENE 2 (SC 2 where narrow).
- px_store.h: two records after the scenes, "OPN1" (presets 1 to 26) and "OPN2" (27 to 52), 320 bytes each so that each fits
  the shared buffer: st_save puts the playing preset's names, st_reset drops a slot's, every other commit carries them over
  from the copy in use; a record whose CRC fails is none in its half; what is no letter reads as 0.
- ui.h: the names on SCENES' and SWITCHES' tiles and PLAY's top; a name changed makes the preset EDITED.

The web editor sets them (its own commit). The release image is v42's byte for byte. Tests: tests/uisim.c (the names on
screen, EDITED, SAVE), tests/test_store.c (both records, a reset, a CRC failure, a copy without them).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the editor

Test build 50 gives each scene of every preset a name of up to 3 characters (px_midi.h px_scn, px_scn_saved), which the pedal
shows in place of SCENE n and which only the editor types.

Editor protocol 6's SCENE (33), PX_OWN_FX only (the release image is byte-identical, openpocket.bin d96b2adf,
BlackBox_942.fwsc 998146cd); no new protocol number: an editor tells a pedal with names by the reply's length.
- 4, n, c0, c1, c2: scene n's name, 0-padded: ASCII 32..126 up to its first 0, nothing after it (else rc 1). It goes into
  px_scn, the playing preset's names: no flash write, a change until SAVE (ui_dirty compares px_scn_saved), which keeps
  it (build 50's st_save).
- The reply ends with the four names as they play and the four as saved, 3 bytes each, after what build 49 sent, so build
  49's editor reads its part as before.

The editor (docs/): pxedit.js sceneName and cleanSceneName (3 characters of ASCII 32..126, in capitals as the pedal draws
them); in the Sound view's scenes, each scene's button shows its name, and "Edit scenes" has a 3-character field per
scene. docs/EDITOR-PROTOCOL.md: the request and the reply's names.

Tests: test_editor.mjs section 8: no names at first, a typed name a change until SAVE, a name of one character, a
character after a name's end or past ASCII 126 or a fifth scene refused, SAVE into another slot keeping them, the names
after a power cycle, every preset its own; test_editor_logic.mjs: cleanSceneName.

Checked on a computer: test_editor.mjs (plain, BLE, the Bluetooth audio image over BLE: 128 checks), test_editor_logic.mjs,
`op.mjs package` (the release image unchanged), `op.mjs bt` (the image 635,724 B: 9,204 B of flash free, 432 B more than build 50's; main RAM 1,248 B free and the RAM
code window 760 B, as build 50's), `op.mjs test` (exit 0; its page tests skipped: no Playwright there either). Not checked: the page
tests (Playwright is not installed here), the pedal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… on the simulated pedal

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, VOL PEDAL

The player's next round: a controller's expression pedal is the volume while an effect is off and that effect's setting while
it is on, as a multi-effect's pedal with its toe switch; whatever turns the effect on (its switch, a scene, its button)
changes the job, and a line at the screen's right edge says which. The volume's place is a setting, the input first:

- px_midi.h: PXM_PL_DUAL, bit 6 of a preset's own pedal entry's mode (the editor's protocol carries 7 bits a byte): a pedal
  on a block's setting, not the GATE's; one a preset. px_midi_map_in, given the sound playing: the block off, the pedal is CC 117 along its own travel (the volume); on,
  a WAH's or AUTO WAH's sweep and a WHAMMY's PEDAL go as CC 117 from the setting's heel and toe, any other setting as itself.
  px_midi_dual_sync tells the engine the block (PX_SC_LOAD, the learn, the screen's pass). SETTINGS' VOL PEDAL (px_vol_at,
  bit 1 of st_usb: the last spare one).
- engine/px_dsp.c: px_exp_dual (the block whose on/off picks the job: a wah or whammy as before, job 3 another setting with
  the volume at unity, the volume off; a new block forgets the position) and px_exp_place (0 right after the input, after the
  GATE when first; 1 before the first DELAY or REVERB, as before). With a NAM amp right after the GATE the volume comes at pass
  0's end, before the network.
- ui.h: the guided learn's step 5, WHEN SFX IS OFF: VOLUME or NOTHING (VOLUME to begin with on a wah's or whammy's sweep); the
  line, green the volume, red the effect, on PLAY and the block pages, drawn again after any drawing (openpocket.c lcd_gen);
  the MIDI table's +VOL; SETTINGS' VOL PEDAL row. Five learn rows of 19 px.
- px_editor.h: editor protocol 7, INFO "v42 FX7": PL's mode bit 6, MAP's last byte bit 4.

The release image is v42's byte for byte; the engine's shared sound as the release's (tests/ownfx_equiv.sh, 5,400 runs).
Tests: tests/engine/exp.c (both places through a saturated drive: AT INPUT 0.3 dB down half way, BEFORE DLY 17.8; the two
jobs), tests/engine/bassout.c (the octave in both places), tests/midiio.c (the routing), tests/uisim.c (step 5, the line on
both pages and through scenes, the table, VOL PEDAL), tests/test_store.c (the bits through a power cycle),
tests/test_editor.mjs (protocol 7: the mark's round trip).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… VOL PEDAL (editor protocol 7)

Test build 51 (4f84767) lets a controller's expression pedal, learned for one preset on a block's setting, do two jobs:
that setting while the block is on, the volume while it is off. SETTINGS' VOL PEDAL says where that volume acts.

Editor protocol 7 (the firmware's, 4f84767: PX_OWN_FX only, the release image unchanged):
- PL (32): bit 6 of an entry's mode (PXM_PL_DUAL) marks a two-job pedal; the way it counts is mode & 0x3F.
- MAP (30): bit 4 of the second settings byte is VOL PEDAL (0 AT INPUT, 1 BEFORE DLY).

The editor (docs/):
- pxmidi.js: PL_DUAL, plKind, dualOk (a pedal on a block's setting, not the GATE's), dualDefault (WAH's PEDAL, AUTO WAH's
  CENTER, WHAMMY's PEDAL, as the pedal's own learn begins on VOLUME there).
- pxedit.js: hasTwoJobs (protocol 7); MAP's more.volAt, sent only to a protocol 7 pedal (a build 50 one refuses bit 4).
- edmidi.js: in "Learned by the pedal, only in NN", a two-job pedal is marked +VOL, and a pedal on a block's setting has a
  box "or VOLUME when SFX is off" (the block's label), one a preset (the pedal takes the bit off the others); a pedal
  learned through the page on WAH's PEDAL, AUTO WAH's CENTER or WHAMMY's PEDAL begins with it ticked. The pedal's
  settings gain a "Volume pedal" row (AT INPUT, BEFORE DLY) beside the scene rows.
- EDITOR-PROTOCOL.md: version 7, MAP's bit 4, PL's bit 6. MIDI.md: the editor's part in "Two jobs for one pedal".

Tests: test_editor.mjs section 8, after test build 51's own checks: VOL PEDAL AT INPUT by default, set with the other
settings kept, kept when another setting changes, still set after the power cycle; +VOL on one pedal then on another
leaves one a preset, and taken off again; the catalogue's names behind the default. test_editor_logic.mjs: plKind,
dualOk, dualDefault, and bit 4 sent only to protocol 7.

Checked on a computer: test_editor.mjs (plain, BLE, the Bluetooth audio image over BLE: 136 checks),
test_editor_logic.mjs. No firmware/ or engine/ change, so no image built. Not checked: the page tests (Playwright is not
installed here), the pedal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he simulated pedal

docs/BT-AUDIO-TEST.md, "Test build 51": the editor's box and Volume pedal row (editor protocol 7), why the two jobs are bit 6
(the editor's protocol carries 7 bits a byte), and the simulated pedal driven with its buttons: a pedal learned on DLY's TONE
with step 5 on VOLUME, the line green with DLY off and red with it on, TONE moved only with DLY on, the pedal and its line
kept through SAVE and a restart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er, before anything is written

M-VAVE's BlackBox firmware V22 (2026-11-12) and later moved the app area from 0x4000 to 0x6000, behind a boot loader that
runs to 0x5CA0 (isd_config at 0x5CA0). The update loader writes [0x4000, 0xA3000): over such a head it overwrote the boot
loader's end and the pedal stayed dark (isod89#31, isod89#33, and the reports gathered in isod89#32).

- loader/ldr_core.c, step 1b: the pedal's own JLFS top entries (as the chip-key check reads them) must put app_dir_head at
  0x4000, with nothing before it running past 0x4000 (the official BlackBox V16, V20 and V21 heads, Pocket X 016).
  Otherwise nothing is written: the update records are erased (step 4's sweep, now shared), the host is told why (a read of
  0xF1000000 + the reason, 1 to 5) and loader.c resets, so the SPL boots the pedal's own firmware.
- docs/pxota.js: NEW_LAYOUT (an official BlackBox_022 or later) is refused before anything is sent; the loader's refusal is
  answered at once (error code "layout") instead of the write's 3-minute wait. docs/index.html: for such a pedal the Install
  button stays off, with the reason; the message after a refusal says what to do.
- tests/fixtures.py builds flash_v22.bin (the same flash, its head's entries moved as V22's); tests/test_installer.mjs: the
  page refuses BlackBox_022 (nothing sent, nothing written), the loader refuses a V22 head behind an older identity (nothing
  written in [0, 0xA3000), the update record erased, the pedal back on its own firmware, the page told in under a second).
  tests/devsim.c restarts the simulated pedal on its own firmware after a refusal. Also checked by hand: flashes built from
  the official BlackBox V16, V20 and V21 packages still install (their heads pass).
- README and docs/RESCUE.md: why, and the way back for a pedal that already went dark (M-VAVE's own flash.bin written back
  by the UBOOT rescue, whose head check passes: the route of isod89#31).

The app images are unchanged; the packages change by their update loader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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