* MomentaryButton: added support for analog button (with threshold)

* RAK: support for PIN_USER_BTN_ANA
This commit is contained in:
Scott Powell 2025-09-01 17:11:55 +10:00
parent b8223e9d07
commit 74722c24b8
5 changed files with 39 additions and 3 deletions

View file

@ -354,6 +354,9 @@ void UITask::begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* no
#if defined(PIN_USER_BTN)
user_btn.begin();
#endif
#if defined(PIN_USER_BTN_ANA)
analog_btn.begin();
#endif
_node_prefs = node_prefs;
if (_display != NULL) {
@ -508,6 +511,14 @@ void UITask::loop() {
c = handleLongPress(KEY_RIGHT);
}
#endif
#if defined(PIN_USER_BTN_ANA)
ev = analog_btn.check();
if (ev == BUTTON_EVENT_CLICK) {
c = checkDisplayOn(KEY_SELECT);
} else if (ev == BUTTON_EVENT_LONG_PRESS) {
c = handleLongPress(KEY_ENTER);
}
#endif
if (c != 0 && curr) {
curr->handleInput(c);