feat(ble): expose isInitialized and reclaim memory before radios start

The controller and the WiFi driver each need a large aggregate allocation,
which a live app sitting on garbage can deny - that is why a failed connect
often succeeded on retry. Both bindings now collect before initializing, and
the tree reserves its node and spec capacity so a build does not reallocate
into a tight heap.
This commit is contained in:
2026-08-04 13:10:18 -04:00
parent 3416f54c83
commit bf286eefa6
7 changed files with 37 additions and 3 deletions
+7
View File
@@ -131,10 +131,17 @@ public:
const char* error = nullptr;
uint16_t focus = NONE;
// Growth doubling needs the old and new buffers live at once, which is the
// allocation that fails first on a tight heap. One reservation covers a
// typical screen so a build reallocates only if it genuinely gets large.
static constexpr size_t RESERVE = 64;
void reset() {
focus = NONE;
nodes.clear();
specs.clear();
nodes.reserve(RESERVE);
specs.reserve(RESERVE);
labelAt.clear();
labels.clear();
styles.clear();