mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/fix_tx_issue_after_esp_restart_v3.3' into 'release/v3.3'
components/bt: Shutdown Bluetooth before esp_restart.(V3.3) See merge request espressif/esp-idf!11758
This commit is contained in:
commit
22502bbd38
@ -1501,6 +1501,21 @@ esp_err_t esp_bt_controller_deinit(void)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
||||
static void bt_shutdown(void)
|
||||
{
|
||||
esp_err_t ret = ESP_OK;
|
||||
ESP_LOGD(BTDM_LOG_TAG, "stop Bluetooth");
|
||||
|
||||
ret = esp_bt_controller_disable();
|
||||
if (ESP_OK != ret) {
|
||||
ESP_LOGW(BTDM_LOG_TAG, "controller disable ret=%d", ret);
|
||||
}
|
||||
ret = esp_bt_controller_deinit();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
|
||||
{
|
||||
int ret;
|
||||
@ -1560,6 +1575,10 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
|
||||
}
|
||||
|
||||
btdm_controller_status = ESP_BT_CONTROLLER_STATUS_ENABLED;
|
||||
ret = esp_register_shutdown_handler(bt_shutdown);
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(BTDM_LOG_TAG, "Register shutdown handler failed, ret = 0x%x", ret);
|
||||
}
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ static const char* TAG = "system_api";
|
||||
|
||||
static uint8_t base_mac_addr[6] = { 0 };
|
||||
|
||||
#define SHUTDOWN_HANDLERS_NO 2
|
||||
#define SHUTDOWN_HANDLERS_NO 3
|
||||
static shutdown_handler_t shutdown_handlers[SHUTDOWN_HANDLERS_NO];
|
||||
|
||||
void system_init()
|
||||
|
Loading…
x
Reference in New Issue
Block a user