feat(eink): suppress clock seconds to prevent per-second panel refreshes

E-ink panels take ~2 s for a full refresh and visible flicker on every update.
Showing seconds caused the clock page to redraw every 1 s, triggering a real
panel refresh each time the CRC changed.

- Default clock_hide_seconds=1 for EINK_DISPLAY_MODEL builds so fresh
  installs don't flicker out of the box.
- Remove the Seconds setting from SettingsScreen on e-ink so users can't
  accidentally re-enable it.
- Clock page now returns 60 s refresh interval on e-ink (content changes at
  most once per minute); other home pages capped at 30 s (new messages still
  force immediate redraw via notify()).
- Lock screen refresh interval raised from 1 s to 60 s on e-ink; button
  presses already reset _next_refresh=0, so unlock feedback is instant.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-05-22 10:47:19 +02:00
parent 6a3b8e3135
commit 33ad70221e
3 changed files with 18 additions and 0 deletions

View File

@@ -952,6 +952,9 @@ MyMesh::MyMesh(mesh::Radio &radio, mesh::RNG &rng, mesh::RTCClock &rtc, SimpleMe
_prefs.dm_show_all = 1; // show all contacts by default
memset(_prefs.dm_notif, 0, sizeof(_prefs.dm_notif));
_prefs.auto_off_secs = 15; // 15 seconds auto-off by default
#ifdef EINK_DISPLAY_MODEL
_prefs.clock_hide_seconds = 1; // e-ink: seconds cause a panel refresh every second
#endif
_prefs.tz_offset_hours = 0; // UTC by default
_prefs.low_batt_mv = 3400; // auto-shutdown at 3.4V by default
_prefs.batt_display_mode = 0; // icon by default

View File

@@ -12,7 +12,9 @@ class SettingsScreen : public UIScreen {
AUTO_OFF,
AUTO_LOCK,
BATT_DISPLAY,
#if !defined(EINK_DISPLAY_MODEL)
CLOCK_SECONDS,
#endif
CLOCK_FORMAT,
FONT,
#if defined(EINK_DISPLAY_MODEL)
@@ -312,10 +314,12 @@ class SettingsScreen : public UIScreen {
display.setCursor(VAL_X, y);
uint8_t mode = p ? p->batt_display_mode : 0;
display.print(BATT_DISPLAY_LABELS[mode < BATT_DISPLAY_COUNT ? mode : 0]);
#if !defined(EINK_DISPLAY_MODEL)
} else if (item == CLOCK_SECONDS) {
display.print("Seconds");
display.setCursor(VAL_X, y);
display.print((p && p->clock_hide_seconds) ? "OFF" : "ON");
#endif
} else if (item == CLOCK_FORMAT) {
display.print("Format");
display.setCursor(VAL_X, y);
@@ -512,11 +516,13 @@ public:
if (left) idx = (idx + BATT_DISPLAY_COUNT - 1) % BATT_DISPLAY_COUNT;
if (left || right) { p->batt_display_mode = idx; _dirty = true; return true; }
}
#if !defined(EINK_DISPLAY_MODEL)
if (_selected == CLOCK_SECONDS && p && (left || right || enter)) {
p->clock_hide_seconds ^= 1;
_dirty = true;
return true;
}
#endif
if (_selected == CLOCK_FORMAT && p && (left || right || enter)) {
p->clock_12h ^= 1;
_dirty = true;

View File

@@ -692,11 +692,16 @@ public:
}
}
bool auto_adv = _node_prefs && _node_prefs->advert_auto_interval_sec > 0;
#ifdef EINK_DISPLAY_MODEL
if (_page == HomePage::CLOCK) return 60000; // no seconds on e-ink; content changes at most every minute
return 30000; // e-ink: limit base polling; new messages still force immediate refresh via notify()
#else
if (_page == HomePage::CLOCK) {
bool show_sec = !_node_prefs || !_node_prefs->clock_hide_seconds;
return auto_adv ? 1000 : (show_sec ? 1000 : 60000);
}
return auto_adv ? 1000 : 5000;
#endif
}
bool handleInput(char c) override {
@@ -1399,7 +1404,11 @@ void UITask::loop() {
_display->setCursor(hx, hy);
_display->print(hint);
_display->endFrame();
#ifdef EINK_DISPLAY_MODEL
_next_refresh = millis() + 60000;
#else
_next_refresh = millis() + 1000;
#endif
} else if (!_locked && millis() >= _next_refresh && curr) {
_display->startFrame();
int delay_millis = curr->render(*_display);