Fix BLE crash: move all NimBLE calls to Core 0

Root cause: Arduino Core 3.x breaks cross-core NimBLE API calls.
Calling BLEMidiServer.controlChange() from loop() on Core 1 while
NimBLE host runs on Core 0 causes immediate crash.

Fix:
- Move ble_midi_transport.begin() to ble_init_task on Core 0
- All BLE MIDI sends use queue_cc() (cross-core safe flag setter)
- ble_midi_transport.update() processes queued sends on Core 0
- Pin NimBLE-Arduino to v1.4.3 (stable LTS for BLE MIDI)
- Keep CONFIG_BT_ENABLED out of sdkconfig.h (causes double-init)
This commit is contained in:
ash
2026-07-01 06:46:15 +00:00
parent 62d1e430d5
commit 762500e227
6 changed files with 43 additions and 15 deletions
-4
View File
@@ -70,10 +70,6 @@ def patch_sdkconfig_bt():
content = f.read()
defines = {
# Do NOT set CONFIG_BT_ENABLED here — forces Arduino framework
# to pre-init BT controller at startup, which conflicts with
# TinyUSB on ESP32-S3 (causes reboot on USB MIDI send).
# NimBLEDevice::init() handles its own init.
"CONFIG_BTDM_CTRL_MODE_BLE_ONLY": 1,
"CONFIG_BT_NIMBLE_MAX_CONNECTIONS": 1,
"CONFIG_BT_NIMBLE_TASK_STACK_SIZE": 6144,