feat: thinner border (4 px) and serial logging on border / recovery events
- BORDER_THICKNESS_PX: 16 -> 4. Hardware-tested at 4 px on both yellow and red; yellow appears slightly thicker due to the irradiation illusion (perception, not a rendering issue) — not compensating per color absent an explicit request. - Add Serial.println at every state transition that touches the err_border lifecycle: schema migration firing, sync-fail else branch (with HTTP code, distinguishing border vs full-fill fallback), 304 recovery (with which flags triggered it), and recovery completion / abort. Lets us trace why a frame is or isn't showing a border via pio device monitor without needing to instrument anew each time. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -38,7 +38,7 @@
|
|||||||
#define NVS_SCHEMA_VERSION 1
|
#define NVS_SCHEMA_VERSION 1
|
||||||
|
|
||||||
// Width of the sync-fail / no-WiFi border, in pixels.
|
// Width of the sync-fail / no-WiFi border, in pixels.
|
||||||
#define BORDER_THICKNESS_PX 16
|
#define BORDER_THICKNESS_PX 4
|
||||||
|
|
||||||
// ── Network ──────────────────────────────────────────────────────────────────
|
// ── Network ──────────────────────────────────────────────────────────────────
|
||||||
#define APP_BASE_URL "https://pictureframe.edholm.me"
|
#define APP_BASE_URL "https://pictureframe.edholm.me"
|
||||||
|
|||||||
@@ -77,6 +77,8 @@ void normal_operation_impl(const String& mac, HTTP& http, const String& url, Pre
|
|||||||
// by treating this boot as if errBorder were set, then bump schema_v so
|
// by treating this boot as if errBorder were set, then bump schema_v so
|
||||||
// it doesn't fire again.
|
// it doesn't fire again.
|
||||||
if (schemaV < NVS_SCHEMA_VERSION) {
|
if (schemaV < NVS_SCHEMA_VERSION) {
|
||||||
|
Serial.println(String("[op] schema migration v") + String(schemaV) + " -> v" +
|
||||||
|
String(NVS_SCHEMA_VERSION) + ", forcing one-shot recovery redraw");
|
||||||
errBorder = true;
|
errBorder = true;
|
||||||
prefs.begin(NVS_NAMESPACE, false);
|
prefs.begin(NVS_NAMESPACE, false);
|
||||||
prefs.putInt(NVS_KEY_SCHEMA_V, NVS_SCHEMA_VERSION);
|
prefs.putInt(NVS_KEY_SCHEMA_V, NVS_SCHEMA_VERSION);
|
||||||
@@ -135,6 +137,9 @@ void normal_operation_impl(const String& mac, HTTP& http, const String& url, Pre
|
|||||||
// (drawNeeded), or a sync-fail border is currently on screen and the
|
// (drawNeeded), or a sync-fail border is currently on screen and the
|
||||||
// server is healthy again (errBorder) — repaint clean to clear it.
|
// server is healthy again (errBorder) — repaint clean to clear it.
|
||||||
if (drawNeeded || errBorder) {
|
if (drawNeeded || errBorder) {
|
||||||
|
Serial.println(String("[op] 304 with recovery flags (drawNeeded=") +
|
||||||
|
String((int)drawNeeded) + " errBorder=" +
|
||||||
|
String((int)errBorder) + ") -> repainting clean from /img.bin");
|
||||||
File r = LittleFS.open(IMAGE_PATH, "r");
|
File r = LittleFS.open(IMAGE_PATH, "r");
|
||||||
if (r) {
|
if (r) {
|
||||||
displayInitialized = true;
|
displayInitialized = true;
|
||||||
@@ -145,6 +150,9 @@ void normal_operation_impl(const String& mac, HTTP& http, const String& url, Pre
|
|||||||
prefs.putInt(NVS_KEY_DRAW_NEEDED, 0);
|
prefs.putInt(NVS_KEY_DRAW_NEEDED, 0);
|
||||||
prefs.putInt(NVS_KEY_ERR_BORDER, 0);
|
prefs.putInt(NVS_KEY_ERR_BORDER, 0);
|
||||||
prefs.end();
|
prefs.end();
|
||||||
|
Serial.println("[op] recovery redraw complete; flags cleared");
|
||||||
|
} else {
|
||||||
|
Serial.println("[op] recovery aborted: /img.bin not in LittleFS");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (code == 204) {
|
} else if (code == 204) {
|
||||||
@@ -167,9 +175,13 @@ void normal_operation_impl(const String& mac, HTTP& http, const String& url, Pre
|
|||||||
epd_init();
|
epd_init();
|
||||||
File r = LittleFS.open(IMAGE_PATH, "r");
|
File r = LittleFS.open(IMAGE_PATH, "r");
|
||||||
if (r) {
|
if (r) {
|
||||||
|
Serial.println(String("[op] sync fail code=") + String(code) +
|
||||||
|
" -> drawing image with yellow border");
|
||||||
epd_draw_image_with_border(r, COLOR_YELLOW, BORDER_THICKNESS_PX);
|
epd_draw_image_with_border(r, COLOR_YELLOW, BORDER_THICKNESS_PX);
|
||||||
r.close();
|
r.close();
|
||||||
} else {
|
} else {
|
||||||
|
Serial.println(String("[op] sync fail code=") + String(code) +
|
||||||
|
" -> no cached image, falling back to full yellow fill");
|
||||||
epd_fill(COLOR_YELLOW);
|
epd_fill(COLOR_YELLOW);
|
||||||
}
|
}
|
||||||
prefs.begin(NVS_NAMESPACE, false);
|
prefs.begin(NVS_NAMESPACE, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user