From c783918289daa4ff2dbe6ddc9743884d6d79f083 Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Tue, 22 Aug 2023 21:33:25 -0300 Subject: [PATCH] Fixes ESP32 BT Memory Releasing --- cores/esp32/esp32-hal-bt.c | 4 ++++ cores/esp32/esp32-hal-misc.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/cores/esp32/esp32-hal-bt.c b/cores/esp32/esp32-hal-bt.c index 7b6a54e1ad4..b4c381aa1ab 100644 --- a/cores/esp32/esp32-hal-bt.c +++ b/cores/esp32/esp32-hal-bt.c @@ -16,8 +16,12 @@ #ifdef CONFIG_BT_ENABLED +#if CONFIG_IDF_TARGET_ESP32 +bool btInUse(){ return true; } +#else // user may want to change it to free resources __attribute__((weak)) bool btInUse(){ return true; } +#endif #include "esp_bt.h" diff --git a/cores/esp32/esp32-hal-misc.c b/cores/esp32/esp32-hal-misc.c index 9bc1b3a3a8e..835cce6f08c 100644 --- a/cores/esp32/esp32-hal-misc.c +++ b/cores/esp32/esp32-hal-misc.c @@ -209,9 +209,15 @@ bool verifyRollbackLater() { return false; } #endif #ifdef CONFIG_BT_ENABLED +#if CONFIG_IDF_TARGET_ESP32 +//overwritten in esp32-hal-bt.c +bool btInUse() __attribute__((weak)); +bool btInUse(){ return false; } +#else //from esp32-hal-bt.c extern bool btInUse(); #endif +#endif void initArduino() {