Fix shifted pictures: non-blocking Nano drawing, frame check, refresh settings

The Nano's periodic full redraw blocked for ~0.8 s. A frame that arrived
meanwhile overflowed its 64-byte serial buffer; lost bytes in a bitmap
shift the rest of the image (picture moved up), and diff frames never
repaired it.

- Nano: all drawing (frames, effects, the dot refresh) runs from update()
  in ~1 ms slices; the refresh pauses while a frame is received or shown
- New commands: C (reply with the image checksum) and I (refresh minutes,
  EEPROM)
- ESP32: NanoMonitor asks for the checksum after frames and sends the whole
  image again on a mismatch, missing answer or Nano restart; counts ERR
  replies. Periodic whole-image resync.
- Settings: "Dot refresh" and "Image resync" intervals (settings v5,
  v4 records are migrated)
- System tab: loop timing, free memory, frame check counts
- test_driver: the real driver against a simulated panel

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-10-16 15:20:26 +02:00
1 parent 58a7cb03c2
commit 090c2bf8ae
45 files changed
+1265 -157

No files matched your search

+13
View File
@@ -54,6 +54,18 @@ struct DriveSettings
bool effect_small_only = false; // big changes (a new page) appear instantly
};
// Full redraws that fix the picture, in minutes (0 = never)
const uint16_t REFRESH_MINUTES_MAX = 1440;
struct RefreshSettings
{
// The Nano flips every dot once more (fixes dots that didn't flip). Sent to the Nano,
// which keeps it in its EEPROM (I command, default there: 2).
uint16_t dots = 2;
// The ESP32 sends the whole image again (fixes a wrong image on the Nano, e.g. after
// lost bytes). Only the dots that differ flip, so a correct image doesn't change.
uint16_t image = 10;
};
// What is shown during the day: the name of a dynamic page (logic/page.h) or a bitmap.
// Both share one namespace. When it is gone, the built-in Clock page is shown.
#define DEFAULT_PAGE BUILTIN_PAGE_CLOCK
@@ -70,6 +82,7 @@ struct Settings
bool status_led = true;
char off_page[PAGE_NAME_SIZE] = OFF_PAGE_BLANK;
DriveSettings drive;
RefreshSettings refresh;
// New fields go here, at the end (see system/settings_store.cpp)
};