fix(prefs): bump schema sentinel for keyboard_type field (PR #21)

keyboard_type was inserted into the append-only NodePrefs layout without
bumping SCHEMA_SENTINEL, leaving it at 0xC0DE0019 — the same value plain
main already uses without this field. A device already on that schema
would silently misalign every field read after alarm_min once updated
to a build containing this change. Bump to 0xC0DE001A and fix the
migration comment's stale version label (it said 0xC0DE0018, which was
already taken by the MAP home-page migration).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-07-02 18:02:48 +02:00
parent 5ed0a05265
commit b576de75b6
2 changed files with 3 additions and 2 deletions

View File

@@ -428,7 +428,8 @@ void DataStore::loadPrefsInt(const char *filename, NodePrefs& _prefs, double& no
if (_prefs.alarm_on > 1) _prefs.alarm_on = 0;
if (_prefs.alarm_hour > 23) _prefs.alarm_hour = 0;
if (_prefs.alarm_min > 59) _prefs.alarm_min = 0;
// → 0xC0DE0018: keyboard type (QWERTY/T9).
// → 0xC0DE001A: keyboard type (QWERTY/T9). Pre-0x1A files leave stray sentinel
// tail bytes here; clamp back to the QWERTY default (0).
rd(&_prefs.keyboard_type, sizeof(_prefs.keyboard_type));
if (_prefs.keyboard_type > 1) _prefs.keyboard_type = 0;
// Pre-0x10 files leave stray sentinel bytes here, same as a never-configured

View File

@@ -351,7 +351,7 @@ struct NodePrefs { // persisted to file
// adding/removing/reordering fields in DataStore::savePrefs/loadPrefsInt so
// older saves are detected on load and skipped (zero-init defaults kept).
// High 24 bits identify the file format; low byte is the schema revision.
static const uint32_t SCHEMA_SENTINEL = 0xC0DE0019;
static const uint32_t SCHEMA_SENTINEL = 0xC0DE001A;
// Bit-index for each home page. Used by page_order (entries store bit+1) and
// by home_pages_mask. Single source of truth — both HomeScreen::pageBit/bitToPage