From 1981826a85f9507aebad8284b9cd8e726e21ea1a Mon Sep 17 00:00:00 2001 From: Jakub <106778416+MarekZegare4@users.noreply.github.com> Date: Fri, 18 Sep 2026 09:57:29 +0200 Subject: [PATCH] fix(heltec_v3/v4): user_btn needs pull-up + multiclick=false in joystick mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With UI_HAS_JOYSTICK, user_btn (Enter) was left with pulldownup=false and multiclick=true (the plain-PRG-button defaults), instead of matching the other wired joystick contacts. Two effects on a wired Enter button: - No internal pull-up on the Enter pin, unlike the direction/back contacts. - multiclick=true buffers a click for ~280ms waiting for a possible double/ triple click, but UITask.cpp's UI_HAS_JOYSTICK loop only ever checks user_btn for CLICK/LONG_PRESS — so a quick double-tap collapses into a DOUBLE_CLICK event that's silently dropped, making Enter feel laggy and unreliable. wio-tracker-l1 (factory joystick) already builds user_btn with pulldownup/multiclick matching its other contacts; apply the same pattern here, conditional on UI_HAS_JOYSTICK so the stock external-pull-up PRG button path (no joystick) is unchanged. Co-Authored-By: Claude Sonnet 5 --- variants/heltec_v3/target.cpp | 12 +++++++++--- variants/heltec_v4/target.cpp | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/variants/heltec_v3/target.cpp b/variants/heltec_v3/target.cpp index 007a0fbd..5f42c9cd 100644 --- a/variants/heltec_v3/target.cpp +++ b/variants/heltec_v3/target.cpp @@ -25,13 +25,17 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock); #ifdef DISPLAY_CLASS DISPLAY_CLASS display; - MomentaryButton user_btn(PIN_USER_BTN, 1000, true); #if UI_HAS_JOYSTICK // Optional wired joystick — see the Heltec_v3_companion_solo_dual env for the // pin defines this needs. Unlike the Wio Tracker L1 (external pull-ups on // board) these pass pulldownup = true, so each contact only has to short its - // pin to GND; the internal pull-up does the rest. Back gets multiclick = true - // because the UI's triple-click buzzer toggle lives on it. + // pin to GND; the internal pull-up does the rest. user_btn (Enter) and the + // direction contacts all get multiclick = false — loop()'s UI_HAS_JOYSTICK + // branch never looks at DOUBLE_CLICK/TRIPLE_CLICK for Enter, so leaving + // multiclick on just adds a ~280ms wait-for-more-clicks delay and silently + // swallows a quick double-tap. Back gets multiclick = true because the UI's + // triple-click buzzer toggle lives on it. + MomentaryButton user_btn (PIN_USER_BTN, 1000, true, true, false); MomentaryButton joystick_left (JOYSTICK_LEFT, 1000, true, true, false); MomentaryButton joystick_right(JOYSTICK_RIGHT, 1000, true, true, false); MomentaryButton back_btn (PIN_BACK_BTN, 1000, true, true, true); @@ -39,6 +43,8 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock); MomentaryButton joystick_up (JOYSTICK_UP, 1000, true, true, false); MomentaryButton joystick_down(JOYSTICK_DOWN, 1000, true, true, false); #endif + #else + MomentaryButton user_btn(PIN_USER_BTN, 1000, true); #endif #endif diff --git a/variants/heltec_v4/target.cpp b/variants/heltec_v4/target.cpp index 5acaf80a..39e1bf20 100644 --- a/variants/heltec_v4/target.cpp +++ b/variants/heltec_v4/target.cpp @@ -25,13 +25,17 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock); #ifdef DISPLAY_CLASS DISPLAY_CLASS display(NULL); - MomentaryButton user_btn(PIN_USER_BTN, 1000, true); #if UI_HAS_JOYSTICK // Optional wired joystick — see the heltec_v4_companion_solo_dual env for the // pin defines this needs. Unlike the Wio Tracker L1 (external pull-ups on // board) these pass pulldownup = true, so each contact only has to short its - // pin to GND; the internal pull-up does the rest. Back gets multiclick = true - // because the UI's triple-click buzzer toggle lives on it. + // pin to GND; the internal pull-up does the rest. user_btn (Enter) and the + // direction contacts all get multiclick = false — loop()'s UI_HAS_JOYSTICK + // branch never looks at DOUBLE_CLICK/TRIPLE_CLICK for Enter, so leaving + // multiclick on just adds a ~280ms wait-for-more-clicks delay and silently + // swallows a quick double-tap. Back gets multiclick = true because the UI's + // triple-click buzzer toggle lives on it. + MomentaryButton user_btn (PIN_USER_BTN, 1000, true, true, false); MomentaryButton joystick_left (JOYSTICK_LEFT, 1000, true, true, false); MomentaryButton joystick_right(JOYSTICK_RIGHT, 1000, true, true, false); MomentaryButton back_btn (PIN_BACK_BTN, 1000, true, true, true); @@ -39,6 +43,8 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock); MomentaryButton joystick_up (JOYSTICK_UP, 1000, true, true, false); MomentaryButton joystick_down(JOYSTICK_DOWN, 1000, true, true, false); #endif + #else + MomentaryButton user_btn(PIN_USER_BTN, 1000, true); #endif #endif