feat(ui-lvgl): power saving, review fixes, shared helpers

Power: the UI loop sleeps until something is due (never with packets
queued); screen off puts the CPU at 80 MHz, the GT911 to sleep (unless a
tap wakes the screen) and the LP5814 in standby. GPS off now cuts the
L76K's rail and UART on the L2 (L2GpsProvider). The battery divider is
powered only for a reading (measured: settles at once); readings within
2 s are reused. The SD mount is retried at most every 5 s.

Fixes: WiFi left on after leaving a scan, live tiles' WiFi kept with the
screen off on the map, an ADC read every second for the status bar, touch
polled on every pass while dark, a scan cutting an update's WiFi, relay
count not refreshing in a channel thread, raw @[nick] in room previews.
Labels skip unchanged text (no redraw).

Helpers: scrollList, dimOverlay, settingRow, flexBox, nvs::get/put,
trailFilePath (a second save in the same minute no longer overwrites),
unreadTotal. Dead code removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-09-27 00:12:08 +02:00
co-authored by Claude Opus 5.5
parent f5206f10b4
commit 23caa11f51
23 changed files with 337 additions and 347 deletions
+4 -9
View File
@@ -583,13 +583,7 @@ void UITask::mapDownloadPopup() {
if (_dl_zmax < _map_z) _dl_zmax = _map_z + 3;
if (_dl_zmax > src_max) _dl_zmax = src_max; // the server has nothing finer
_dl_overlay = lv_obj_create(screen());
lv_obj_remove_style_all(_dl_overlay);
lv_obj_set_size(_dl_overlay, LV_PCT(100), LV_PCT(100));
lv_obj_set_style_bg_color(_dl_overlay, lv_color_hex(0x000000), 0);
lv_obj_set_style_bg_opa(_dl_overlay, LV_OPA_60, 0);
lv_obj_add_flag(_dl_overlay, LV_OBJ_FLAG_CLICKABLE);
lv_obj_remove_flag(_dl_overlay, LV_OBJ_FLAG_SCROLLABLE);
_dl_overlay = dimOverlay(screen());
lv_obj_t* panel = lv_obj_create(_dl_overlay);
anim::popup(_dl_overlay);
@@ -828,8 +822,9 @@ void UITask::mapDownloadTick() {
bool got = false;
while (dl.liveTake(z, x, y)) { mapview::s_cache.forgetMissing(z, x, y); got = true; }
if (got && _screen == SCR_MAP) layoutMap();
// The WiFi goes 30 s after the map was left (a quick look elsewhere keeps it).
if (_screen != SCR_MAP) {
// The WiFi goes 30 s after the map was left or the screen went off (a
// quick look elsewhere keeps it).
if (_screen != SCR_MAP || _asleep) {
if (!_map_left_ms) _map_left_ms = millis() | 1;
else if (millis() - _map_left_ms > 30000) dl.liveEnd();
}