|
|
@ -764,42 +764,41 @@ void MarlinUI::update() {
|
|
|
|
|
|
|
|
|
|
|
|
// If the action button is pressed...
|
|
|
|
// If the action button is pressed...
|
|
|
|
static bool wait_for_unclick; // = 0
|
|
|
|
static bool wait_for_unclick; // = 0
|
|
|
|
if (touch_buttons) {
|
|
|
|
#if ENABLED(TOUCH_BUTTONS)
|
|
|
|
if (buttons & EN_C) {
|
|
|
|
if (touch_buttons) {
|
|
|
|
if (!wait_for_unclick) { // If not waiting for a debounce release:
|
|
|
|
if (!wait_for_unclick && (buttons & EN_C)) { // If not waiting for a debounce release:
|
|
|
|
wait_for_unclick = true; // - Set debounce flag to ignore continous clicks
|
|
|
|
wait_for_unclick = true; // - Set debounce flag to ignore continous clicks
|
|
|
|
lcd_clicked = !wait_for_user && !no_reentry; // - Keep the click if not waiting for a user-click
|
|
|
|
lcd_clicked = !wait_for_user && !no_reentry; // - Keep the click if not waiting for a user-click
|
|
|
|
wait_for_user = false; // - Any click clears wait for user
|
|
|
|
wait_for_user = false; // - Any click clears wait for user
|
|
|
|
quick_feedback(); // - Always make a click sound
|
|
|
|
quick_feedback(); // - Always make a click sound
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (buttons & (EN_A | EN_B)) { // Ignore the encoder if clicked, to prevent "slippage"
|
|
|
|
else if (buttons & (EN_A | EN_B)) { // Ignore the encoder if clicked, to prevent "slippage"
|
|
|
|
const millis_t ms = millis();
|
|
|
|
const millis_t ms = millis();
|
|
|
|
if (ELAPSED(ms, next_button_update_ms)) {
|
|
|
|
if (ELAPSED(ms, next_button_update_ms)) {
|
|
|
|
next_button_update_ms = ms + 50;
|
|
|
|
next_button_update_ms = ms + 50;
|
|
|
|
encoderDiff = (ENCODER_STEPS_PER_MENU_ITEM) * (ENCODER_PULSES_PER_STEP);
|
|
|
|
encoderDiff = (ENCODER_STEPS_PER_MENU_ITEM) * (ENCODER_PULSES_PER_STEP);
|
|
|
|
if (buttons & EN_A) encoderDiff *= -1;
|
|
|
|
if (buttons & EN_A) encoderDiff *= -1;
|
|
|
|
if (!wait_for_unclick) {
|
|
|
|
if (!wait_for_unclick) {
|
|
|
|
next_button_update_ms += 250;
|
|
|
|
next_button_update_ms += 250;
|
|
|
|
#if HAS_BUZZER
|
|
|
|
#if HAS_BUZZER
|
|
|
|
buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
|
|
|
|
buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
wait_for_unclick = true; // - Set debounce flag to ignore continous clicks
|
|
|
|
wait_for_unclick = true; // - Set debounce flag to ignore continous clicks
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else {
|
|
|
|
#endif //TOUCH_BUTTONS
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Integrated LCD click handling via button_pressed()
|
|
|
|
// Integrated LCD click handling via button_pressed()
|
|
|
|
//
|
|
|
|
//
|
|
|
|
if (!external_control && button_pressed()) {
|
|
|
|
if (!external_control && button_pressed()) {
|
|
|
|
if (!wait_for_unclick) { // If not waiting for a debounce release:
|
|
|
|
if (!wait_for_unclick) { // If not waiting for a debounce release:
|
|
|
|
wait_for_unclick = true; // - Set debounce flag to ignore continous clicks
|
|
|
|
wait_for_unclick = true; // - Set debounce flag to ignore continous clicks
|
|
|
|
lcd_clicked = !wait_for_user && !no_reentry; // - Keep the click if not waiting for a user-click
|
|
|
|
lcd_clicked = !wait_for_user && !no_reentry; // - Keep the click if not waiting for a user-click
|
|
|
|
wait_for_user = false; // - Any click clears wait for user
|
|
|
|
wait_for_user = false; // - Any click clears wait for user
|
|
|
|
quick_feedback(); // - Always make a click sound
|
|
|
|
quick_feedback(); // - Always make a click sound
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else wait_for_unclick = false;
|
|
|
|
else wait_for_unclick = false;
|
|
|
|