feat(ui-lvgl): on-device map download over WiFi

The map's download button fetches the visible area (overview levels up to
a chosen zoom) into /sdcard/maps from OpenTopoMap or maps/source.txt,
skipping tiles already on the card and rejecting placeholder answers.
Settings > WiFi stores the network in NVS (with scan); WiFi is on only
while a download runs. HTTP runs on a worker task on core 0; the popup
shows link, internal heap and the last TLS/HTTP error.

Internal RAM was the blocker (~13 KB free with WiFi + Bluedroid): the L2
LVGL env now allocates the_mesh in PSRAM (MESH_IN_PSRAM, static RAM
210 -> 87 KB) and mbedTLS allocates from PSRAM. Confirmed on hardware.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-09-25 11:26:44 +02:00
co-authored by Claude Opus 5.5
parent 64321bf12b
commit 0fa7966280
12 changed files with 1030 additions and 9 deletions
+14
View File
@@ -135,7 +135,21 @@ static uint32_t _atoi(const char* sp) {
StdRNG fast_rng;
SimpleMeshTables tables;
#if defined(MESH_IN_PSRAM) && defined(ESP32)
// ~120 KB of contacts/channels/queues: on PSRAM boards keep it out of internal
// RAM, which WiFi + TLS + BLE need (PSRAM is on the heap before global
// constructors run; internal RAM is the fallback).
#include <new>
#include <esp_heap_caps.h>
static MyMesh* newMesh() {
void* p = heap_caps_malloc(sizeof(MyMesh), MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
if (!p) p = malloc(sizeof(MyMesh));
return new (p) MyMesh(radio_driver, fast_rng, rtc_clock, tables, store);
}
MyMesh& the_mesh = *newMesh();
#else
MyMesh the_mesh(radio_driver, fast_rng, rtc_clock, tables, store);
#endif
/* END GLOBAL OBJECTS */