From dafdeefa0d603b57a5dcaf8b19eb1e08a5998f4e Mon Sep 17 00:00:00 2001 From: Pixel Perfect Date: Sun, 2 Aug 2026 01:24:56 -0700 Subject: [PATCH] fix(map): don't paint from a backend whose swap is still deferred The quiescence gate drops the decoded tiles and clears the dedup ring unconditionally, which is right, but it also fell through to renderMapTiles() with s_tile_fs still pointing at the old backend. On the teardown side that means probing &SD for a card that is gone -- up to five opens per tile, each paying a full sd_diskio timeout, on the loop task. Return after the invalidation when the swap could not be applied. sdHealthTick renders as soon as it lands it. Signed-off-by: Pixel Perfect --- src/ui-touch/UITask.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ui-touch/UITask.cpp b/src/ui-touch/UITask.cpp index 16d98ab2..9c298d4c 100644 --- a/src/ui-touch/UITask.cpp +++ b/src/ui-touch/UITask.cpp @@ -25923,6 +25923,13 @@ static void mapNoteStorageChanged() { for (int i = 0; i < k_tile_fetch_dedup_size; ++i) s_tile_fetch_dedup[i] = 0; s_tile_fetch_dedup_head = 0; freeMapTiles(); +#if CAP_SD || defined(TLORA_PAGER) + // Drop the stale tiles above either way, but do not paint from a backend we + // already know is wrong — that would read through &SD for a card that is gone + // and pay a full SPI timeout per probe on the loop task. sdHealthTick renders + // as soon as it lands the deferred swap. + if (!may_swap) return; +#endif if (g_lv.tabview && lv_tabview_get_tab_act(g_lv.tabview) == MAP_TAB_INDEX) renderMapTiles(); }