[MEM] Reduce ESP32 BLE firmware RAM usage (#2294)

- Fix addLog buffer overflow; reduce LOG_BUFFER_SIZE 6096→3072, ROW_LENGTH 1024→512
- Lazy-allocate web console log buffer (saves ~3.5KB when console not active)
- Stream WebUI responses in chunks to eliminate String heap allocations
- NimBLE buffer tuning: ACL bufs 20→12, HCI hi bufs 30→15, MSYS1 blocks 12→8, MTU 256→185
- BLE adv report flow control 100→50, LWIP sockets 16→10
- BLE scan duplicate cache 200→100 (align with sdkconfig)
- procBLETask stack 9500→8000 (788B headroom over measured peak)
- Cap BLE device vector at 80 with LRU eviction of non-listed devices
- Disable unused LWIP components: PPP, IPv6 autoconfig/DHCPv6
- Disable unused Arduino libs: SD, SD_MMC, FFat, LittleFS, NetBIOS

Measured over 30 min A/B test vs development:
  freemem: 58,805 → 68,755 avg (+10KB)
  minmem:  5,988 → 15,780 (+9.8KB)
  msgprc/scnct: identical (656 msgs, 26 scans)
  msgblck: 0 on both branches
  No crashes or errors

Co-authored-by: Florian <1technophile@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
authored and GitHub committed 2026-03-22 19:05:44 -05:00
1 parent 7d6a019699
commit 3a4eb55a79
4 files changed
+335 -388

No files matched your search

+4 -1
View File
@@ -100,7 +100,10 @@ extern String stateBTMeasures(bool);
#endif
#ifndef BLEScanDuplicateCacheSize
# define BLEScanDuplicateCacheSize 200
# define BLEScanDuplicateCacheSize 100
#endif
#ifndef MaxBLEDevices
# define MaxBLEDevices 80
#endif
#ifndef TimeBtwRead
# define TimeBtwRead 55555 //define default time between 2 scans; in milliseconds