refactor(companion): drop one-time prefs-migration cruft, fix stale Msg wake comments

loadPrefsInt()'s "sentinel mismatch" block had accumulated ~62 lines of
one-shot backfills tied to specific old NodePrefs::SCHEMA_SENTINEL values
(favourites/map home-page bits, split bot-command toggles, trail_units_idx,
bot_trigger_ch seed, scope mask/index zeroing). Reduce it to just the
sentinel read + mismatch log line -- an upgrade from a version old enough
to hit any of these now lands on today's plain defaults for that field
instead of a silently-seeded value, same outcome a fresh device already
gets. The ongoing per-field range clamps (defensive against any corrupt or
out-of-range byte, not version-specific) are untouched.

Same treatment for DataStore::loadScopeList()'s one-time synthesis of a
scope-list entry from the old single default_scope_name/key field: removed,
along with the scope_migrated_legacy plumbing in MyMesh::begin() that only
ran once that migration had just fired. loadScopeList() drops its now-
unused NodePrefs parameter and bool return.

Also trimmed ~25 per-field comments that over-specified which exact old
sentinel produced which stray byte, down to what the clamp actually
defends against -- except where the hex value explained a genuinely
non-obvious byte-aliasing interaction, which stays. One comment (scope
mask/index) was flagged and rewritten because it described the very
zeroing logic this change removes.

Drive-by: two comments still said Settings > Sound > "Msg wake" -- it's
been under Settings > Display for a while, per the enum's section grouping
in SettingsScreen.h.

Verified: sim_companion_radio and WioTrackerL1_companion_solo_dual build
clean, RAM/Flash usage unchanged (pure logic removal, no schema/layout
change).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-09-17 15:41:26 +02:00
co-authored by Claude Sonnet 5
parent 95e3cf2618
commit eed6d31d42
5 changed files with 111 additions and 235 deletions
+4 -14
View File
@@ -46,20 +46,10 @@ public:
// deleted slot is simply absent from the file, not written as empty).
bool loadChannels(DataStoreHost* host);
void saveChannels(DataStoreHost* host);
// /scopes1: the shared named-scope list (see ScopeList.h). `prefs` is only
// read, for a one-time migration of a pre-existing single
// default_scope_name/key into list entry 1 -- the file is authoritative
// once it exists.
//
// Returns true ONLY when that legacy migration just ran, i.e. this boot is
// the first on a device that had a Scope configured the old way. The caller
// uses that to seed the channels that already exist with the migrated entry
// (see MyMesh::begin) -- channels carry their own scope now, so without the
// seed an upgrader's channel traffic would silently drop to unscoped even
// though their DMs kept the old scope. Returns false when /scopes1 was
// already there, and on a genuinely fresh device with nothing to migrate
// (list left empty, default_idx 0 == "*").
bool loadScopeList(ScopeList& list, const NodePrefs& prefs);
// /scopes1: the shared named-scope list (see ScopeList.h). A device with no
// file yet just starts with the default-constructed ScopeList (empty,
// default_idx 0 == "*").
void loadScopeList(ScopeList& list);
void saveScopeList(const ScopeList& list);
void migrateToSecondaryFS();
uint8_t getBlobByKey(const uint8_t key[], int key_len, uint8_t dest_buf[]);