fix(13e6): X-Draw-Pending recovery handshake + CDC serial routing

When drawNeeded survives a power-loss-mid-draw, send X-Draw-Pending: 1
on the next poll so the server suppresses rotation advancement (incl.
the X-Boot-Reason: cold force-resync) and returns the SAME image back.
Without this, cold-boot rotation defeats the existing 304-with-drawNeeded
recovery branch — the device chases a fresh image every reset and the
13.3 panel ends up showing torn frames as draws keep getting interrupted.

Also enable ARDUINO_USB_CDC_ON_BOOT=1 for the 13.3 env so Serial routes
through the S3's native USB-CDC (visible as the "Espressif USB JTAG
serial debug unit" ACM port when awake). Without this, Serial goes to
UART0, whose pins aren't wired to either USB endpoint on the 13.3E6
board — making firmware logs invisible over USB and forcing reliance
on server-side telemetry alone.

Adds two unit tests covering header-present-when-set and absent-when-clear.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-14 17:43:08 -04:00
parent e9f2ec0629
commit 3d7a793115
3 changed files with 57 additions and 0 deletions
+13
View File
@@ -160,6 +160,19 @@ void normal_operation_impl(const String& mac, HTTP& http, const String& url, Pre
http.addHeader("X-Just-Provisioned", "1");
}
// Recovery handshake: drawNeeded survives a power-loss-during-draw
// because we set it before kicking the e-ink refresh and only clear
// it after the panel finishes. Telling the server about it lets it
// suppress rotation advancement (including the X-Boot-Reason: cold
// force-resync) so we get the SAME image back and can repaint it
// from the cached /img.bin, instead of chasing a fresh image every
// time a draw resets. Without this, cold-boot rotation defeats the
// 304-with-drawNeeded recovery branch and the device churns through
// images, leaving torn frames on the panel.
if (drawNeeded) {
http.addHeader("X-Draw-Pending", "1");
}
const char* collectHeaders[] = { "X-Interval-Ms", "X-Image-Id", "X-Image-Sha256", "X-Claimed" };
http.collectHeaders(collectHeaders, 4);
int code = http.GET();