mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-06-05 21:04:49 +00:00
fix(nimble): Correct adv_list_init / deinit during nimble init / deinit
This commit is contained in:
@@ -159,9 +159,6 @@ esp_err_t esp_nimble_init(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_BT_CONTROLLER_DISABLED
|
||||
esp_err_t ret;
|
||||
#endif
|
||||
#if !SOC_ESP_NIMBLE_CONTROLLER || !CONFIG_BT_CONTROLLER_ENABLED
|
||||
/* Initialize the global memory pool */
|
||||
os_mempool_module_init();
|
||||
@@ -177,15 +174,13 @@ esp_err_t esp_nimble_init(void)
|
||||
return ESP_FAIL;
|
||||
}
|
||||
#else
|
||||
esp_err_t ret;
|
||||
ret = ble_buf_alloc();
|
||||
if (ret != ESP_OK) {
|
||||
ble_buf_free();
|
||||
return ESP_FAIL;
|
||||
}
|
||||
ble_transport_init();
|
||||
#if MYNEWT_VAL(BLE_QUEUE_CONG_CHECK)
|
||||
ble_adv_list_init();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Initialize default event queue */
|
||||
@@ -194,6 +189,10 @@ esp_err_t esp_nimble_init(void)
|
||||
|
||||
#endif
|
||||
|
||||
#if MYNEWT_VAL(BLE_QUEUE_CONG_CHECK)
|
||||
ble_adv_list_init();
|
||||
#endif
|
||||
|
||||
/* Initialize the host */
|
||||
ble_transport_hs_init();
|
||||
|
||||
@@ -215,6 +214,10 @@ esp_err_t esp_nimble_deinit(void)
|
||||
|
||||
ble_transport_ll_deinit();
|
||||
|
||||
#if MYNEWT_VAL(BLE_QUEUE_CONG_CHECK)
|
||||
ble_adv_list_deinit();
|
||||
#endif
|
||||
|
||||
#if !SOC_ESP_NIMBLE_CONTROLLER || !CONFIG_BT_CONTROLLER_ENABLED
|
||||
#if CONFIG_BT_CONTROLLER_ENABLED
|
||||
if(esp_nimble_hci_deinit() != ESP_OK) {
|
||||
@@ -225,10 +228,7 @@ esp_err_t esp_nimble_deinit(void)
|
||||
return ESP_FAIL;
|
||||
}
|
||||
#else
|
||||
#if MYNEWT_VAL(BLE_QUEUE_CONG_CHECK)
|
||||
ble_adv_list_deinit();
|
||||
#endif
|
||||
ble_transport_deinit();
|
||||
ble_transport_deinit();
|
||||
ble_buf_free();
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user