NimBLE params overhaul and try-fix for incompatible bond cleanup (#10741)

* NimBLE params overhaul and try-fix for incompatible bond cleanup

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Address PR review: remove dead clearNVS(), defer bond-purge log below init

- Delete unused clearNVS() (no callers; should have been removed in #10264).

- Move purgeIncompatibleBleBonds() after the "Init the NimBLE" log so bond-cleanup output doesn't appear to precede module init; it still runs before BLEDevice::init() reads the store.

* Update MAX_SATELLITE_NODES and WARM_NODE_COUNT definitions for ESP32-S3 PSRAM support

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Ben Meadors
2026-06-19 12:21:05 -05:00
committed by GitHub
co-authored by GitHub Copilot Autofix powered by AI
parent 9358b2c549
commit f2f23f8978
3 changed files with 126 additions and 20 deletions
+13 -8
View File
@@ -105,14 +105,17 @@ static inline int get_max_num_nodes()
/// Per-map cap (position/telemetry/environment/status): only the freshest
/// MAX_SATELLITE_NODES nodes keep satellite payloads, the rest just the
/// NodeInfoLite header. RAM-bound (the maps are internal-SRAM, not PSRAM), so
/// flash-rich hosts get a cap >= their hot store (satellites for every node, as
/// before the cap existed) while constrained parts stay at 40.
/// NodeInfoLite header. RAM-bound: the four maps live in internal SRAM (not
/// PSRAM). PSRAM-equipped ESP32-S3 (and native) keep the full 250; other ESP32
/// (no-PSRAM, incl. S3) get 80 -- ~32 KB worst case, affordable now the warm
/// tier is trimmed; nRF52840 and other tight parts stay at 40.
#ifndef MAX_SATELLITE_NODES
#if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(ARCH_PORTDUINO)
#define MAX_SATELLITE_NODES 250
#if defined(ARCH_PORTDUINO) || (defined(CONFIG_IDF_TARGET_ESP32S3) && defined(BOARD_HAS_PSRAM))
#define MAX_SATELLITE_NODES 250 // native / PSRAM-equipped ESP32-S3
#elif defined(ARCH_ESP32)
#define MAX_SATELLITE_NODES 80 // no-PSRAM ESP32 (incl. ESP32-S3)
#else
#define MAX_SATELLITE_NODES 40 // nRF52840 (28 KB LittleFS) and generic ESP32
#define MAX_SATELLITE_NODES 40 // nRF52840 (28 KB LittleFS) and other constrained parts
#endif // platform
#endif // MAX_SATELLITE_NODES
@@ -127,9 +130,11 @@ static inline int get_max_num_nodes()
// architecture.h via configuration.h) isn't defined this early in every include
// chain. Backed by the raw-flash ring below LittleFS — see WarmNodeStore.h.
#define WARM_NODE_COUNT 200
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
#define WARM_NODE_COUNT 2000 // PSRAM-backed when available; warm.dat ~80 KB
#elif defined(CONFIG_IDF_TARGET_ESP32S3) && defined(BOARD_HAS_PSRAM)
#define WARM_NODE_COUNT 2000 // ESP32-S3 with PSRAM (external); warm.dat ~80 KB
#else
// generic ESP32 and no-PSRAM ESP32-S3: ~12.5 KB in internal heap (calloc fallback in
// WarmNodeStore), leaving room for the BLE controller. PSRAM-equipped S3 takes the 2000 case above.
#define WARM_NODE_COUNT 320
#endif // platform
#endif // WARM_NODE_COUNT