Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix build with and without TOUCH_BUTTONS... #14912

Merged
merged 1 commit into from
Aug 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 27 additions & 28 deletions Marlin/src/lcd/ultralcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -764,42 +764,41 @@ void MarlinUI::update() {

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