Commit Graph
155 Commits
Author SHA1 Message Date
ash 00337559ac Add BLE diagnostics: controller status, MAC, advertising result
Remove getMinInterval/getMaxInterval (not available in v1.4.0).
Add esp_bt_controller_get_status() before/after init.
Add esp_bt_dev_get_address() for MAC address.
Print adv->start() return value.
Add explicit advertising interval settings (100-200ms).
2026-07-01 07:09:30 +00:00
ash 9ba48b3f9c Roll back to 2d3a5a9 + CONFIG_BT_ENABLED + double-init patch 2026-07-01 07:06:45 +00:00
ash 01eaf9ce80 Fix enable-after-Arduino-init: always try to enable
Arduino framework inits BT controller but does NOT enable it.
Previous patch skipped both init AND enable when init returned
ESP_ERR_INVALID_STATE, leaving controller in init'd-but-not-enabled
state. Now we always try to enable regardless of init outcome.
2026-07-01 07:01:39 +00:00
ash c26116a7ef Set CONFIG_BT_ENABLED + re-add double-init patch
Without CONFIG_BT_ENABLED in sdkconfig.h, NimBLEDevice.cpp lines
are excluded by #if defined(CONFIG_BT_ENABLED) preprocessor guard,
making NimBLEDevice::init() a no-op. No BT controller init ever
occurs -> no RF calibration -> invisible BLE advertising.

With CONFIG_BT_ENABLED: Arduino framework pre-inits BT controller,
then NimBLEDevice::init() double-inits -> ESP_ERROR_CHECK abort.
Fix: patch NimBLEDevice.cpp to check return code and skip init if
already running.
2026-07-01 06:57:19 +00:00
ash fec2ea1db2 Move all MIDI processing to Core 0
Move controller.update() inside midi_task on Core 0 to eliminate
TinyUSB cross-core race condition. Previously:
 - Core 1 (loop()): usb_midi.writePacket() in controller.update()
 - Core 0 (midi_task): usb_midi.available()/readPacket()
This race condition causes crashes on button press.

Now:
 - Core 0 (midi_task): midi_transport.update() + controller.update()
 - Core 1 (loop()): led_driver.update() + serial commands only
2026-07-01 06:51:48 +00:00
ash 762500e227 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)
2026-07-01 06:46:15 +00:00
ash 62d1e430d5 Switch from NimBLE-Arduino to ESP32-BLE-MIDI library
Replace direct NimBLE-Arduino dependency with max22/ESP32-BLE-MIDI
wrapper library (v0.3.2). Rewrite ble_midi_transport to use
BLEMidiServer API instead of raw NimBLEDevice calls.

Removes patch_nimble_device() from pre_build.py — no longer needed
since BT controller init is managed by the library internally.

The library uses NimBLE v1.4.1 internally and configures advertising
without setScanResponse() or setName(), which may resolve the invisible
BLE advertising issue on ESP32-S3.
2026-07-01 06:34:36 +00:00
ash 1517eda13e add CONFIG_BT_ENABLED to sdkconfig.h for proper BT RF calibration; patch NimBLEDevice.cpp to skip controller init if already done by Arduino framework 2026-07-01 06:11:28 +00:00
ash 855c97d8c6 revert to NimBLE-Arduino v1.4.0 (v2.2.3 caused button crash regression); restore v1.4.0 callback signatures, service->start(), and setScanResponse 2026-07-01 04:47:22 +00:00
ash 993a09fa7c fix v2.2.3 API: update callback signatures (onConnect, onDisconnect, onWrite) and remove deprecated service->start() 2026-07-01 04:30:50 +00:00
ash 18844c17c0 upgrade NimBLE-Arduino to v2.2.3 for proper ESP32-S3 support; fix setScanResponse->enableScanResponse API change 2026-07-01 04:27:22 +00:00
ash 7530772acd add adv->setName, remove diagnostics and ext adv flag; revert to stable 2026-07-01 04:18:00 +00:00
ash 94567e3485 fix: NimBLEDevice::init() returns void, remove bool check 2026-07-01 04:02:04 +00:00
ash beb59da3e0 add init() return check, controller status, and MAC address debug 2026-06-30 22:07:06 +00:00
ash 2d3a5a9031 queue MIDI sends with delay(1) to avoid race; force legacy advertising 2026-06-30 21:59:55 +00:00
ash 72a10fa13a add TinyUSBDevice.ready() guard in send_cc to prevent crash 2026-06-30 13:55:53 +00:00
ash d8c109d9e5 remove setName and health check (caused crashes), add isAdvertising() check 2026-06-30 13:14:19 +00:00
ash 5ee5949420 add adv->setName(JOC Midi) and health check to restart advertising 2026-06-30 12:55:29 +00:00
ash 8515963e07 pre_build.py: remove CONFIG_BT_ENABLED from sdkconfig patching (fixes BT pre-init conflict with USB) 2026-06-30 12:34:00 +00:00
ash e2db658037 TEST: disable BLE init to isolate button press crash 2026-06-30 12:12:50 +00:00
ash 8833e08c0a add debug prints before switch read and in process_switch_event; skip MIDI sends 2026-06-30 08:54:00 +00:00
ash 3e92d6bb7c swap init order (USB before BLE), add USB ready check and debug prints 2026-06-30 08:48:04 +00:00
ash be8b0dc22d add debug prints around button press to find crash location 2026-06-30 08:35:47 +00:00
ash 6038b3bf58 remove health check - back to exact source of working commit 6e3173c 2026-06-30 07:59:07 +00:00
ash 1f7bdc1e3a revert setName, keep health check 2026-06-30 07:55:10 +00:00
ash af6fd2dc26 fix: add adv->setName, add periodic health check to diagnose invisible BLE device 2026-06-30 07:44:04 +00:00
ash 6e3173c9b8 fix: remove manual 0x2902/CCCD descriptor creation - NimBLE auto-creates it for NOTIFY characteristics; asserts on manual create 2026-06-30 07:37:48 +00:00
ash d19d1acbdd chore: add granular debug prints around BLE characteristic/descriptor creation to pinpoint crash 2026-06-30 07:31:34 +00:00
ash a21c7bf4d3 fix: remove manual BT controller pre-init - NimBLE-Arduino 1.4.0 already handles ESP32-S3 internally; double-init caused ESP_ERROR_CHECK abort 2026-06-30 07:24:34 +00:00
ash 6a737bcee2 fix: patch nimconfig.h with #ifndef guards for ROLE defines to eliminate redefinition warnings 2026-06-30 07:15:14 +00:00
ash 323bc072ee fix: remove redundant ROLE defines from pre_build.py, suppress -Wno-macro-redefined 2026-06-30 07:09:15 +00:00
ash 13aef3b2a0 Init BT controller with ESP_BT_MODE_BLE before NimBLEDevice::init to avoid BTDM crash on ESP32-S3 2026-06-30 06:59:32 +00:00
ash 68efe30682 Remove redundant manual BT controller init; let NimBLEDevice::init handle it internally with BLE-only mode 2026-06-30 06:49:43 +00:00
ash 2db09b76bf Add BT controller diagnostics, init BLE before USB MIDI 2026-06-30 06:43:58 +00:00
ash 8a36296043 Add sdkconfig.defaults for BLE, remove bad CONFIG flags, increase stack 2026-06-30 06:36:40 +00:00
ash eab0b76c9d Fix: NimBLEDevice::init returns void, remove bool check 2026-06-30 06:30:58 +00:00
ash 95d182cda6 Replace NimBLE2902 with createDescriptor for CCCD 2026-06-30 06:29:30 +00:00
ash c3bbf08768 Fix: use just NimBLEDevice.h, remove missing NimBLE2902.h 2026-06-30 06:25:25 +00:00
ash f5eca2c7bc Switch to NimBLE stack, add BT build flags, add error checking 2026-06-30 06:24:19 +00:00
ash 892e4fe061 Fix: on_receive public, explicit casts for narrowing 2026-06-30 06:19:10 +00:00
ash aea3a28206 Add BLE MIDI transport (feature_bluetooth) 2026-06-30 06:13:36 +00:00
ash ae2891fca8 Fix palette: entries 121-127 now visible (was black). Remove local flash. 2026-06-30 05:05:06 +00:00
ash d59e36a9a5 Add direct local LED feedback on button press 2026-06-30 04:58:22 +00:00
ash 063fa2065d Send visible palette index 21 (yellow) instead of 127 (black) so feedback is visible 2026-06-30 04:49:30 +00:00
ash 62b0604508 Map buttons to custom CC values with reverse-map feedback 2026-06-30 04:43:42 +00:00
ash 3389cc9403 Send CC instead of NOTE_ON for Loopy Pro generic mirror. Clean up flash_activity. 2026-06-30 04:38:28 +00:00
ash 1728413cb8 Fix NOTE_ON feedback: pass led_index to set_led_state 2026-06-30 04:17:18 +00:00
ash c57847db78 Remove flash_activity that was stealing focus to LED 0 2026-06-30 04:14:07 +00:00
ash a4131adf2a Fix CC feedback: route to correct pixel by LED index 2026-06-30 04:04:43 +00:00
Ashley Strahle 3dc9e445be . 2026-06-30 13:54:41 +10:00