src.nth.io/

summaryrefslogtreecommitdiff
path: root/main/local_screens.c
diff options
context:
space:
mode:
authorLuke Hoersten <[email protected]>2026-06-14 20:11:21 -0500
committerLuke Hoersten <[email protected]>2026-06-14 20:11:21 -0500
commit865c4859d710870245ae7954e729edcaf442a921 (patch)
treec22cb7d60fb8ea3bba6e9e85b45779d0dfa87d4f /main/local_screens.c
parent8e2de89efb540fd6a3dce2086216d3afc49e6831 (diff)
Default name = MAC; brief wake on boot; drop dead touch defences
- 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.
Diffstat (limited to 'main/local_screens.c')
-rw-r--r--main/local_screens.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/main/local_screens.c b/main/local_screens.c
index f25754d..5c72f26 100644
--- a/main/local_screens.c
+++ b/main/local_screens.c
@@ -199,6 +199,7 @@ esp_err_t local_screens_show_info(void)
// is on a 3 KiB stack and can't carry ~1.6 KiB of locals here. Single
// caller protected by display ownership, so static is fine.
static char vp_name[64];
+ static char mac_str[18];
static char scrypt[256];
static char lines[INFO_MAX_LINES][INFO_LINE_BYTES];
bool configured;
@@ -212,8 +213,10 @@ esp_err_t local_screens_show_info(void)
viewport_state_lock();
viewport_state_t *st = viewport_state_get();
strncpy(vp_name, st->viewport_name, sizeof(vp_name));
+ strncpy(mac_str, st->mac_str, sizeof(mac_str));
strncpy(scrypt, st->scrypted_url, sizeof(scrypt));
vp_name[sizeof(vp_name) - 1] = '\0';
+ mac_str[sizeof(mac_str) - 1] = '\0';
scrypt[sizeof(scrypt) - 1] = '\0';
configured = st->configured;
state = st->state;
@@ -237,8 +240,7 @@ esp_err_t local_screens_show_info(void)
// 8-char label is prefixed. Long names get visibly truncated; ok for
// an info dump on a 480-wide screen.
char host[32];
- if (vp_name[0]) snprintf(host, sizeof(host), "viewport-%.15s.local", vp_name);
- else snprintf(host, sizeof(host), "viewport.local");
+ snprintf(host, sizeof(host), "viewport-%.15s.local", vp_name);
char scrypt_short[32];
if (!scrypt[0]) {
@@ -292,7 +294,8 @@ esp_err_t local_screens_show_info(void)
snprintf(lines[n_lines++], INFO_LINE_BYTES, fmt, ##__VA_ARGS__); \
} while (0)
- ADD("name %s", vp_name[0] ? vp_name : "unset");
+ ADD("name %s", vp_name);
+ ADD("mac %s", mac_str);
ADD("host %s", host);
ADD("ip %s", (ip && ip[0]) ? ip : "no network");
ADD("state %s", state_str);