Repository navigation
Bluetooth audio test image (A2DP sink): test build, do not merge - #10
Closed
steponme82 wants to merge 296 commits into
Closed
steponme82 wants to merge 296 commits into
steponme82 wants to merge 296 commits into
Conversation
Waits for a pedal that restarts in a loop, stops its sound processing the moment it answers the identity query, and installs the package of its model, reusing the installer page's rescue path through a new Updater.rescueWithin in docs/pxota.js. Bounded by --timeout (default 180 s); an install that has started is never cut short. Tested against a simulated pedal with a restart loop.
POST /api/down/NAME and /api/up/NAME drive a button through the 800, 700 and 350 ms of firmware/openpocket.c, so a client can press, hold and release instead of naming a gesture. The state reports held buttons and PARA's detents. A hold of HOME no longer leaves the tuner, as on the pedal. / and /plain routes are added for the pedal skin.
tools/sim/pedal.html draws the BlackBox panel in code and works as a control surface: buttons, footswitches and both knobs by mouse, touch and keyboard, with the live screen in the LCD and backlights that follow the state. tools/sim/pedal-input.js holds the input mapping, which runs in Node. The earlier page moves to /plain. The panel's TUNER line is the stock firmware's. OpenPocket opens the tuner with a long press of HOME, so two footswitches stay two presses.
Cut with prepare.py, which records the source and loop points of each. The manifest and ATTRIBUTION.md carry the licence, source and checksum.
engine/px_wasm.c mirrors dsp_block() of the firmware, so the same engine and math library run in a browser. The binary is committed, because the simulator needs only a C compiler; node tools/op.mjs wasm rebuilds it in the container. render.mjs renders the bundled loops to WAV files.
The Sound section plays a loop, a file or a computer input through the engine in an AudioWorklet. The engine follows the preset on the screen, MASTER and a new bypass, and the page reports the measured load to the status text. A device starts muted. tests/test_audio.mjs checks the engine on known signals and against the native build, and tests/test_audio_page.mjs drives the section in Chromium.
… tools/op.mjs log
…flash, read, scan, report
… arbiter), read the stored radio records
… tools/op.mjs log
…flash, read, scan, report
… host, and a toggle map for footswitches The pedal now advertises ADV_IND as OpenPocket and runs JieLi's host: a GATT server with the BLE MIDI service, Just Works pairing with bonding, and the link layer's real members in place of their stand-ins. A write to the characteristic goes through a BLE MIDI parser into the same handler as USB. CC 8 to 19 flip a block on value 0. None of this has run on a pedal yet.
…and-ins The event mask setter was a stand-in, so LE meta events never reached the host and a connected central looked like nothing. Link it, and add the link and trace lines to the log channel.
…dels from the web editor - engine/px_nam.c: NAM A2-Lite in fixed point (Q20 activations, Q24 weights, 64-bit sums), checked against tools/nam_a2.py (about 99 dB SNR on every factory model, tests/test_nam.py). On the pedal a layer is one hand-written pi32v2 routine (hardware loop, 5 instructions per 3 multiply-adds), checked against the C one at boot. - AMP type 9 "NAM" (MODEL, GAIN, BASS, MID, TREBLE): 12 factory models trained for the pedal at 44.1 kHz (tools/train_a2.py, from GPL-3.0 community captures and DI guitar), 16 user slots in flash (0xC0000, kept by updates). - Web editor: NAM models panel, A2 .nam files (TONE3000...) checked, levelled and sent (editor protocol 2: NAM_LIST, NAM_WRITE, NAM_COMMIT, NAM_ERASE). - 24 factory presets rebuilt on the NAM models, levelled to -23 LUFS; USER slots start from NAM TWIN. - Audio path in RAM (40 KB code window); NAM rings in the POOL region, 88 KB of ordinary RAM left. - Docs: NAM.md, WHATS-NEW-v37.md, EDITOR-PROTOCOL (protocol 2), README, SOUNDS-AND-CONTROLS, AUDIO-SDK, BUILDING. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LFaxqW3CpFrLCvqoteTUv9
…h, only the NAM layer routine in RAM A direct call between the flash code (0x02xxxxxx) and the RAM code (0x01C0xxxx) is out of the call instruction's +-4 MiB: putting the audio path in .ram_text gave 478 such calls (the linker named only the first). The engine and the math functions are in the flash again, as in v36 (RAM layout back to v36: 24 KB RAM code, 96 KB RAM); the NAM layer routine stays in RAM, called through a pointer, and calls nothing. tools/check_calls.py, run by firmware/build.sh before linking, refuses any such call and names it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LFaxqW3CpFrLCvqoteTUv9
…the regular Chocolate's (for test build 28) The regular M-VAVE Chocolate advertises as FootCtrl, by its quick guide (search for "FootCtrl" in the device's Bluetooth settings) and by players' reports; another of its manuals says "M-VAVE Chocolate". The filter took only names containing CHOCOLATE, so it would likely never have found it. LE_CEN_NAMES now holds both, compared without case as before; the MIDI service UUID, a connectable advertisement and the RSSI floor are still required. - tests/test_bt_le_central.c: FootCtrl in a scan response is taken; a short name cut before the whole word is not (24 checks; with FOOTCTRL dropped from the list the new check fails). - docs/BT-AUDIO-TEST.md: the two names, and how the log shows a Chocolate the filter does not take (CEN SCAN, R rising, M0). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tools/log.mjs keeps DIAG's eleventh line as the le row only when it starts with "LE " (up to build 27 there is none). Two checks: the line kept and shown as the le row; no row without it or with another line there. Each fails with its half of the code taken out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… Chocolate's BLE MIDI central, on the NAM cut The central role (ll_master.c linked from the pinned btctrler.a, roles 31, typed slots, the FootCtrl scan filter, an ATT client, DLY at power-on to turn it off) on top of 39f1d3f (4 factory NAM models, 60,980 bytes of the app slot free). An early CI check of the link and the memory: not yet test build 28, which also needs the fixes for build 27's LE link drop (reason 0x08 about 20 s in) and for the LE side staying dead after it. Checked here: test_bt_le_central, test_bt_le_links, midisim, midiio, test_log, the BT / BLE / release syntax checks, and the members' bitcode against the firmware's (no undefined symbol, nothing defined twice). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… link is up, the link layer's events in the log (for test build 28) On the pedal, test build 27's iPhone editor link ended by supervision timeout (0x08) about 20 s in, as the catalogue read ended, and the LE side then stayed silent until power-off: no LE interrupt, the controller's thread idle, advertising asked again (A2/0) but never on air. The cause is not known; this makes the pedal recover and the next log say more. - bt_le_midi.c bt_le_watch, from the main loop: while advertising, scanning or a link should be on air and neither LE interrupt has moved for 4 s (advertising alone moves them every 500 ms), ble_profile_loop turns advertising and scanning off and on again: their radio entities are closed and new ones opened and scheduled (RF_ble.c le_hw_close, le_hw_open, le_hw_advertising -> ble_slot_schedule). Asking again without the off does nothing (ll_adv_open: already open). The decision is bt_le_links.h le_watch_due, host-tested (8 checks; two mutations caught). - bt_a2dp.c: the classic scans' kick needs 30 s of IRQ 40 silence instead of 5 while an LE link is up (the radio can serve an LE link for seconds on end; build 27's drop came in a boot with two kicks, order unknown); KICK has its last time. - The LE line: U (connection updates: count, last interval/latency/timeout), PHY and DL (PHY updates, data length changes) when there are any, D with the time (D08@31500, ms since power-on as SE and RC), WD (the watchdog's restarts and the last time). Events reaching all three callbacks are counted once (le_ev_again, per host message). - Checked in the library's bitcode: a lost link's entity is freed (le_hw_close: its anchors cleared, a suspended advertiser or scanner resumed); ll_wifi_detect_ext and ll_update_ch_done_wfdet_callback are void hooks; an LE disconnection never reaches the classic handler in bt_a2dp.c (hci_vendor.c sends it to the LE handlers only); the connection update event does reach ours. ble_slot_schedule skips its pass when an interrupt comes while a task's pass holds its lock: a possible way for every LE event to stop at once, not proven. - docs/BT-AUDIO-TEST.md: "Test build 27's LE link drop", the new words. nm check: the image's unresolved set is unchanged (123). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ate's central, the LE watchdog, 4 factory NAM models BT_TEST_BUILD 28 and the log's key text, on top of 05f9f3a (the LE watchdog, the kick held back while an LE link is up, the link layer's events in the log), the merge 06c5797 (the central role for the footswitch that is only a peripheral, the regular M-VAVE Chocolate advertising as FootCtrl; DLY at power-on turns it off) and 39f1d3f (TWIN, AC15, JCM900 and MARK IV built in). Checked here: test_log, test_bt_le_central, test_bt_le_links, the BT syntax check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…8 name, PXN_FW[PXN_NROWS][PXN_NW] 39f1d3f (4 factory NAM models in the Bluetooth audio image) renamed the array's first dimension; the comparison looked for PXN_FW[PX_NAM_NFACT] and stopped run_tests.sh at its NAM step with "substring not found" wherever numpy is installed (CI skips the step without numpy). Every model is still in the header's text, each inside its #if PXN_KB(i), so the parsing after the anchor is unchanged: 12 models, all ok (SNR 83 to 87 dB here). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s and no central role, to find 28's start-up hang Test build 28 hung at start-up before Bluetooth was VISIBLE: the main loop stopped after 84 passes and the hardware watchdog reset the pedal, with no stall record, so interrupts were blocked (an interrupt handler looping, or a spin with them off). Our central code waits for INIT_OK (le_adv_ok), so the library with 28's settings is suspect, and the LE role bits are read in its interrupt path (RF_ble.c ble_event_irq_handler, __hw_rx_buf_process). 29 is 28 with config_btctler_le_roles back to 6 (LE_SLAVE | LE_ADV; the literal for tools/jlfold.py, BT_LE_ROLES for openpocket.c) and the central role off, so that its LE side is 27's. ll_master.c stays linked, and the LE watchdog, the 4 NAM models and the log words stay. If 29 starts, the roles are the cause; if it hangs too, the rest of 28 is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…st build 28 hung at its first LE scan) On the pedal, test build 28 stopped about 1.5 s after power-on (a watchdog reset, no stall record): right where Bluetooth becomes visible and, new in build 28, the pedal starts scanning for the footswitch beside advertising. The cause, read in the library's bitcode: the LE event interrupt (RF_ble.c ble_event_irq_handler) holds the baseband's spinlock (bb_hdl, a testset loop with the interrupts off) for its whole run and calls ble_slot_schedule, which for a scanning or initiating entity calls le_hw_suspend. That asks cpu_in_irq(): in an interrupt it takes ble_hw_disable_isr, otherwise ble_hw_disable, which takes the same spinlock. This image's cpu_in_irq() counted only the classic baseband's interrupts (bt/bt_irq.c, bt_isr_depth); the LE ones jump into the library's own complete entries (ble/ble_isr.S) and could not count themselves. So the LE interrupt waited for the lock it held, with the interrupts off: no tick, no stall watch, the 8 s watchdog. Up to test build 27 no entity scanned or initiated, so nothing in an LE interrupt asked. - ble/ble_os.c (Bluetooth audio image only): cpu_in_irq() is also 1 while the code runs on the system stack, where every interrupt runs and nothing else does (crt0 points ssp there; the main loop runs on _ustack, the tasks on their own stacks in NOINIT; the stall record relies on the same; fm1_guard.h fm1_sp_in_isr). Inside the LE interrupts the library now takes its interrupt paths, as with the SDK's cpu_in_irq, and the waits of ble_os.c (BLE_IN_IRQ) refuse there. The other library callers of cpu_in_irq (the classic link's, the host's) only ever choose "do not wait" with it. - tests/test_ble_taskq.c: on the system stack with no depth counted, cpu_in_irq() is 1 and os_time_dly refuses and counts; off it, 0. Both checks fail with the old cpu_in_irq. - docs/BT-AUDIO-TEST.md: "Test build 28's hang at Bluetooth's start". The BLE image keeps cpu_in_irq() 0; its IR and the release image's are unchanged (Apple clang thumbv7em, inline-asm source locations aside). The BT image's unresolved symbols are unchanged (123). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…E interrupts known as interrupts (its start-up hang) 7f07148 (from bt-ble-editor f917ff2) makes ble/ble_os.c cpu_in_irq() answer 1 on the system stack too, where every interrupt runs. Test build 28 hung at its first LE scan: RF_ble.c's LE event interrupt holds the baseband's spinlock and, for a scanning or initiating entity, ble_slot_schedule -> le_hw_suspend asked cpu_in_irq(), got 0, took ble_hw_disable instead of ble_hw_disable_isr, and spun on the lock it held, interrupts off, until the watchdog. 30 puts 28's LE roles back (31: master, slave, advertising, scanning, initiating) and with them the central role, which test build 29 had taken out to split the cause. BT_LE_ROLES 31, the literal for tools/jlfold.py beside it. Checked here: test_ble_taskq (BLE and BT), test_log, the BT / BLE / release syntax checks, jlfold's reading of bt_cfg.c (roles 31). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n the log (for test build 31) Test build 30 started but its scanner heard nothing (CEN SCAN R0; the LE interrupts were advertising's alone, 98/90 in 16 s, with a Mac and an iPhone nearby). In the library's bitcode: - Beside advertising a scanner starts suspended (RF_ble.c le_hw_scanning: more than one radio entity, run flag 1, then ble_slot_schedule). Only the slot scheduler resumes it, from the LE event interrupt, when the gap ahead is at least its interval less its window (304 slots) and register 0x28038's bit 1 is clear (the bit zeroes every gap it computes). Alone, a scanner is enabled at once (one entity: run flag 0, ble_hw_enable). - ll_scan_open allocates the scan link, then asks for a radio entity; without one it answers 58 and leaves the link in place, and every later open answers 12, "already open". Only an off clears it (ll_scan_close frees the link). Build 30's re-ask every 2 s was an enable alone. - The scan parameters are no HCI command: the host's ll_hci_scan_set_params calls ll_scan_set_params directly (0, or 12 while the scanner is open). Scan enable posts 0x200C; ll_scan_open's answer is dropped and no Command Complete follows. The host passes every advertising report on (LE meta subevent 2 -> le_handle_advertisement_report -> 0xE2), gated only on config_stack_modules' LE bit, whatever started the scan. bt/bt_le_midi.c: - LE_SCAN_ALONE (1): with no phone linked, advertising is turned off while the pedal scans, LE_ALONE_SCAN_MS (4 s), then advertising's turn, LE_ALONE_ADV_MS (2 s, CEN PAUSE), in turn, until the footswitch is linked. Its connection is made alone too; its link brings advertising back. A connection not made, the watchdog, a scan turn's end: le_cen_rest gives advertising its turn first when it was held. With a phone linked: its link and the scanner, as in build 30. - A scanner silent for 2 s is turned off and on. - The LE line, after CEN: AH (advertising held), RAW (advertising reports at the callback, before any test), SO (scanner starts asked), HW: bb_hdl's entities, read with the library's own offsets (clang on its bitcode: ids at 0, the ble_hw array at 16, 28 bytes each, the count at 32; ble4_hw state at 343, run flag at 344), IE (0x28030, the entities' interrupt enables), BB (0x28038). - docs/BT-AUDIO-TEST.md: "Test build 30's silent scanner, and test build 31's scanner alone". BT image compiles with no warning (Apple clang thumbv7em, -Wall -Wextra); its unresolved symbols are unchanged (bb_hdl is RF_ble.c's). On bt-audio 51c0490 (test build 30); BT_TEST_BUILD left at 30. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ith advertising, alone on the radio BT_TEST_BUILD 31 and the log's key text on top of 000c786 (from bt-ble-editor). Test build 30 scanned beside advertising and heard nothing (R0): RF_ble.c's slot scheduler never resumed a scanning entity beside an advertising one. With no phone linked the pedal now scans alone for 4 s and advertises alone for 2 s, in turn, until the footswitch links. A scanner silent for 2 s is turned off and on (an open that found no free entity left it "already open" for good). The log's LE line gains AH, RAW, SO, HW (the radio entities' states and run flags), IE and BB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lient, and more LE diagnostics (for test build 31) With DLY held (no central role) test build 30 lost an iPhone's LE link every 3 s or so, the phone ending it (D13, 16 links in 50 s, one MIDI write, no editor frame), where test build 27 kept the same phone connected. - att_dispatch.c gives every ATT packet with an odd opcode to the client once one is registered, and to the server only while none is. Since test build 28 the footswitch's client was registered in every boot, and it dropped such packets of other links. Now it is registered only with the central role on (with DLY the routing is test build 27's), and le_att_client hands a packet of any other link to the server's handler (att_global_info's second word, struct att_info_t), counted as AF. (A phone's requests are even opcodes and always went to the server: AF tells whether it sends odd ones at all.) - The LE line: the D word ends with the link's life in ms (D13@49866/2950); EN n/ss (an LE link's encryption changes and key refreshes, the last status: 06 the key is missing; this image keeps LE pairing keys in RAM only, so a phone that paired before a restart re-encrypts with a key the pedal no longer has); LTK n (LE meta 5, the central encrypting with a stored key); RH (LE advertising reports the controller posted to the host task, counted in bt_a2dp.c's HCI spy before the host reads them, and no longer kept in the HCI tail); HW slots' +resumes-suspensions as the main loop saw them (le_hw_sample, from bt_le_watch). - docs/BT-AUDIO-TEST.md: the words, and "forget the pedal on the phone" when EN shows 06. BT image: no warning (Apple clang thumbv7em, -Wall -Wextra); unresolved symbols unchanged (att_global_info and bb_hdl are the library's). test_bt_le_links, test_bt_le_central, test_ble_taskq (BT), test_log pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…T packets to the server and the LE encryption counters BT_TEST_BUILD 32 and the log's key text on top of 9918470 (bt-ble-editor 402af3f). Test build 30 with DLY: an iPhone linked 16 times in about 50 s and ended each link itself (0x13). The footswitch's ATT client, registered in every boot since test build 28, took every odd-opcode ATT packet from the server (att_dispatch.c). It is now registered with the central role only, and it hands the other links' packets to the server (AF). New words: EN (encryption changes and their last status, 06 a missing key), LTK (a phone encrypting with a key the pedal does not keep), D..@time/life, RH (reports reaching the host). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… in the log (for test build 33) An iPhone ended its LE link every few seconds in test builds 30 and 31 (D13, with DLY too), where test build 27 kept it. - le_att_server_spy, registered in front of the library's server handler (att_dispatch_register_server after att_server_init, which registered att_server.c's att_packet_handler; att_global_info's second word): counts the ATT requests (even opcodes) and keeps the last one's opcode and the phone's MTU; then, before calling the server, marks l2cap's outgoing buffer (0xFF, no ATT opcode) when it can reserve it (never a packet still on its way out), and after the call reads it: the server builds its answer there and sends it at once (att_handle_request), so an overwritten mark is this call's answer: counted, paired with the request (the last four pairs kept), an Error Response's request opcode, handle and code kept, Exchange MTU's server MTU kept. (l2cap_reserve/release_packet_buffer only set and clear le_hci_stack's flag.) - The LE line: "AT 14/13 E1 08:0007/0A M185/23 10>11 08>09 08>01 0A>0B" after the D, EN, LTK and AF words. With the central role off the line ends after CEN KEY and the HW word (the role's counters are all 0 then). - docs/BT-AUDIO-TEST.md: the words. BT image: no warning (Apple clang thumbv7em, -Wall -Wextra); unresolved symbols unchanged. test_bt_le_links, test_bt_le_central, test_log pass. On bt-audio c7fbd0e (test build 32); BT_TEST_BUILD left at 32. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…beside a phone, the filter's view in the log (for test build 33) Test build 32 on the pedal: the scanner, alone, heard 134 reports and took none (R134 M0), the Chocolate in CubeSuite's "Manufacturer" mode, which a Mac lists as "FootCtrl"; and an iPhone's link died by supervision timeout after 1 s (D08@49526/1044) with the scanner resumed beside it (HW 1:1/2). - bt_le_links.h le_links_want_scan: no scanning while a phone's LE link is up either (the footswitch first, then the phone); bt_le_midi.c le_cen_poll stops a scan running when one comes. - bt_le_central.h: the footswitch is the address that has shown a name containing FOOTCTRL or CHOCOLATE, advertised as connectable and is heard at LE_CEN_RSSI (-85; -80 up to 32) or more: the MIDI service UUID is no longer needed. After the connection the ATT client looks for the service as before; attc_not_midi tells a failure that means no BLE MIDI there (its service, characteristic or client configuration not found, at those steps: attc_t.fail_st) from a refusal for security, and le_cen_skip keeps that address (four at most) out of the filter for this boot (a skipped known footswitch is no longer the only one taken). - The LE line after M: NM (reports with a footswitch's name), UU (with the MIDI UUID), CN (connectable), B (the best RSSI of a name-matched address), LF flags/rssi (the last name-matched address: 1 UUID, 2 name, 4 connectable), SK (skipped). - Tests: test_bt_le_central 38 checks (+16: the name without the UUID, the -85 floor, scan-response-only names, the skip list and its ring, the log's counters, attc_not_midi with no service, no CCC and two security refusals); three mutations caught. test_bt_le_links: a phone first means no scanning. - docs/BT-AUDIO-TEST.md: the changes and the words. BT image: no warning (Apple clang thumbv7em, -Wall -Wextra); unresolved symbols unchanged. test_log passes. On 1fd74e5 (the GATT server's spy) on bt-audio c7fbd0e (test build 32); BT_TEST_BUILD left at 32. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e, no scanning beside a phone, the central role on a twelfth log line Test build 32's log: the scanner, alone, heard 134 advertising reports and took none (the regular Chocolate in CubeSuite's "Manufacturer" mode), and an iPhone's LE link died by supervision timeout after 1 s with the scanner resumed beside it. 1fd74e5 and 887ff95 (the GATT server's words; the filter by name, no scanning beside a phone's link, the filter's view) come before this commit; this one makes them test build 33: - BT_TEST_BUILD 33. - The central role's words on the DIAG's twelfth line, "CEN ..." (bt_le_cen_line), up to test build 32 the LE line's end: with the GATT server's and the filter's words the LE line passed the 223 characters a line holds, so its end, the footswitch's outcome (T K S F MIDI CL @), was cut off; with a phone's updates as well the text passed t[300] on the stack. The outcome comes first, the radio entities last. ED_DIAG_LINES 12 and ED_OUT_BYTES 2754, in the Bluetooth audio image only. - tools/log.mjs reads the twelfth line as cen and shows it after the le row; the KEYS text for test build 33. - docs/BT-AUDIO-TEST.md: the new line, and a Mac's scan of the Chocolate in "Manufacturer" mode: FootCtrl, connectable, -76 dBm, service 1812 (HID over GATT), no MIDI UUID. In that mode it is not a BLE MIDI device: the pedal needs its MIDI mode. Checked: the image built locally (no warnings; 599,484 bytes, 45,444 free in the slot; RAM code window 2,156 bytes free); tests/test_log.mjs with two new checks; test_bt_le_links and test_bt_le_central under ASan/UBSan; node tools/op.mjs package (the release packages unchanged, byte for byte) and test (all passed; the page tests skipped, no Playwright in the image, and the pages are unchanged). On the pedal (build 33 as built here): the music and the editor over Bluetooth together, no drop; the Chocolate in "advanced custom mode" found by its name and connected twice, each link ending before its first exchange (D3E after 197 ms): the next question. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ade, its own ends in the log (for test build 34)
Test build 33 matched and linked the Chocolate twice ("advanced custom mode": the name FootCtrl, no MIDI UUID), and both
links ended unanswered: 3E after 197 ms, six events of 30 ms. Advertising came back on at the very connection complete,
beside the new master link, and the music played.
- bt_le_midi.c: advertising stays held from the scan through the connection until the footswitch's first ATT answer
(le_att_client), LE_CEN_ADV_HOLD_MS (3 s), or the link's end (le_adv_release, le_cen_rest at its end: advertising's turn
first); up to 33 it came back at the connection complete.
- bt_a2dp.c: the last phone's call-back (classic paging) waits until the footswitch is linked (bt_le_cen_settled, or no
central role), or 20 s after power-on.
- The cen line: CD (the footswitch's last link's end reason / life in ms, apart from a phone's), X3E (its links that ended 3E),
IV (the interval its connection complete gave), and a third LF field: the footswitch's connectable advertisements' type, 0
undirected, 1 directed (bt_le_central.h le_seen_t.ctype, le_cen_scan_t.last_ctype).
- Checked in the library's bitcode, nothing changed there: the initiator runs at once with no LE link (le_hw_initiating);
the CONNECT_IND's window, offset and interval come from the link layer's parameters (__connect_req_pdu, CSA #1); the master
link's first anchor is the window offset (le_hw_ioctrl 6, __master_reset_transmitWindowDelay); with
config_btctler_le_master_multilink 0 master_setup_first_data_location does nothing: the single-master path, no stand-in.
- Tests: test_bt_le_central 41 checks (+3: the advertisement type kept, undirected and directed). test_bt_le_links,
test_ble_taskq (BT), test_log pass. docs/BT-AUDIO-TEST.md: "Test build 34".
BT image: no warning (Apple clang thumbv7em, -Wall -Wextra); unresolved symbols unchanged. On bt-audio 4780633 (test build
33); BT_TEST_BUILD left at 33.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…held until the footswitch is subscribed (for test build 34) Test build 33 with the phone's Bluetooth off: the pedal stayed in CEN PAUSE for good (SO2 in 76 s, the Chocolate on in its standard mode never heard, NM0). le_cen_poll runs in ble_profile_loop, after a message of the host's task, and with no phone and no music nothing posts one: advertising alone brings the host no event, and its interrupts keep bt_le_watch quiet. - bt_le_midi.c bt_le_watch (the main loop): while the central role is on and the footswitch is not subscribed, the host's task is woken every LE_CEN_WAKE_MS (200 ms, stack_run_loop_resume, a type-255 message: the editor's 50 ms kick's way), so the scan's turns, the pause, the connection's limit and the client's run on time. - Advertising stays held until the footswitch is subscribed (ATTC_R_READY), the link's end (le_cen_rest), or 10 s as a safety net (LE_CEN_ADV_HOLD_MS; the client's own limits end a link that does not answer). b364e49 released it at the footswitch's first ATT packet or 3 s. - docs/BT-AUDIO-TEST.md: the clock, the hold. BT image: no warning (Apple clang thumbv7em, -Wall -Wextra); unresolved symbols unchanged. test_bt_le_links, test_bt_le_central, test_log pass. On b364e49; BT_TEST_BUILD left at 33. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…0 ms, room for advertising beside it Test build 34 (b364e49 and 1afe07c: the footswitch's link left alone while it is made, the central role's own clock) was built here as BT_TEST_BUILD 34 and tried on the pedal: the Chocolate linked and changed presets with the music clean, but its link kept ending (K10 in about three minutes, X3E 3, CD08) and MIDIWeb never found the pedal. This commit is test build 35: - l2cap_connection_update_request_just (l2cap.c's weak hook) refuses a footswitch's connection parameter update request below LE_CEN_INTERVAL: the Chocolate asked for 11.25 ms and then 15 ms; the link stays at 30 ms with no update procedure. The cen line's UR word counts them, with the last one's interval range. - config_btctler_le_rx_nums 8 (5): it sizes only the LE baseband's receive DMA pool (RF_ble.c le_hw_init, 294 bytes each). The advertiser beside the Chocolate's link stayed in state 0 (le_hw_advertising stops on "RX DMA NULL"). - BT_TEST_BUILD 35 and the KEYS text (34 and 35); docs/BT-AUDIO-TEST.md, test build 35's section. On the pedal: the Chocolate held one link 101.6 s at 30 ms, refusing 3 requests for 15 ms without ending; MIDIWeb found the pedal and the editor, the Chocolate and the music worked together (W85, ED 84/658, MIDI 5). After about 25 s together both LE links ended at the same moment by supervision timeout (the music's link stayed up, UND 0); the pedal linked the Chocolate again by itself, and advertising ran beside it (HW 1:2/0). No preset had been saved. Checked: the image built locally, no warnings, 600,180 bytes (44,748 free), the hook linked as the firmware's (62 bytes); node tools/op.mjs package (the release packages unchanged). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…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>
steponme82
temporarily deployed
to
github-pages
November 13, 2026 08:44 — with
GitHub Pages
Inactive
… 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>
steponme82
temporarily deployed
to
github-pages
November 13, 2026 09:59 — with
GitHub Pages
Inactive
…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>
Owner
Author
|
Superseded by isod89#30, the merge proposal upstream. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test build only (CI artifacts). Do not merge.
The Bluetooth audio test image: the pedal shows up on a phone as
OpenPocket, pairs with no PIN, and plays the phone's musicinto its output (A2DP sink, SBC, mono), as the stock BlackBox firmware does. Its own build target (
make bt); the release imageand the BLE MIDI image are unchanged.
Based on VinSpee's
fm/openpocket-stack-rebase(v40 with the RAM work of VinSpee#16), which is the only base with theRAM for a Bluetooth stack.
archives
third_party/jieli-blealready pins; the new members inthird_party/jieli-bt). Its SDP record is byte for bytethe stock firmware's (
JL_A2DP).third_party/sbc-android, Apache-2.0).dsp_out, in RAM) reads it at arate steered to the phone's clock and adds it after the volume.
the RAM, four task stacks in NOINIT.
Host tests added: the ring and its rate (60 s, jittered phone, the pedal's real clock), SBC through Android's encoder and
decoder, the radio pools' allocator, the third-party sources. Not run on a pedal yet. How to test and what to report:
docs/BT-AUDIO-TEST.md.🤖 Generated with Claude Code