refactor(eink): Text size and Icon size as schema settings, on opt-in builds only

Review follow-up:

- The rows exist only where the build asks for them: Text size with
  EINK_FONT_SCALE, Icon size with STATUS_ICON_SCALE. The stock 2.13", the
  portrait builds and the L2 don't get them -- their screens are laid out
  for one cell size. The text override also applies in landscape only.
- Stored in NodePrefs (ui_text_scale, ui_icon_scale) instead of a
  /ui_scale file, as rows in the schema's Display section: the usual row,
  save path and factory reset, and console keys display.text.size /
  display.icon.size. The hand-written Settings rows and the load/save code
  are gone; UITask::applyUiScale() applies the prefs at boot and on change
  (applyDisplayPrefs). On opt-in builds ui_text_scale starts at the
  build's EINK_FONT_SCALE (DataStore sanitize), so the row shows the scale
  in use.
- EINK_FONT_SCALE, when set, now scales whichever landscape font the build
  picks (the 6x9, or the EINK_LARGE_FONT one); unset, it is stock as before.
- setUiScale() skips the re-layout and full redraw when nothing changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
pmow
2026-10-10 16:36:39 -10:00
co-authored by Claude Opus 5.5
parent c06b394144
commit 13531dd2ce
11 changed files with 74 additions and 114 deletions
+2 -10
View File
@@ -62,7 +62,6 @@ class UITask : public UITaskBase, public UiCoreHost {
unsigned long _next_refresh, _auto_off;
bool _display_was_on = true; // loop(): messagesInView() last time round
NodePrefs* _node_prefs;
uint8_t _ui_font_scale = 0; // Settings > Display > Text size (0 = build default)
bool _locked;
bool _tool_from_home = false;
bool messagesInView() const; // Messages on a lit, unlocked display
@@ -529,7 +528,7 @@ public:
void applyAllGpioModes(); // boot-time restore from NodePrefs, called from begin()
void applyBrightness();
// Settings changed through the schema (ui-core/SettingsSchema.h).
void applyDisplayPrefs() override { applyBrightness(); _next_refresh = 0; }
void applyDisplayPrefs() override { applyBrightness(); applyUiScale(); _next_refresh = 0; }
void applySoundPrefs() override;
bool cliCommand(const char* command, char* reply, int n) override;
void setBuzzerVolumeLevel(uint8_t level);
@@ -544,14 +543,7 @@ public:
bool savePrefsIfDirty(bool& dirty);
void applyRotation();
void applyFullRefreshInterval();
// Settings > Display > Text size / Icon size. Kept in their own /ui_scale
// file rather than NodePrefs, so the prefs schema (and its size assert) is untouched.
uint8_t getUiFontScale() const; // the text's current pixel scale
void setUiFontScale(uint8_t s); // 1..5: applies + saves
uint8_t getStatusIconScale() const; // 0 = Auto (1.5x text), else n
void setStatusIconScale(uint8_t s); // 0..8: applies + saves
void loadUiScale(); // boot-time restore, from begin()
void saveUiScale();
void applyUiScale(); // Settings > Display > Text size / Icon size, from the prefs
uint32_t autoOffMillis() const {
if (!_node_prefs || _node_prefs->auto_off_secs == 0) return 0;
return (uint32_t)_node_prefs->auto_off_secs * 1000UL;