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.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'main/state_machine.c') diff --git a/main/state_machine.c b/main/state_machine.c index 3d95308..a4d4dab 100644 --- a/main/state_machine.c +++ b/main/state_machine.c @@ -61,14 +61,14 @@ esp_err_t state_machine_set(viewport_run_state_t target) if (target == VIEWPORT_STATE_AWAKE) { if (display_is_up()) { display_wake(); - // Content choice: configured devices show "Loading…" until - // Scrypted pushes a /frame; unconfigured devices show the - // info screen since there's no Scrypted to push anything. + // Content choice: a configured device shows "Loading…" until + // Scrypted pushes a /frame; a device with no scrypted URL + // shows the info screen since there's no Scrypted to push. if (configured) local_screens_show_loading(); else local_screens_show_info(); } arm_idle_timer_unlocked(); - ESP_LOGI(TAG, "AWAKE (%s)", configured ? "configured" : "unconfigured"); + ESP_LOGI(TAG, "AWAKE (%s)", configured ? "configured" : "no scrypted URL"); } else { disarm_idle_timer(); if (display_is_up()) display_sleep(); @@ -89,8 +89,8 @@ void state_machine_set_local(viewport_run_state_t target) { esp_err_t err = state_machine_set(target); if (err != ESP_OK) return; - // Only POST when there's a Scrypted to talk to. Unconfigured tap toggles - // change the local display state without notifying anyone. + // Only POST when there's a Scrypted to talk to. Without a scrypted URL, + // tap toggles change the local display state without notifying anyone. viewport_state_lock(); bool configured = viewport_state_get()->configured; viewport_state_unlock(); -- cgit v1.2.3