Merge pull request #1038 from adam2872/Analogue-button-fix-for-new-UI

Analogue user button fix for new UI
This commit is contained in:
ripplebiz
2025-11-06 15:41:45 +11:00
committed by GitHub
2 changed files with 16 additions and 9 deletions

View File

@@ -700,15 +700,18 @@ void UITask::loop() {
} }
#endif #endif
#if defined(PIN_USER_BTN_ANA) #if defined(PIN_USER_BTN_ANA)
ev = analog_btn.check(); if (abs(millis() - _analogue_pin_read_millis) > 10) {
if (ev == BUTTON_EVENT_CLICK) { ev = analog_btn.check();
c = checkDisplayOn(KEY_NEXT); if (ev == BUTTON_EVENT_CLICK) {
} else if (ev == BUTTON_EVENT_LONG_PRESS) { c = checkDisplayOn(KEY_NEXT);
c = handleLongPress(KEY_ENTER); } else if (ev == BUTTON_EVENT_LONG_PRESS) {
} else if (ev == BUTTON_EVENT_DOUBLE_CLICK) { c = handleLongPress(KEY_ENTER);
c = handleDoubleClick(KEY_PREV); } else if (ev == BUTTON_EVENT_DOUBLE_CLICK) {
} else if (ev == BUTTON_EVENT_TRIPLE_CLICK) { c = handleDoubleClick(KEY_PREV);
c = handleTripleClick(KEY_SELECT); } else if (ev == BUTTON_EVENT_TRIPLE_CLICK) {
c = handleTripleClick(KEY_SELECT);
}
_analogue_pin_read_millis = millis();
} }
#endif #endif
#if defined(DISP_BACKLIGHT) && defined(BACKLIGHT_BTN) #if defined(DISP_BACKLIGHT) && defined(BACKLIGHT_BTN)

View File

@@ -40,6 +40,10 @@ class UITask : public AbstractUITask {
int last_led_increment = 0; int last_led_increment = 0;
#endif #endif
#ifdef PIN_USER_BTN_ANA
unsigned long _analogue_pin_read_millis = millis();
#endif
UIScreen* splash; UIScreen* splash;
UIScreen* home; UIScreen* home;
UIScreen* msg_preview; UIScreen* msg_preview;