Followup for BTN_ENC_EN

2.0.x
Scott Lahteine 4 years ago
parent 6c103b72a2
commit 2a8fdb8ee4

@ -808,6 +808,14 @@ millis_t next_lcd_update_ms;
millis_t MarlinUI::return_to_status_ms = 0;
#endif
inline bool can_encode() {
#if BUTTON_EXISTS(ENC_EN)
return !BUTTON_PRESSED(ENC_EN); // Update position only when ENC_EN is HIGH
#else
return true;
#endif
}
void MarlinUI::update() {
static uint16_t max_display_update_time = 0;
@ -961,9 +969,7 @@ void MarlinUI::update() {
#endif // ENCODER_RATE_MULTIPLIER
// Update position only when ENC_EN is HIGH
if (TERN1(BTN_ENC_EN, !BUTTON_PRESSED(ENC_EN)))
encoderPosition += (encoderDiff * encoderMultiplier) / epps;
if (can_encode()) encoderPosition += (encoderDiff * encoderMultiplier) / epps;
encoderDiff = 0;
}
@ -1182,8 +1188,7 @@ void MarlinUI::update() {
if (BUTTON_PRESSED(EN2)) newbutton |= EN_B;
#endif
#if BUTTON_EXISTS(ENC)
// Update button only when ENC_EN is HIGH
if (TERN1(BTN_ENC_EN, !BUTTON_PRESSED(ENC_EN)) && BUTTON_PRESSED(ENC)) newbutton |= EN_C;
if (can_encode() && BUTTON_PRESSED(ENC)) newbutton |= EN_C;
#endif
#if BUTTON_EXISTS(BACK)
if (BUTTON_PRESSED(BACK)) newbutton |= EN_D;

Loading…
Cancel
Save