mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-02 02:06:11 +00:00
fix(ui): home pages — evict SHUTDOWN from full page_order to fit missing pages
Previous fix appended missing pages only when there was room (cur_len < PAGE_ORDER_LEN). On e-ink builds with GPS+SENSORS the default order fills all 11 slots; old saves that included SHUTDOWN instead of TOOLS/QUICK_MSG had no room to append the missing entries. Now, if the array is full and a required page is absent, SHUTDOWN is evicted first (it is appended at runtime by buildVisibleOrder's fallback and does not need to be in the explicit list). This frees a slot for the missing page. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
2e0263bdf9
commit
7c8f5895cd
@@ -305,8 +305,26 @@ class SettingsScreen : public UIScreen {
|
|||||||
#endif
|
#endif
|
||||||
NodePrefs::HPB_SETTINGS, NodePrefs::HPB_TOOLS, NodePrefs::HPB_QUICK_MSG,
|
NodePrefs::HPB_SETTINGS, NodePrefs::HPB_TOOLS, NodePrefs::HPB_QUICK_MSG,
|
||||||
};
|
};
|
||||||
for (int i = 0; i < (int)(sizeof(REQUIRED)/sizeof(REQUIRED[0])); i++) {
|
// If the array is full but a required page is missing, evict SHUTDOWN
|
||||||
uint8_t bit = REQUIRED[i];
|
// (it is handled by buildVisibleOrder's fallback and need not be explicit).
|
||||||
|
if (cur_len == NodePrefs::PAGE_ORDER_LEN) {
|
||||||
|
bool any_missing = false;
|
||||||
|
for (int ri = 0; ri < (int)(sizeof(REQUIRED)/sizeof(REQUIRED[0])); ri++) {
|
||||||
|
if (!(present & (uint16_t)(1u << REQUIRED[ri]))) { any_missing = true; break; }
|
||||||
|
}
|
||||||
|
if (any_missing) {
|
||||||
|
for (int i = 0; i < cur_len; i++) {
|
||||||
|
if (p->page_order[i] == NodePrefs::HPB_SHUTDOWN + 1) {
|
||||||
|
for (int j = i; j < cur_len - 1; j++) p->page_order[j] = p->page_order[j + 1];
|
||||||
|
p->page_order[--cur_len] = 0;
|
||||||
|
present &= ~(uint16_t)(1u << NodePrefs::HPB_SHUTDOWN);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int ri = 0; ri < (int)(sizeof(REQUIRED)/sizeof(REQUIRED[0])); ri++) {
|
||||||
|
uint8_t bit = REQUIRED[ri];
|
||||||
if (!(present & (uint16_t)(1u << bit)) && cur_len < NodePrefs::PAGE_ORDER_LEN)
|
if (!(present & (uint16_t)(1u << bit)) && cur_len < NodePrefs::PAGE_ORDER_LEN)
|
||||||
p->page_order[cur_len++] = bit + 1;
|
p->page_order[cur_len++] = bit + 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user