Files
espresso_frame/firmware/main/reset_button.h
T
tfaour d395cf3bb9
Build and push server image / build-and-push (push) Successful in 35s
Add two physical buttons: factory-reset and next-photo
Factory-reset (GPIO3, hold 10s): clears stored WiFi/server config and
restarts into provisioning -- the deliberate, USB-free replacement for
the earlier reverted RST-based auto-reprovisioning idea.

Next-photo (GPIO2, tap): wakes the device and forces the server to
advance immediately via a new POST /frame/advance, instead of waiting
for the refresh interval. Both buttons arm themselves as deep-sleep GPIO
wakeup sources so a press is noticed promptly even while asleep.

Also makes GET /frame/image side-effect-free: it now only advances once
refresh_interval_s has elapsed since the current photo was set (tracked
server-side), so a device reboot for any reason just redisplays the
current photo instead of silently skipping ahead. The server maintains a
small reorderable upcoming-photos queue, viewable and rearrangeable from
the web UI.
2026-07-18 23:28:36 -04:00

23 lines
949 B
C

#pragma once
/**
* Configures the factory-reset button GPIO (CONFIG_FRAME_RESET_BUTTON_GPIO,
* active-low with internal pull-up) and arms it as a deep-sleep wakeup
* source, so holding it wakes the device promptly even while it's asleep
* rather than only being noticed during its brief awake windows. Call once,
* early in app_main(), before the device might enter deep sleep.
*
* A no-op if CONFIG_FRAME_RESET_BUTTON_GPIO is negative (button disabled).
*/
void reset_button_init(void);
/**
* Checks whether the reset button is currently held. If it's held
* continuously for CONFIG_FRAME_RESET_BUTTON_HOLD_MS, clears the stored
* WiFi/server config and restarts (does not return in that case) so the
* device comes back up in provisioning mode. Returns immediately if the
* button isn't pressed, or as soon as it's released before the hold
* duration elapses -- normal boot continues either way.
*/
void reset_button_check(void);