From 865c4859d710870245ae7954e729edcaf442a921 Mon Sep 17 00:00:00 2001 From: Luke Hoersten Date: Sun, 14 Jun 2026 20:11:21 -0500 Subject: Default name = MAC; brief wake on boot; drop dead touch defences MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Seed viewport_name with the full base MAC, colons stripped (e8:f6:0a:e0:90:94 → "e8f60ae09094"). Stable across reboots, globally unique, 12 alphanumeric chars — well inside the mDNS hostname limit even with the "viewport-" prefix. - Add a mac_str field to viewport_state and expose it as the new "mac" key in GET /state and as a "mac" line on the info screen. - "Configured" no longer requires a viewport_name (it always has the MAC default); the scrypted URL alone gates outbound POSTs and the loading-vs-info screen choice. - Strip viewport_name[0] fallbacks in http_api / mdns / local_screens now that the field is never empty. - Replace the wake-on-boot-stays-on behaviour with a ~600 ms flash followed by sleep — long enough for the FT5426 touch IC to come out of its initial unresponsive state, short enough that an idle device doesn't burn the backlight. - Drop the touch defensive cruft added when we were chasing a PoE-power theory: the DEV_MODE=0x00 write at init, the touch_reset_pulse() call at init, and the runtime wedge-self-heal in the polling loop didn't actually fix anything — the wake-on-boot flash did. Also delete the display_touch_reset_pulse() helper since it now has zero callers. --- main/nvs_config.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'main/nvs_config.c') diff --git a/main/nvs_config.c b/main/nvs_config.c index 7f7586c..8ba2078 100644 --- a/main/nvs_config.c +++ b/main/nvs_config.c @@ -58,20 +58,18 @@ esp_err_t nvs_config_load(void) err = ESP_OK; - // A device is "configured" only once both name and Scrypted URL are set. - if (st->viewport_name[0] && st->scrypted_url[0]) { - st->configured = true; - st->state = VIEWPORT_STATE_ASLEEP; // configured devices boot asleep - ESP_LOGI(TAG, "loaded config: viewport=%s scrypted=%s " - "idle_ms=%u orient=%s bright=%u", - st->viewport_name, st->scrypted_url, - (unsigned)st->idle_timeout_ms, - st->orientation == VIEWPORT_ORIENTATION_LANDSCAPE - ? "landscape" : "portrait", - st->brightness); - } else { - ESP_LOGI(TAG, "partial config in NVS — viewport or scrypted URL still missing"); - } + // "Configured" = a scrypted URL has been registered. viewport_name + // always has a value (MAC-derived default seeded in viewport_state_init). + st->configured = (st->scrypted_url[0] != '\0'); + ESP_LOGI(TAG, "loaded config: viewport=%s scrypted=%s " + "idle_ms=%u orient=%s bright=%u (%s)", + st->viewport_name, + st->scrypted_url[0] ? st->scrypted_url : "(none)", + (unsigned)st->idle_timeout_ms, + st->orientation == VIEWPORT_ORIENTATION_LANDSCAPE + ? "landscape" : "portrait", + st->brightness, + st->configured ? "configured" : "no scrypted URL"); done: viewport_state_unlock(); -- cgit v1.2.3