Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cores/esp32/esp32-hal-bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ bool btStop(){
while(esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_ENABLED);
}
if(esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_INITED){
if (esp_bt_controller_deinit()) {
log_e("BT deint failed");
return false;
}
while (esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_INITED);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waiting without delay and timeout is not a good idea. Please add delay in the while loop and also do not wait more than the time that it makes sense. Currently you will spin indefinitely and not having a delay there might not allow other tasks to run.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok i have remove the while loop. In fact the state change immediately. however i've add a vTaskdelay(1) for security

return true;
}
log_e("BT Stop failed");
Expand Down