mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-26 14:58:12 +00:00
fix(ui): Favourites migration even when page_order is full
ensurePageOrderInit only inserted FAVOURITES when len < PAGE_ORDER_LEN. Older saves with all 11 slots filled (default order with GPS + SENSORS) hit the full-array branch and were left without FAVOURITES in the explicit order, so the page was shown via the missing-page fallback at end of nav but movePageInOrder couldn't reorder it. Now drop the last entry (typically SHUTDOWN, which the same fallback already re-appends at end of nav) to make room. End result: FAVOURITES sits after CLOCK, reorderable; nav layout matches the new default. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -258,10 +258,13 @@ class SettingsScreen : public UIScreen {
|
||||
// Corrupted/partial — full re-init below.
|
||||
memset(p->page_order, 0, sizeof(p->page_order));
|
||||
} else {
|
||||
if (!has_fav && len < NodePrefs::PAGE_ORDER_LEN) {
|
||||
// Insert FAVOURITES right after CLOCK; shift the tail down by one.
|
||||
if (!has_fav) {
|
||||
// Insert FAVOURITES right after CLOCK. If the array is full, the last
|
||||
// entry (typically SHUTDOWN, which still appears via the missing-page
|
||||
// fallback at end of nav) is overwritten to make room.
|
||||
int insert_at = clock_at + 1;
|
||||
for (int i = len; i > insert_at; i--) p->page_order[i] = p->page_order[i - 1];
|
||||
int tail = (len < NodePrefs::PAGE_ORDER_LEN) ? len : NodePrefs::PAGE_ORDER_LEN - 1;
|
||||
for (int i = tail; i > insert_at; i--) p->page_order[i] = p->page_order[i - 1];
|
||||
p->page_order[insert_at] = NodePrefs::HPB_FAVOURITES + 1;
|
||||
}
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user