deinit Bluetooth while device starts if not compiled

This commit is contained in:
Klaus K Wilting 2018-12-16 16:50:37 +01:00
parent 9e079fe642
commit ad33f8fc76
2 changed files with 8 additions and 1 deletions

View File

@ -272,7 +272,7 @@ void stop_BLEscan(void) {
ESP_ERROR_CHECK(esp_ble_gap_register_callback(NULL)); ESP_ERROR_CHECK(esp_ble_gap_register_callback(NULL));
ESP_ERROR_CHECK(esp_bluedroid_disable()); ESP_ERROR_CHECK(esp_bluedroid_disable());
ESP_ERROR_CHECK(esp_bluedroid_deinit()); ESP_ERROR_CHECK(esp_bluedroid_deinit());
btStop(); // disable & deinit bt_controller btStop(); // disable bt_controller
ESP_ERROR_CHECK(esp_coex_preference_set(( ESP_ERROR_CHECK(esp_coex_preference_set((
esp_coex_prefer_t)ESP_COEX_PREFER_WIFI)); // configure Wifi/BT coexist lib esp_coex_prefer_t)ESP_COEX_PREFER_WIFI)); // configure Wifi/BT coexist lib
ESP_LOGI(TAG, "Bluetooth scanner stopped"); ESP_LOGI(TAG, "Bluetooth scanner stopped");

View File

@ -176,7 +176,14 @@ void setup() {
} else } else
btStop(); btStop();
#else #else
// remove bluetooth stack to gain more free memory
ESP_ERROR_CHECK(esp_bluedroid_disable());
ESP_ERROR_CHECK(esp_bluedroid_deinit());
btStop(); btStop();
ESP_ERROR_CHECK(esp_bt_controller_deinit());
ESP_ERROR_CHECK(esp_bt_mem_release(ESP_BT_MODE_BTDM));
ESP_ERROR_CHECK(esp_coex_preference_set((
esp_coex_prefer_t)ESP_COEX_PREFER_WIFI)); // configure Wifi/BT coexist lib
#endif #endif
// initialize button // initialize button