diff --git a/components/driver_bt/bt_app_core.c b/components/driver_bt/bt_app_core.c index 3b3f15b9..fd7c1bdf 100644 --- a/components/driver_bt/bt_app_core.c +++ b/components/driver_bt/bt_app_core.c @@ -83,15 +83,13 @@ static void bt_app_task_handler(void *arg) esp_bt_controller_mem_release(ESP_BT_MODE_BLE); esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT(); - if(esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_IDLE ){ - - + if (esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_IDLE ) { if ((err = esp_bt_controller_init(&bt_cfg)) != ESP_OK) { ESP_LOGE(TAG, "%s initialize controller failed: %s\n", __func__, esp_err_to_name(err)); goto exit; } - if ((err = esp_bt_controller_enable(ESP_BT_MODE_BTDM)) != ESP_OK) { + if ((err = esp_bt_controller_enable(ESP_BT_MODE_CLASSIC_BT)) != ESP_OK) { ESP_LOGE(TAG, "%s enable controller failed: %s\n", __func__, esp_err_to_name(err)); goto exit; } diff --git a/components/spotify/Shim.cpp b/components/spotify/Shim.cpp index 8fd08061..386aedd0 100644 --- a/components/spotify/Shim.cpp +++ b/components/spotify/Shim.cpp @@ -162,6 +162,8 @@ ESP_LOGI(TAG, "Getting Spotify event %d ", (int) event.eventType); } }); + // need to make sure mercuryManager is running otherwise we'll loop and destroy instances + while (!mercuryManager->isRunning) vTaskDelay(pdMS_TO_TICKS(25)); mercuryManager->reconnectedCallback = []() { return spircController->subscribe(); }; diff --git a/components/spotify/cspot/src/PlainConnection.cpp b/components/spotify/cspot/src/PlainConnection.cpp index a9d8d4f0..ac4080a7 100644 --- a/components/spotify/cspot/src/PlainConnection.cpp +++ b/components/spotify/cspot/src/PlainConnection.cpp @@ -179,6 +179,7 @@ size_t PlainConnection::writeBlock(const std::vector &data) break; default: if (retries++ > 4) throw std::runtime_error("Error in write"); + goto WRITE; } } idx += n;