mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-03 02:36:11 +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:
co-authored by
Claude Sonnet 4.6
parent
66122e782d
commit
aedb7f6f5d
@@ -258,10 +258,13 @@ class SettingsScreen : public UIScreen {
|
|||||||
// Corrupted/partial — full re-init below.
|
// Corrupted/partial — full re-init below.
|
||||||
memset(p->page_order, 0, sizeof(p->page_order));
|
memset(p->page_order, 0, sizeof(p->page_order));
|
||||||
} else {
|
} else {
|
||||||
if (!has_fav && len < NodePrefs::PAGE_ORDER_LEN) {
|
if (!has_fav) {
|
||||||
// Insert FAVOURITES right after CLOCK; shift the tail down by one.
|
// 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;
|
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;
|
p->page_order[insert_at] = NodePrefs::HPB_FAVOURITES + 1;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user