mod: Phase 2a - add mod settings, I18n strings, and main.cpp integration
CrossPointSettings: Add mod-specific enums and fields: - Clock: CLOCK_FORMAT, CLOCK_SIZE, TIMEZONE, clockFormat, clockSize, timezone, timezoneOffsetHours, autoNtpSync - Sleep: SLEEP_SCREEN_LETTERBOX_FILL, sleepScreenLetterboxFill - Reader: preferredPortrait, preferredLandscape - Indexing: INDEXING_DISPLAY, indexingDisplay - getTimezonePosixStr() for POSIX TZ string generation main.cpp: Integrate mod initialization: - OPDS store loading, boot NTP sync, timezone application - Clock refresh loop (re-render on minute change) - RTC time logging on boot SettingsList.h: Add clock, timezone, and letterbox fill settings JsonSettingsIO.cpp: Handle int8_t timezoneOffsetHours separately I18n: Add ~80 mod string keys (english.yaml + regenerated I18nKeys.h) Made-with: Cursor
This commit is contained in:
@@ -121,6 +121,9 @@ bool JsonSettingsIO::saveSettings(const CrossPointSettings& s, const char* path)
|
||||
doc["frontButtonLeft"] = s.frontButtonLeft;
|
||||
doc["frontButtonRight"] = s.frontButtonRight;
|
||||
|
||||
// Mod: timezone offset is int8_t, not uint8_t — handled separately
|
||||
doc["timezoneOffsetHours"] = s.timezoneOffsetHours;
|
||||
|
||||
String json;
|
||||
serializeJson(doc, json);
|
||||
return Storage.writeFile(path, json);
|
||||
@@ -200,6 +203,11 @@ bool JsonSettingsIO::loadSettings(CrossPointSettings& s, const char* json, bool*
|
||||
clamp(doc["frontButtonRight"] | (uint8_t)S::FRONT_HW_RIGHT, S::FRONT_BUTTON_HARDWARE_COUNT, S::FRONT_HW_RIGHT);
|
||||
CrossPointSettings::validateFrontButtonMapping(s);
|
||||
|
||||
// Mod: timezone offset is int8_t, not uint8_t
|
||||
s.timezoneOffsetHours = doc["timezoneOffsetHours"] | (int8_t)0;
|
||||
if (s.timezoneOffsetHours < -12) s.timezoneOffsetHours = -12;
|
||||
if (s.timezoneOffsetHours > 14) s.timezoneOffsetHours = 14;
|
||||
|
||||
LOG_DBG("CPS", "Settings loaded from file");
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user