fix(home-pages): stop Favourites re-enabling on update; add Map visibility toggle

The prefs schema-migration block runs on every SCHEMA_SENTINEL mismatch, and
the "turn Favourites on" step was ungated. Since each firmware release bumps
the sentinel, every update re-applied `home_pages_mask |= HP_FAVOURITES`,
clobbering a user who had hidden it. Gate it to the transition that added
Favourites (sentinel < 0xC0DE0002), matching the trail_units_idx migration.

The Map/Trail carousel page shipped with no visibility toggle: pageBit(MAP)
returned -1 so it was always visible with no Settings row. Add a proper "Map"
toggle (new HPB_MAP/HP_MAP bit, pageBit/bitToPage cases, HOME_MAP settings
row) plus a gated one-time migration (sentinel < 0xC0DE0018) that keeps it
visible for upgraders. Bump SCHEMA_SENTINEL to 0xC0DE0018; page_order[] stays
a literal 11 so the persisted layout is unchanged.

Also fix the fresh-install seed, which used a stale 0x01FF literal that left
Favourites hidden on new installs despite its "all pages visible" comment;
seed NodePrefs::HP_ALL so fresh installs match upgraders (Favourites + Map).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
MarekZegare4
2026-07-02 10:34:38 +02:00
parent 7e0dbe4afc
commit 088bbe61ba
5 changed files with 25 additions and 11 deletions

View File

@@ -1504,7 +1504,7 @@ MyMesh::MyMesh(mesh::Radio &radio, mesh::RNG &rng, mesh::RTCClock &rtc, SimpleMe
_prefs.ringtone2_bpm_idx = 2; // 120 bpm default
_prefs.notif_melody_ad = 0; // built-in advert sound by default
_prefs.advert_sound_scope = ADVERT_SOUND_SCOPE_ALL; // sound every advert by default
_prefs.home_pages_mask = 0x01FF; // all pages visible
_prefs.home_pages_mask = NodePrefs::HP_ALL; // all pages visible (incl. Favourites + Map)
_prefs.bot_enabled = 0;
_prefs.bot_channel_enabled = 0;
_prefs.bot_channel_idx = 0;