Skip to content
This repository was archived by the owner on Nov 18, 2024. It is now read-only.

Commit ac2eceb

Browse files
committed
Extra fix needed for @vicatcu's PR of @chegewara's work See below
So I merged the pull-request mentioned in espressif#4046, and noticed a regression compared to the code currently in master: In my app I use light-sleep, and to do so I have to carefully not just turnoff bluetooth, but stop and delete my various services before going to sleep. During this process I would call BLEDevice::deinit(false). That still works fine. However, when my app woke from light-sleep and needed to restart bluetooth it was hanging in registerApp: ``` Starting bluetooth [D][BLEDevice.cpp:80] createServer(): >> createServer [D][BLEServer.cpp:291] registerApp(): >> registerApp - 1 [D][FreeRTOS.cpp:164] take(): Semaphore taking: name: RegisterAppEvt (0x3ffdd7b0), owner: <N/A> for registerApp [D][FreeRTOS.cpp:173] take(): Semaphore taken: name: RegisterAppEvt (0x3ffdd7b0), owner: registerApp ``` To I poked around a bit, and it seems that in the PR espressif#4050 branch, there is a change compared to master. A bit of code that used to be #ifdef was changed to be #ifndef. Which has the effect of never setting initialized to false. If initialized is left true, my call to BLEDevice::init() was having no effect. So I've changed this ifdef back to what master had, and now my app works nicely and the corruption I was previously seeing in my BLE structures seems fixed (the original goal of pulling in 4050.
1 parent 3fa2c2e commit ac2eceb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: libraries/BLE/src/BLEDevice.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ void BLEDevice::removePeerDevice(uint16_t conn_id, bool _client) {
620620
esp_bluedroid_deinit();
621621
esp_bt_controller_disable();
622622
esp_bt_controller_deinit();
623-
#ifndef ARDUINO_ARCH_ESP32
623+
#ifdef ARDUINO_ARCH_ESP32
624624
if (release_memory) {
625625
esp_bt_controller_mem_release(ESP_BT_MODE_BTDM); // <-- require tests because we released classic BT memory and this can cause crash (most likely not, esp-idf takes care of it)
626626
} else {

0 commit comments

Comments
 (0)