Display quick fixes: instant screen switches, deferred NVS saves, dark OTA writes, version label
Firmware / build (push) Successful in 4m30s
Firmware / build (push) Successful in 4m30s
- screen switches use LV_SCR_LOAD_ANIM_NONE: full-screen fades were re-rendered and blended in software every frame and stuttered at 1024x600 - Tunables: NVS write 3 s after the last change or on leaving the Tuning screen (Tunables::flush()), not per tap - each flash write flickers the RGB panel - OTA: backlight off while the image is written, with full-screen notices before and after; tunables flushed before any reboot - firmware version shown bottom-right on every screen (lv_layer_top) - docs: CLAUDE.md, wiki ota-updates, open-questions #13, log Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -43,6 +43,18 @@ static void save() {
|
||||
prefs.end();
|
||||
}
|
||||
|
||||
// Every flash write briefly stalls the PSRAM-fed RGB panel (flicker), so edits
|
||||
// are applied + pushed to B at once but written to NVS only after the user
|
||||
// stops tapping (SAVE_IDLE_MS), on leaving the Tuning screen, or before reboot.
|
||||
static const uint32_t SAVE_IDLE_MS = 3000;
|
||||
static bool g_dirty = false;
|
||||
static uint32_t g_dirty_ms = 0;
|
||||
|
||||
static void markDirty() { // call with the mutex held
|
||||
g_dirty = true;
|
||||
g_dirty_ms = millis();
|
||||
}
|
||||
|
||||
static bool load() {
|
||||
Preferences prefs;
|
||||
prefs.begin(NVS_NAMESPACE, true);
|
||||
@@ -113,7 +125,7 @@ static bool setField(const char* name, long v) {
|
||||
if (ok) {
|
||||
g_cfg.cfg_version++;
|
||||
if (g_cfg.cfg_version == 0) g_cfg.cfg_version = 1;
|
||||
save();
|
||||
markDirty();
|
||||
}
|
||||
unlock();
|
||||
return ok;
|
||||
@@ -159,7 +171,7 @@ void set(const link_config_t& cfg) {
|
||||
uint8_t v = g_cfg.cfg_version + 1;
|
||||
g_cfg = cfg;
|
||||
g_cfg.cfg_version = v ? v : 1;
|
||||
save();
|
||||
markDirty();
|
||||
unlock();
|
||||
}
|
||||
|
||||
@@ -168,7 +180,7 @@ void resetDefaults() {
|
||||
uint8_t v = g_cfg.cfg_version + 1;
|
||||
link_config_defaults(&g_cfg);
|
||||
g_cfg.cfg_version = v ? v : 1;
|
||||
save();
|
||||
markDirty();
|
||||
unlock();
|
||||
}
|
||||
|
||||
@@ -203,7 +215,7 @@ bool handleCommand(const char* line) {
|
||||
if (!strcmp(argv[1], "set") && argc == 4) {
|
||||
long v = strtol(argv[3], NULL, 0);
|
||||
if (setField(argv[2], v)) {
|
||||
print("[cfg] %s = %ld (version %u, saved)", argv[2], v, version());
|
||||
print("[cfg] %s = %ld (version %u, saved to NVS in 3 s)", argv[2], v, version());
|
||||
} else {
|
||||
print("[cfg] unknown field '%s'", argv[2]);
|
||||
help();
|
||||
@@ -247,7 +259,18 @@ void setExtraCommandHandler(bool (*handler)(const char* line)) {
|
||||
g_extra_handler = handler;
|
||||
}
|
||||
|
||||
void flush() {
|
||||
lock();
|
||||
if (g_dirty) {
|
||||
save();
|
||||
g_dirty = false;
|
||||
}
|
||||
unlock();
|
||||
}
|
||||
|
||||
void pollSerial() {
|
||||
if (g_dirty && millis() - g_dirty_ms > SAVE_IDLE_MS) flush();
|
||||
|
||||
while (Serial.available()) {
|
||||
char c = (char)Serial.read();
|
||||
if (c == '\r' || c == '\n') {
|
||||
|
||||
Reference in New Issue
Block a user