Skip to content

Bluetooth-classic: release BLE memory when BT classic only is requested #8051

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 11 commits into from
Nov 29, 2023
Prev Previous commit
Next Next commit
beautification
  • Loading branch information
ferbar committed Apr 12, 2023
commit 853b6d2dd5915446d7ece327bfeb923636b5437a
4 changes: 2 additions & 2 deletions cores/esp32/esp32-hal-bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ bool btStart() {

bool btStartMode(bt_mode mode){
esp_bt_mode_t esp_bt_mode;
esp_bt_controller_config_t cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
#if CONFIG_IDF_TARGET_ESP32
switch(mode) {
case BT_MODE_BLE: esp_bt_mode=ESP_BT_MODE_BLE;
Expand All @@ -49,11 +50,10 @@ bool btStartMode(bt_mode mode){
default: esp_bt_mode=BT_MODE;
break;
}
esp_bt_controller_config_t cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
// 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);
esp_bt_controller_mem_release(ESP_BT_MODE_BLE);
}
#else
// other esp variants dont support BT-classic / DM.
Expand Down
3 changes: 2 additions & 1 deletion libraries/BluetoothSerial/src/BluetoothSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,8 @@ BluetoothSerial::~BluetoothSerial(void)
}

/**
* @Param isMaster set to true if you want to connect to an other device
* @param isMaster set to true if you want to connect to an other device
* @param disableBLE if BLE is not used, its ram can be freed to get +10kB free ram
*/
bool BluetoothSerial::begin(String localName, bool isMaster, bool disableBLE)
{
Expand Down