Next/back button assignment moves from a frame-level "Button assignments" card into each widget's own gear-icon dialog, prefilled with a sane default at creation (photos/calendar -> advance/back, whiteboard/weather -> check_now, others -> none). At most one binding per (widget, button) now -- cross-widget execution order never mattered since each widget's action only touches its own state. New firmware capability: holding NEXT or BACK past a configurable duration (min 3s, server-side default) triggers a frame-wide action instead of the per-widget short-press one -- cycling saved layouts, refreshing all widgets, or freezing/unfreezing every photo widget (see app/global_actions.py). Firmware next/back checks gain the same hold-duration polling the combo button already had; the threshold comes from the previous wake's /frame/config fetch (persisted in NVS), since this wake's button decision happens before that request. Not done here: firmware/version.txt is intentionally left unbumped -- this hasn't been built or hardware-tested (no ESP-IDF toolchain in this environment), so no firmware release build should be triggered yet.
35 lines
1.2 KiB
C
35 lines
1.2 KiB
C
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
|
|
/**
|
|
* Configures the back-photo button GPIO (CONFIG_FRAME_BACK_BUTTON_GPIO,
|
|
* active-low with internal pull-up) and arms it as a deep-sleep wakeup
|
|
* source, same as next_button_init(). Call once, early in app_main(),
|
|
* before the device might enter deep sleep.
|
|
*
|
|
* A no-op if CONFIG_FRAME_BACK_BUTTON_GPIO is negative (button disabled).
|
|
*/
|
|
void back_button_init(void);
|
|
|
|
typedef enum {
|
|
BACK_BUTTON_NOT_PRESSED,
|
|
/** A short press -- same immediate-response reasoning as the
|
|
* next-photo button. */
|
|
BACK_BUTTON_SHORT_PRESS,
|
|
/** Held past the configured hold duration (see
|
|
* wifi_provisioning.h's frame_config_get_hold_duration_ms) --
|
|
* triggers a frame-wide action instead (see
|
|
* server/app/global_actions.py, frame_client.h's FETCH_GLOBAL_BACK).
|
|
* Fires immediately at the threshold, without waiting for release. */
|
|
BACK_BUTTON_HOLD,
|
|
} back_button_result_t;
|
|
|
|
/**
|
|
* Checks the back-photo button and, if it's pressed at all, blocks
|
|
* polling its level until either it's released (BACK_BUTTON_SHORT_PRESS)
|
|
* or the hold duration elapses (BACK_BUTTON_HOLD) -- same pattern as
|
|
* next_button_check(). Evaluated once per wake.
|
|
*/
|
|
back_button_result_t back_button_check(void);
|