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.
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.
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)
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.