Skip to content

Commit

Permalink
Make 'else' more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Dec 6, 2019
1 parent 9057027 commit 40444bd
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions Marlin/src/lcd/ultralcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,7 @@ 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
Expand All @@ -802,19 +803,22 @@ void MarlinUI::update() {
}
}
else // keep wait_for_unclick value

#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
{
// 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;
}
}
else
wait_for_unclick = false;

if (LCD_BACK_CLICKED()) {
quick_feedback();
Expand Down

0 comments on commit 40444bd

Please sign in to comment.