src.nth.io/

summaryrefslogtreecommitdiff
path: root/main/button.c
diff options
context:
space:
mode:
authorLuke Hoersten <[email protected]>2026-06-14 15:53:33 -0500
committerLuke Hoersten <[email protected]>2026-06-14 15:53:33 -0500
commitd5cdb6b4e4424d80ac9bfd8e12c129334c23d6f2 (patch)
treef9b5e838061f76af8160863548758311857b1c75 /main/button.c
parent8d740665777af6d74b334e2dee98a53ebb9a29aa (diff)
M3 WIP: DSI bring-up + state machine + identity overlay
DSI / panel: - LDO_VO3 acquired at 2500 mV (VDD_MIPI_DPHY) — without this the PHY PLL busy-waits forever inside esp_lcd_new_dsi_bus. - PSRAM bumped to 200 MHz (CONFIG_IDF_EXPERIMENTAL_FEATURES) to keep the DPI fed without underruns. - Pi-7"-style 800x480 panel init (REG_POWERON, PORTA/PORTB/PWM/PORTC) + 16-bit RGB565 framebuffer with portrait-mode rotation buffer in PSRAM. Currently shows garbled output — known issue, next commit switches to the TC358762-bridge-aware init sequence. State + UX: - viewport_state simplified to AWAKE/ASLEEP only; "unconfigured" is a flag, not a state. Tap always toggles; content choice (identity vs frame) is driven by the configured flag. - BOOT button arms a 15 s identity overlay via local_screens_overlay; expired callback returns to prior state. - Boot-done indicator: two backlight flashes (no usable LED GPIO on the Waveshare board — GPIO 35 BOOT is shared with EMAC TXD1). - Best-effort subsystem init in app_main; display init deferred to its own task so a panel hang can't block networking. Display test pattern: solid R/G/B for 2 s each on boot to characterize the garble independent of text rendering.
Diffstat (limited to 'main/button.c')
-rw-r--r--main/button.c27
1 files changed, 2 insertions, 25 deletions
diff --git a/main/button.c b/main/button.c
index 9ac34a1..26e7cff 100644
--- a/main/button.c
+++ b/main/button.c
@@ -25,28 +25,11 @@ static const char *TAG = "button";
#define LONG_HOLD_MS 5000
#define OVERLAY_MS 15000
-static esp_timer_handle_t s_overlay_timer;
-
-static void overlay_expired(void *arg)
-{
- if (display_is_up()) {
- local_screens_restore_for_state();
- // Caller (state_machine_set) had backlight off if asleep — the
- // overlay turned it on. Force it back off if we're asleep.
- // Easiest: re-issue display_sleep, the wake_then_sleep path is
- // owned by the state machine.
- }
- ESP_LOGI(TAG, "IP overlay expired");
-}
-
static void start_overlay(void)
{
if (!display_is_up()) return;
- esp_timer_stop(s_overlay_timer);
- display_wake(); // turn backlight on in case we were asleep
- local_screens_show_ip();
- esp_timer_start_once(s_overlay_timer, (uint64_t)OVERLAY_MS * 1000ULL);
- ESP_LOGI(TAG, "BOOT short-press → IP overlay for %dms", OVERLAY_MS);
+ local_screens_overlay(OVERLAY_MS);
+ ESP_LOGI(TAG, "BOOT short-press → identity overlay for %dms", OVERLAY_MS);
}
static void factory_reset(void)
@@ -104,12 +87,6 @@ esp_err_t button_init(void)
return err;
}
- esp_timer_create_args_t targs = {
- .callback = &overlay_expired,
- .name = "boot_overlay",
- };
- esp_timer_create(&targs, &s_overlay_timer);
-
BaseType_t ok = xTaskCreate(button_task, "boot_btn", 3072, NULL, 3, NULL);
if (ok != pdPASS) return ESP_FAIL;