mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-28 15:58:12 +00:00
feat(eink): full refresh interval setting in Settings › Display
Add "Full rfsh" setting (e-ink only) with options off/5/10/20/30 partial refreshes between full refreshes. Prevents ghosting on panels that accumulate artifacts after many partial updates. GxEPDDisplay counts partial refreshes and calls display.display(false) every N frames when the interval is set. Persisted in DataStore and applied at startup via applyFullRefreshInterval(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -295,6 +295,7 @@ void DataStore::loadPrefsInt(const char *filename, NodePrefs& _prefs, double& no
|
||||
rd(&_prefs.display_rotation, sizeof(_prefs.display_rotation));
|
||||
rd(_prefs.page_order, sizeof(_prefs.page_order));
|
||||
rd(&_prefs.joystick_rotation, sizeof(_prefs.joystick_rotation));
|
||||
rd(&_prefs.eink_full_refresh_every, sizeof(_prefs.eink_full_refresh_every));
|
||||
|
||||
file.close();
|
||||
}
|
||||
@@ -374,6 +375,7 @@ void DataStore::savePrefs(const NodePrefs& _prefs, double node_lat, double node_
|
||||
file.write((uint8_t *)&_prefs.display_rotation, sizeof(_prefs.display_rotation));
|
||||
file.write((uint8_t *)_prefs.page_order, sizeof(_prefs.page_order));
|
||||
file.write((uint8_t *)&_prefs.joystick_rotation, sizeof(_prefs.joystick_rotation));
|
||||
file.write((uint8_t *)&_prefs.eink_full_refresh_every, sizeof(_prefs.eink_full_refresh_every));
|
||||
|
||||
file.close();
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@ struct NodePrefs { // persisted to file
|
||||
// 0 = end of list (also uninitialized legacy). hasCustomOrder iff page_order[0] in 1..11.
|
||||
uint8_t page_order[11];
|
||||
uint8_t joystick_rotation; // 0-3 steps CW; independent of display_rotation
|
||||
uint8_t eink_full_refresh_every; // index into {0,5,10,20,30}: full refresh every N partials (0=off)
|
||||
|
||||
// Bitmasks for home_pages_mask (bit=1 → page visible; 0 field = all visible).
|
||||
static const uint16_t HP_CLOCK = 1 << 0;
|
||||
|
||||
@@ -26,6 +26,9 @@ class SettingsScreen : public UIScreen {
|
||||
#endif
|
||||
#if defined(EINK_DISPLAY_MODEL)
|
||||
JOY_ROTATION,
|
||||
#endif
|
||||
#if defined(EINK_DISPLAY_MODEL)
|
||||
EINK_FULL_REFRESH,
|
||||
#endif
|
||||
// Sound section
|
||||
SECTION_SOUND,
|
||||
@@ -85,6 +88,10 @@ class SettingsScreen : public UIScreen {
|
||||
static const int LOW_BAT_COUNT = 7;
|
||||
static const char* BATT_DISPLAY_LABELS[3];
|
||||
static const int BATT_DISPLAY_COUNT = 3;
|
||||
#if defined(EINK_DISPLAY_MODEL)
|
||||
static const char* EINK_FULL_REFRESH_LABELS[5];
|
||||
static const int EINK_FULL_REFRESH_COUNT = 5;
|
||||
#endif
|
||||
|
||||
int lowBatIndex() {
|
||||
NodePrefs* p = _task->getNodePrefs();
|
||||
@@ -438,6 +445,14 @@ class SettingsScreen : public UIScreen {
|
||||
{ static const char* ROT_LABELS[] = { "0 deg", "90 deg", "180 deg", "270 deg" };
|
||||
uint8_t r = p ? (p->joystick_rotation & 3) : 0;
|
||||
display.print(ROT_LABELS[r]); }
|
||||
#endif
|
||||
#if defined(EINK_DISPLAY_MODEL)
|
||||
} else if (item == EINK_FULL_REFRESH) {
|
||||
display.print("Full rfsh");
|
||||
display.setCursor(display.valCol(), y);
|
||||
{ uint8_t idx = p ? p->eink_full_refresh_every : 0;
|
||||
if (idx >= EINK_FULL_REFRESH_COUNT) idx = 0;
|
||||
display.print(EINK_FULL_REFRESH_LABELS[idx]); }
|
||||
#endif
|
||||
} else if (item == DM_FILTER) {
|
||||
display.print("DM");
|
||||
@@ -669,6 +684,17 @@ public:
|
||||
_dirty = true;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#if defined(EINK_DISPLAY_MODEL)
|
||||
if (_selected == EINK_FULL_REFRESH && p && (left || right || enter)) {
|
||||
int idx = p->eink_full_refresh_every;
|
||||
if (idx >= EINK_FULL_REFRESH_COUNT) idx = 0;
|
||||
idx = (idx + (left ? EINK_FULL_REFRESH_COUNT - 1 : 1)) % EINK_FULL_REFRESH_COUNT;
|
||||
p->eink_full_refresh_every = idx;
|
||||
_task->applyFullRefreshInterval();
|
||||
_dirty = true;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
if (_selected == DM_FILTER && p && (left || right || enter)) {
|
||||
p->dm_show_all = p->dm_show_all ? 0 : 1;
|
||||
@@ -702,3 +728,6 @@ const char* SettingsScreen::GPS_INTERVAL_LABELS[6] = { "off", "30s", "1min",
|
||||
const uint16_t SettingsScreen::LOW_BAT_OPTS[7] = { 0, 3000, 3100, 3200, 3300, 3400, 3500 };
|
||||
const char* SettingsScreen::LOW_BAT_LABELS[7] = { "off", "3.0V", "3.1V", "3.2V", "3.3V", "3.4V", "3.5V" };
|
||||
const char* SettingsScreen::BATT_DISPLAY_LABELS[3] = { "icon", "%", "V" };
|
||||
#if defined(EINK_DISPLAY_MODEL)
|
||||
const char* SettingsScreen::EINK_FULL_REFRESH_LABELS[5] = { "off", "5", "10", "20", "30" };
|
||||
#endif
|
||||
|
||||
@@ -903,6 +903,7 @@ void UITask::begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* no
|
||||
applyBrightness();
|
||||
applyFont();
|
||||
applyRotation();
|
||||
applyFullRefreshInterval();
|
||||
setCurrScreen(splash);
|
||||
}
|
||||
|
||||
@@ -1662,6 +1663,16 @@ void UITask::applyRotation() {
|
||||
}
|
||||
}
|
||||
|
||||
void UITask::applyFullRefreshInterval() {
|
||||
if (_display != NULL && _node_prefs != NULL) {
|
||||
static const uint8_t OPTS[] = { 0, 5, 10, 20, 30 };
|
||||
static const int OPTS_COUNT = 5;
|
||||
uint8_t idx = _node_prefs->eink_full_refresh_every;
|
||||
if (idx >= OPTS_COUNT) idx = 0;
|
||||
_display->setFullRefreshInterval(OPTS[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
void UITask::setBrightnessLevel(uint8_t level) {
|
||||
if (_node_prefs == NULL) return;
|
||||
if (level > 4) level = 4;
|
||||
|
||||
@@ -161,6 +161,7 @@ public:
|
||||
void applyGPSInterval();
|
||||
void applyFont();
|
||||
void applyRotation();
|
||||
void applyFullRefreshInterval();
|
||||
uint32_t autoOffMillis() const {
|
||||
if (!_node_prefs || _node_prefs->auto_off_secs == 0) return 0;
|
||||
return (uint32_t)_node_prefs->auto_off_secs * 1000UL;
|
||||
|
||||
Reference in New Issue
Block a user