Changes
Port audio hot-path to RAM + drop to 150 MHz
All audio critical-path functions are now marked __not_in_flash_func and execute from SRAM instead of XIP flash:
| Function | File | Priority |
|---|---|---|
audio_loop()
| src/audio.cpp
| P0 — full DSP (LP filter, envelope, Mix/Replace) |
core1_entry()
| src/audio.cpp
| P0 — Opus encode dispatch loop |
bt_write()
| src/bt.cpp
| P1 — BT packet assembly + CRC (inlined) |
state_set()
| src/state_mgr.cpp
| P1 — called every haptic packet |
With code running from RAM, overclocking is no longer needed to compensate for XIP flash latency. The system clock drops from 320 MHz to 150 MHz, and the CYW43 PIO divider changes from 5 to 2 (SPI ~37.5 MHz, within the CYW43439 50 MHz limit).
The vreg voltage bump (1.20 V) and 1 s stabilisation delay are now conditional via #if SYS_CLOCK_KHZ != 150000 — the PICO_W_BUILD target (200 MHz) is unaffected.
Fix for #7
This is the root cause of issue #7: without __not_in_flash_func on audio_loop(), merging our auto-haptics DSP with awalol's 150 MHz clock left audio_loop() executing from flash at 150 MHz, causing haptic packets to miss their deadline → no actuation. No manual merge needed anymore.
Note: if BT fails to pair after flashing, try setting
CYW43_PIO_CLOCK_DIV_VALUEto3in CMakeLists.txt and rebuilding — some modules may need a more conservative SPI clock.