From 92cda972da3d1d8b6ed221687a1377765259f989 Mon Sep 17 00:00:00 2001 From: Luke Hoersten Date: Sat, 13 Jun 2026 20:24:06 -0500 Subject: Reorder milestones so Config Persistence comes before Frame/Wake/Sleep Previously M5 (Wake/Sleep + idle timer) and M4 (Frame) implicitly depended on NVS values (orientation, idle_timeout_ms) that did not exist until M6 (Config Persistence). Moving Config to M4 lets the downstream endpoints read their parameters from NVS instead of working around hardcoded defaults. New order: M1 Board Bring-Up M2 HTTP + mDNS M3 Display Bring-Up M4 Config Persistence (was M6) M5 JPEG Frame Push (was M4) M6 Wake/Sleep/Brightness (was M5) M7 Touch Callback M8 Local Screens + BOOT button M9 Live Stream (/stream) M4 now also validates orientation and idle_timeout_ms per spec, applies orientation immediately (mDNS TXT + /health reflect it), and establishes the brightness default (80) on first boot. M5's test image is 480x800 by default (portrait); switch to 800x480 if /config sets landscape. M6's idle timer reads idle_timeout_ms from NVS. --- ...Viewport-v2-Claude-Code-Implementation-Guide.md | 53 ++++++++++++---------- 1 file changed, 30 insertions(+), 23 deletions(-) (limited to 'Scrypted-Viewport-v2-Claude-Code-Implementation-Guide.md') diff --git a/Scrypted-Viewport-v2-Claude-Code-Implementation-Guide.md b/Scrypted-Viewport-v2-Claude-Code-Implementation-Guide.md index 69f53ac..ce6c178 100644 --- a/Scrypted-Viewport-v2-Claude-Code-Implementation-Guide.md +++ b/Scrypted-Viewport-v2-Claude-Code-Implementation-Guide.md @@ -781,15 +781,34 @@ Acceptance: Screen displays deterministic test pattern. ``` -### Milestone 4: JPEG Frame Push +### Milestone 4: Config Persistence -- Implement `/frame`. -- Receive JPEG body. -- Decode into framebuffer. -- Display full frame. +Done before any state-bearing endpoints so they can read values from NVS instead of working around hardcoded defaults. + +- Implement `/config` (display, callback, idle_timeout_ms, orientation). +- Validate per spec (non-empty display, http callback, idle_timeout = 0 or ≥ 5000, orientation in {portrait, landscape}). +- Persist all fields to NVS atomically. +- Apply orientation immediately (mDNS TXT and `/health` reflect it). +- Brightness defaults to 80 on first boot, persisted. Acceptance: +```bash +curl -X POST -H "Content-Type: application/json" \ + -d '{"display":"mudroom","callback":"http://host/cb","orientation":"landscape"}' \ + http://viewport.local/config +``` + +After reboot, `/health` shows `configured=true`, name preserved, `orientation=landscape`, `resolution=800x480`. + +### Milestone 5: JPEG Frame Push + +- Implement `/frame`. +- Receive JPEG body, decode into framebuffer, push to panel with current orientation applied. +- Expected dimensions = effective resolution from M4. + +Acceptance (default portrait, so test image is 480×800): + ```bash curl -X POST \ -H "Content-Type: image/jpeg" \ @@ -797,13 +816,13 @@ curl -X POST \ http://viewport.local/frame ``` -updates screen. +updates screen. Re-running with `landscape` set via `/config` requires an 800×480 test image. -### Milestone 5: Wake/Sleep/Brightness +### Milestone 6: Wake/Sleep/Brightness -- Implement `/wake`, `/sleep`, `/brightness`. -- Make `/frame` reject with `409` when asleep (no auto-wake). -- Add idle timer with 60s default; fires sleep + `sleep:timeout` callback (callback target is a no-op until M7). +- Implement `/wake`, `/sleep`, `/brightness` (persisted to NVS). +- Make `/frame` reject with `409` when asleep — no auto-wake. +- Add idle timer using `idle_timeout_ms` from NVS; on expiry, transition to sleep and POST `sleep:timeout` callback (callback target is a no-op until M7). Acceptance: @@ -812,19 +831,7 @@ curl -X POST http://viewport.local/sleep # backlight off curl -X POST http://viewport.local/wake # backlight on, loading screen ``` -`/frame` after `/sleep` returns 409. `/frame` after `/wake` paints. - -### Milestone 6: Config Persistence - -- Implement `/config`. -- Persist callback/name in NVS. -- Confirm survives reboot. - -Acceptance: - -```text -After reboot, /health shows configured=true and name preserved. -``` +`/frame` after `/sleep` returns 409. `/frame` after `/wake` paints. Brightness survives reboot. ### Milestone 7: Touch Callback -- cgit v1.2.3