fix: remove manual BT controller pre-init - NimBLE-Arduino 1.4.0 already handles ESP32-S3 internally; double-init caused ESP_ERROR_CHECK abort
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
#include "ble_midi_transport.h"
|
||||
#include <Arduino.h>
|
||||
#include <NimBLEDevice.h>
|
||||
#include <esp_bt.h>
|
||||
#include <esp_bt_main.h>
|
||||
|
||||
#define BLE_MIDI_SERVICE_UUID "03B80E5A-EDE8-4B33-A751-6CE34EC4C700"
|
||||
#define BLE_MIDI_CHAR_UUID "7772E5DB-3868-4112-A1A9-F2669D106BF3"
|
||||
@@ -46,21 +44,10 @@ BleMidiTransport::~BleMidiTransport() {
|
||||
bool BleMidiTransport::begin() {
|
||||
Serial.println("[BLE] Initializing BLE MIDI...");
|
||||
|
||||
// ESP32-S3 only supports BLE (not BTDM). We must init the controller
|
||||
// with BLE-only mode BEFORE NimBLEDevice::init(), which internally
|
||||
// uses BTDM and would fail on S3.
|
||||
esp_err_t err;
|
||||
err = esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT);
|
||||
Serial.printf("[BLE] bt_mem_release: %d (%s)\n", err, esp_err_to_name(err));
|
||||
|
||||
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
|
||||
err = esp_bt_controller_init(&bt_cfg);
|
||||
Serial.printf("[BLE] bt_controller_init: %d (%s)\n", err, esp_err_to_name(err));
|
||||
|
||||
err = esp_bt_controller_enable(ESP_BT_MODE_BLE);
|
||||
Serial.printf("[BLE] bt_controller_enable(BLE): %d (%s)\n", err, esp_err_to_name(err));
|
||||
if (err != ESP_OK) { initialized = false; return false; }
|
||||
|
||||
// NimBLE-Arduino v1.4.0+ handles ESP32-S3 internally, using
|
||||
// bt_cfg.bluetooth_mode = ESP_BT_MODE_BLE. Do NOT pre-init the
|
||||
// BT controller here or NimBLEDevice::init() will see an
|
||||
// error from double-init and abort via ESP_ERROR_CHECK.
|
||||
Serial.println("[BLE] NimBLEDevice init...");
|
||||
NimBLEDevice::init("JOC Midi");
|
||||
Serial.println("[BLE] NimBLEDevice initialized");
|
||||
|
||||
Reference in New Issue
Block a user