feat(rlcd): runtime font size selector in Settings->Display
- device.properties bump default to 20 - lvgl_fonts add runtime override API (g_runtime_font_size + externs for all Montserrat sizes) - DisplaySettings add fontSize field persisted in properties - Display app adds Font size dropdown 14-28 applying immediately - Lvgl.cpp applies saved runtime font on boot - device.py new bucket <=20 includes all fonts for runtime switching (~150KB) Co-authored-by: internal-model
This commit is contained in:
@@ -25,6 +25,7 @@ constexpr auto* SETTINGS_KEY_SCREENSAVER_TYPE = "screensaverType";
|
||||
constexpr auto* SETTINGS_KEY_DISABLE_WHEN_CHARGING = "disableScreensaverWhenCharging";
|
||||
constexpr auto* SETTINGS_KEY_INVERT_COLOR = "invertColor";
|
||||
constexpr auto* SETTINGS_KEY_MONO_THRESHOLD = "monochromeThreshold";
|
||||
constexpr auto* SETTINGS_KEY_FONT_SIZE = "fontSize";
|
||||
|
||||
static Orientation getDefaultOrientation() {
|
||||
auto* display = lv_display_get_default();
|
||||
@@ -187,6 +188,14 @@ bool load(DisplaySettings& settings) {
|
||||
if (mono_thresh > 255) mono_thresh = 255;
|
||||
}
|
||||
|
||||
int font_size = 0;
|
||||
auto font_entry = map.find(SETTINGS_KEY_FONT_SIZE);
|
||||
if (font_entry != map.end()) {
|
||||
font_size = atoi(font_entry->second.c_str());
|
||||
if (font_size < 0) font_size = 0;
|
||||
if (font_size > 36) font_size = 36;
|
||||
}
|
||||
|
||||
settings.orientation = orientation;
|
||||
settings.gammaCurve = gamma_curve;
|
||||
settings.backlightDuty = backlight_duty;
|
||||
@@ -196,6 +205,7 @@ bool load(DisplaySettings& settings) {
|
||||
settings.disableScreensaverWhenCharging = disable_when_charging;
|
||||
settings.invertColor = invert_color;
|
||||
settings.monochromeThreshold = static_cast<uint8_t>(mono_thresh);
|
||||
settings.fontSize = static_cast<uint8_t>(font_size);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -210,7 +220,8 @@ DisplaySettings getDefault() {
|
||||
.screensaverType = ScreensaverType::BouncingBalls,
|
||||
.disableScreensaverWhenCharging = false,
|
||||
.invertColor = true,
|
||||
.monochromeThreshold = 60
|
||||
.monochromeThreshold = 60,
|
||||
.fontSize = 0
|
||||
};
|
||||
}
|
||||
|
||||
@@ -233,6 +244,7 @@ bool save(const DisplaySettings& settings) {
|
||||
map[SETTINGS_KEY_DISABLE_WHEN_CHARGING] = settings.disableScreensaverWhenCharging ? "1" : "0";
|
||||
map[SETTINGS_KEY_INVERT_COLOR] = settings.invertColor ? "1" : "0";
|
||||
map[SETTINGS_KEY_MONO_THRESHOLD] = std::to_string(settings.monochromeThreshold);
|
||||
map[SETTINGS_KEY_FONT_SIZE] = std::to_string(settings.fontSize);
|
||||
auto settings_path = getSettingsFilePath();
|
||||
if (!file::findOrCreateParentDirectory(settings_path, 0755)) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user