Simultaneous use of rotary encoder and touch buttons (#16729)

This commit is contained in:
Alexander Gavrilenko 2020-01-30 21:29:30 +03:00 committed by GitHub
parent 8d4dd88bf9
commit c45d6b2017
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23

View file

@ -777,13 +777,12 @@ void MarlinUI::update() {
static bool wait_for_unclick; // = false static bool wait_for_unclick; // = false
#if ENABLED(TOUCH_BUTTONS) #if ENABLED(TOUCH_BUTTONS)
if (touch_buttons) { if (touch_buttons) {
RESET_STATUS_TIMEOUT(); 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)) { if (ELAPSED(ms, next_button_update_ms)) {
encoderDiff = (ENCODER_STEPS_PER_MENU_ITEM) * (ENCODER_PULSES_PER_STEP) * encoderDirection; 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 ENABLED(AUTO_BED_LEVELING_UBL)
if (external_control) ubl.encoder_diff = encoderDiff; if (external_control) ubl.encoder_diff = encoderDiff;
#endif #endif
@ -1246,7 +1245,11 @@ void MarlinUI::update() {
| slow_buttons | slow_buttons
#endif #endif
#if ENABLED(TOUCH_BUTTONS) && HAS_ENCODER_ACTION #if ENABLED(TOUCH_BUTTONS) && HAS_ENCODER_ACTION
| touch_buttons | (touch_buttons
#if HAS_ENCODER_WHEEL
& (~(EN_A | EN_B))
#endif
)
#endif #endif
); );
@ -1277,7 +1280,7 @@ void MarlinUI::update() {
} // next_button_update_ms } // next_button_update_ms
#if HAS_ENCODER_WHEEL && DISABLED(TOUCH_BUTTONS) #if HAS_ENCODER_WHEEL
static uint8_t lastEncoderBits; static uint8_t lastEncoderBits;
#define encrot0 0 #define encrot0 0