From d4f6289500809ec1f2bdcb89a3525df658638b9b Mon Sep 17 00:00:00 2001 From: Philippe G Date: Thu, 1 Jul 2021 13:27:55 -0700 Subject: [PATCH] wait for BT disable to avoid crash - release --- components/driver_bt/bt_app_sink.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/driver_bt/bt_app_sink.c b/components/driver_bt/bt_app_sink.c index ab058240..c175ccf2 100644 --- a/components/driver_bt/bt_app_sink.c +++ b/components/driver_bt/bt_app_sink.c @@ -650,10 +650,12 @@ void bt_sink_init(bt_cmd_vcb_t cmd_cb, bt_data_cb_t data_cb) void bt_sink_deinit(void) { - /* this still does not work, can't figure out how to stop properly this BT stack */ bt_app_task_shut_down(); ESP_LOGD(BT_AV_TAG, "bt_app_task shutdown successfully"); if (esp_bluedroid_disable() != ESP_OK) return; + // this disable has a sleep timer BTA_DISABLE_DELAY in bt_target.h and + // if we don't wait for it then disable crashes... don't know why + vTaskDelay(2*200 / portTICK_PERIOD_MS); ESP_LOGD(BT_AV_TAG, "esp_bluedroid_disable called successfully"); if (esp_bluedroid_deinit() != ESP_OK) return; ESP_LOGD(BT_AV_TAG, "esp_bluedroid_deinit called successfully");