mirror of
https://github.com/meshtastic/firmware.git
synced 2026-11-08 07:15:22 -05:00
saveNodeDatabaseToDisk() copied each satellite map into nodeDatabase's vectors just to encode them, so every save needed a second, contiguous copy: up to ~19 KB at the nRF52 cap of 40, 40 x 312 B for environment alone. On busy meshes this ran nRF52 sensor nodes out of heap (new(10920) failed in saveNodeDatabaseToDisk()). Mirror the decode path: arm per-map encode sources for the duration of the save, and have the NodeDatabase encode callback walk the map, one stack entry at a time. Same entries in the same order, so nodes.proto is byte-identical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>