mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-22 13:10:55 +01:00
Add conditional checks in NimBLEDevice init/deinit.
This commit is contained in:
parent
70c2d83b3b
commit
20349c64a4
1 changed files with 6 additions and 4 deletions
|
@ -878,9 +878,11 @@ void NimBLEDevice::init(const std::string &deviceName) {
|
||||||
|
|
||||||
ESP_ERROR_CHECK(errRc);
|
ESP_ERROR_CHECK(errRc);
|
||||||
|
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32
|
||||||
esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT);
|
esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
|
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) | !defined(CONFIG_NIMBLE_CPP_IDF)
|
||||||
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
|
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
|
||||||
# if defined (CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3)
|
# if defined (CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||||
bt_cfg.bluetooth_mode = ESP_BT_MODE_BLE;
|
bt_cfg.bluetooth_mode = ESP_BT_MODE_BLE;
|
||||||
|
@ -942,7 +944,7 @@ void NimBLEDevice::deinit(bool clearAll) {
|
||||||
int ret = nimble_port_stop();
|
int ret = nimble_port_stop();
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
nimble_port_deinit();
|
nimble_port_deinit();
|
||||||
#ifdef ESP_PLATFORM
|
#ifdef CONFIG_NIMBLE_CPP_IDF
|
||||||
# if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
|
# if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
|
||||||
ret = esp_nimble_hci_and_controller_deinit();
|
ret = esp_nimble_hci_and_controller_deinit();
|
||||||
if (ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
|
|
Loading…
Reference in a new issue