Skip to content

Commit

Permalink
Simultaneous use of rotary encoder and touch buttons (MarlinFirmware#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jmz52 authored and GeminiServer committed Jan 31, 2020
1 parent 0f2ac30 commit d3dad88
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Marlin/src/lcd/ultralcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
);

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d3dad88

Please sign in to comment.