fix(ui-lvgl): smooth WiFi/Bluetooth switches; retry 404 tiles

- The WiFi and Bluetooth rows rebuilt the whole Settings page to update
  their hint, cutting the switch's animation short; the hint is now
  rewritten in place (rowHintSet). The "Bluetooth on" echo toast is gone.
- Map download: a 404 gets the same one retry as other errors
  (OpenTopoMap sends the odd 404 for a tile not rendered yet), and a
  download that ends with gaps says "Done, N missing - download again".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-09-29 10:41:18 +02:00
co-authored by Claude Opus 5.5
parent 890ee6533e
commit bc266a4f5c
4 changed files with 47 additions and 33 deletions
@@ -228,9 +228,11 @@ public:
else if (isPlaceholder(data, len)) { lvport::fetchRelease(); finish(FAILED, "Server sends a placeholder (blocked / key?)"); return; }
else if (!writeTile(_z, _x, _y, data, len)) { lvport::fetchRelease(); finish(FAILED, "Can't write to the SD card"); return; }
else { _done++; _consec_fail = 0; }
} else if (!_retried && r != -403 && r != -401 && r != -404) {
} else if (!_retried && r != -403 && r != -401) {
// One more try after a pause: a dropped keep-alive connection or a
// busy server usually answers the second time.
// busy server usually answers the second time. A 404 too: both tile
// servers answer every tile of the world, and OpenTopoMap sends the
// odd 404 for a tile it hasn't rendered yet.
lvport::fetchRelease();
_retried = true;
_last_start = millis() + 1000;
@@ -247,7 +249,13 @@ public:
// Skip tiles already on the card (a few stat()s per pass), then start the next GET.
for (int i = 0; i < 16 && _state == RUNNING; i++) {
if (_z > _area.zmax) { finish(DONE, "Done"); return; }
if (_z > _area.zmax) {
// Tiles on the card are skipped, so the same download again fetches just the missing ones.
char m[48];
if (_failed) snprintf(m, sizeof(m), "Done, %lu missing - download again", (unsigned long)_failed);
finish(DONE, _failed ? m : "Done");
return;
}
char path[96];
tilePath(path, sizeof(path), _z, _x, _y, _layer);
struct stat st;