From 4a6bbdb075a5e4f9910cb9b85e615ff8c50aa4ec Mon Sep 17 00:00:00 2001 From: Luke Hoersten Date: Sun, 14 Jun 2026 18:16:46 -0500 Subject: Drop VIEWPORT_STATE_UNCONFIGURED — state is just awake/asleep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit \`state\` now reports only the screen's runtime state (awake or asleep). Whether a viewport is set up to talk to Scrypted is a separate \`configured\` flag, derived from \`viewport_name && scrypted_url\`. There's no third state. Behaviour changes: - POST /state always succeeds; the previous 409 "device unconfigured" path is gone. The screen toggles regardless of /config status. - POST /config now sets \`configured\` directly from the derived predicate instead of mutating the state enum. - Outbound state-client POST to Scrypted is still gated on a scrypted URL being present — that's the only thing the configured flag now actually controls in the runtime path. GET /state JSON unchanged in shape, but \`state\` is now never "unconfigured" — that's reported through the existing \`configured\` boolean instead. --- main/state_machine.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'main/state_machine.h') diff --git a/main/state_machine.h b/main/state_machine.h index 8caf670..22aebad 100644 --- a/main/state_machine.h +++ b/main/state_machine.h @@ -6,7 +6,6 @@ esp_err_t state_machine_init(void); // Transition to AWAKE or ASLEEP. Idempotent: no-op if already there. -// Returns ESP_ERR_INVALID_STATE if the device is unconfigured. // Side-effects (under one critical section): // AWAKE -> backlight on, idle timer (re)armed // ASLEEP -> backlight off, idle timer cancelled, framebuffer discarded @@ -14,8 +13,8 @@ esp_err_t state_machine_set(viewport_run_state_t target); // Device-initiated variant (tap, idle timer expiry). Drives the same // transition as state_machine_set() and additionally enqueues a -// {viewport,state} POST to /state via state_client. -// Silently no-ops if the device is unconfigured. +// {viewport,state} POST to /state via state_client when a +// `scrypted` URL is configured. void state_machine_set_local(viewport_run_state_t target); // Called by /frame after a successful paint. Restarts the idle timer -- cgit v1.2.3