Skip to content

make BT core code execution conditional from include esp_bt.h #11413

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 4, 2025
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
9 changes: 6 additions & 3 deletions cores/esp32/esp32-hal-bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
#if SOC_BT_SUPPORTED
#ifdef CONFIG_BT_BLUEDROID_ENABLED

#if __has_include("esp_bt.h")
#include "esp_bt.h"

#if CONFIG_IDF_TARGET_ESP32
bool btInUse() {
return true;
Expand All @@ -28,8 +31,6 @@ __attribute__((weak)) bool btInUse() {
}
#endif

#include "esp_bt.h"

#ifdef CONFIG_BTDM_CONTROLLER_MODE_BTDM
#define BT_MODE ESP_BT_MODE_BTDM
#elif defined(CONFIG_BTDM_CONTROLLER_MODE_BR_EDR_ONLY)
Expand All @@ -56,7 +57,7 @@ bool btStartMode(bt_mode mode) {
case BT_MODE_BTDM: esp_bt_mode = ESP_BT_MODE_BTDM; break;
default: esp_bt_mode = BT_MODE; break;
}
// esp_bt_controller_enable(MODE) This mode must be equal as the mode in cfg of esp_bt_controller_init().
// esp_bt_controller_enable(MODE) This mode must be equal as the mode in "cfg" of esp_bt_controller_init().
cfg.mode = esp_bt_mode;
if (cfg.mode == ESP_BT_MODE_CLASSIC_BT) {
esp_bt_controller_mem_release(ESP_BT_MODE_BLE);
Expand Down Expand Up @@ -116,6 +117,7 @@ bool btStop() {
return false;
}

#endif // __has_include("esp_bt.h")
#else // CONFIG_BT_ENABLED
bool btStarted() {
return false;
Expand All @@ -132,3 +134,4 @@ bool btStop() {
#endif /* CONFIG_BT_ENABLED */

#endif /* SOC_BT_SUPPORTED */

Loading