Files
espresso_frame/firmware/main/combo_button.h
tfaour 08960c9eec
Firmware build check / build-check (push) Successful in 2m45s
Build and release firmware / build-and-release (push) Successful in 2m45s
Swap combo button tiers: quick press resets, ~3s hold shows menu
Quick reset is now the fast/default action; summoning the management
menu takes a deliberate hold. Factory reset at ~15s is unchanged.
Renamed FRAME_COMBO_SOFT_RESET_HOLD_MS -> FRAME_COMBO_MENU_HOLD_MS to
match its new meaning. Bumps firmware to 1.4.1.
2026-07-27 22:40:44 +00:00

40 lines
1.6 KiB
C

#pragma once
#include <stdbool.h>
/**
* Configures the combined menu/reset button GPIO
* (CONFIG_FRAME_COMBO_BUTTON_GPIO, active-low with internal pull-up) and
* arms it as a deep-sleep wakeup source, same as the other buttons. Call
* once, early in app_main(), before the device might enter deep sleep.
*
* A no-op if CONFIG_FRAME_COMBO_BUTTON_GPIO is negative (button disabled).
*/
void combo_button_init(void);
/**
* Checks the combined menu/reset button and acts on how long it was
* held, evaluated once per wake:
* - Not pressed: returns false immediately.
* - Released before CONFIG_FRAME_COMBO_MENU_HOLD_MS (a quick press):
* a soft reset (esp_restart(), stored WiFi/server config kept) --
* never returns.
* - Released between the menu and factory-reset thresholds: returns
* true -- caller should show the management menu.
* - Held through CONFIG_FRAME_COMBO_FACTORY_RESET_HOLD_MS: a factory
* reset (frame_config_clear() + esp_restart(), fires immediately
* without waiting for release) -- never returns.
*/
bool combo_button_check(void);
/**
* Returns whether the combined button is currently held, with no
* debounce and no hold-duration interpretation -- a bare live level
* check. Used only by the already-shipped escalating-menu polling in
* frame_client.c (wait_for_button_press()) to detect a further press
* while the menu is already showing; deliberately never reused for
* reset detection, so holding the button too long while escalating the
* menu can't be misread as a reset request.
*/
bool combo_button_is_pressed(void);