From c45d6b2017fa45cbb0f417dc6aaf06828b2b4671 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilenko Date: Thu, 30 Jan 2020 21:29:30 +0300 Subject: [PATCH] Simultaneous use of rotary encoder and touch buttons (#16729) --- Marlin/src/lcd/ultralcd.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index 04ebd5079f..35366d761c 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -777,13 +777,12 @@ void MarlinUI::update() { static bool wait_for_unclick; // = false #if ENABLED(TOUCH_BUTTONS) - if (touch_buttons) { RESET_STATUS_TIMEOUT(); - if (buttons & (EN_A | EN_B)) { // Menu arrows, in priority + if (touch_buttons & (EN_A | EN_B)) { // Menu arrows, in priority if (ELAPSED(ms, next_button_update_ms)) { encoderDiff = (ENCODER_STEPS_PER_MENU_ITEM) * (ENCODER_PULSES_PER_STEP) * encoderDirection; - if (buttons & EN_A) encoderDiff *= -1; + if (touch_buttons & EN_A) encoderDiff *= -1; #if ENABLED(AUTO_BED_LEVELING_UBL) if (external_control) ubl.encoder_diff = encoderDiff; #endif @@ -1246,7 +1245,11 @@ void MarlinUI::update() { | slow_buttons #endif #if ENABLED(TOUCH_BUTTONS) && HAS_ENCODER_ACTION - | touch_buttons + | (touch_buttons + #if HAS_ENCODER_WHEEL + & (~(EN_A | EN_B)) + #endif + ) #endif ); @@ -1277,7 +1280,7 @@ void MarlinUI::update() { } // next_button_update_ms - #if HAS_ENCODER_WHEEL && DISABLED(TOUCH_BUTTONS) + #if HAS_ENCODER_WHEEL static uint8_t lastEncoderBits; #define encrot0 0