diff --git a/examples/companion_radio/ui-new/SettingsScreen.h b/examples/companion_radio/ui-new/SettingsScreen.h index 4d1e6f02..61cabb8c 100644 --- a/examples/companion_radio/ui-new/SettingsScreen.h +++ b/examples/companion_radio/ui-new/SettingsScreen.h @@ -600,6 +600,7 @@ public: return true; } if (enter && homePageToggleable(_selected)) { + if (!p->home_pages_mask) p->home_pages_mask = HP_ALL; p->home_pages_mask ^= homePageBit(_selected); _dirty = true; return true; diff --git a/examples/companion_radio/ui-new/UITask.cpp b/examples/companion_radio/ui-new/UITask.cpp index 837990f8..4a2153a0 100644 --- a/examples/companion_radio/ui-new/UITask.cpp +++ b/examples/companion_radio/ui-new/UITask.cpp @@ -232,6 +232,13 @@ class HomeScreen : public UIScreen { int pg = bitToPage(v - 1); if (pg >= 0 && pg < (int)Count && isPageVisible(pg)) out[n++] = pg; } + // Append any visible page missing from page_order (handles corrupted/migrated prefs) + for (int pg = 0; pg < (int)Count; pg++) { + if (!isPageVisible(pg)) continue; + bool found = false; + for (int i = 0; i < n; i++) if (out[i] == pg) { found = true; break; } + if (!found) out[n++] = pg; + } } else { for (int pg = 0; pg < (int)Count; pg++) if (isPageVisible(pg)) out[n++] = pg;