Преглед на файлове

Fix build with and without TOUCH_BUTTONS (#14912)

Tanguy Pruvot преди 5 години
родител
ревизия
0745d48993
променени са 1 файла, в които са добавени 27 реда и са изтрити 28 реда
  1. 27
    28
      Marlin/src/lcd/ultralcd.cpp

+ 27
- 28
Marlin/src/lcd/ultralcd.cpp Целия файл

@@ -764,42 +764,41 @@ void MarlinUI::update() {
764 764
 
765 765
     // If the action button is pressed...
766 766
     static bool wait_for_unclick; // = 0
767
-    if (touch_buttons) {
768
-      if (buttons & EN_C) {
769
-        if (!wait_for_unclick) {                        // If not waiting for a debounce release:
767
+    #if ENABLED(TOUCH_BUTTONS)
768
+      if (touch_buttons) {
769
+        if (!wait_for_unclick && (buttons & EN_C)) {    // If not waiting for a debounce release:
770 770
           wait_for_unclick = true;                      //  - Set debounce flag to ignore continous clicks
771 771
           lcd_clicked = !wait_for_user && !no_reentry;  //  - Keep the click if not waiting for a user-click
772 772
           wait_for_user = false;                        //  - Any click clears wait for user
773 773
           quick_feedback();                             //  - Always make a click sound
774 774
         }
775
-      }
776
-      else if (buttons & (EN_A | EN_B)) {               // Ignore the encoder if clicked, to prevent "slippage"
777
-        const millis_t ms = millis();
778
-        if (ELAPSED(ms, next_button_update_ms)) {
779
-          next_button_update_ms = ms + 50;
780
-          encoderDiff = (ENCODER_STEPS_PER_MENU_ITEM) * (ENCODER_PULSES_PER_STEP);
781
-          if (buttons & EN_A) encoderDiff *= -1;
782
-          if (!wait_for_unclick) {
783
-            next_button_update_ms += 250;
784
-            #if HAS_BUZZER
785
-              buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
786
-            #endif
787
-            wait_for_unclick = true;                      //  - Set debounce flag to ignore continous clicks
775
+        else if (buttons & (EN_A | EN_B)) {             // Ignore the encoder if clicked, to prevent "slippage"
776
+          const millis_t ms = millis();
777
+          if (ELAPSED(ms, next_button_update_ms)) {
778
+            next_button_update_ms = ms + 50;
779
+            encoderDiff = (ENCODER_STEPS_PER_MENU_ITEM) * (ENCODER_PULSES_PER_STEP);
780
+            if (buttons & EN_A) encoderDiff *= -1;
781
+            if (!wait_for_unclick) {
782
+              next_button_update_ms += 250;
783
+              #if HAS_BUZZER
784
+                buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
785
+              #endif
786
+              wait_for_unclick = true;                  //  - Set debounce flag to ignore continous clicks
787
+            }
788 788
           }
789 789
         }
790 790
       }
791
-    }
792
-    else {
793
-      //
794
-      // Integrated LCD click handling via button_pressed()
795
-      //
796
-      if (!external_control && button_pressed()) {
797
-        if (!wait_for_unclick) {                        // If not waiting for a debounce release:
798
-          wait_for_unclick = true;                      //  - Set debounce flag to ignore continous clicks
799
-          lcd_clicked = !wait_for_user && !no_reentry;  //  - Keep the click if not waiting for a user-click
800
-          wait_for_user = false;                        //  - Any click clears wait for user
801
-          quick_feedback();                             //  - Always make a click sound
802
-        }
791
+      else
792
+    #endif //TOUCH_BUTTONS
793
+    //
794
+    // Integrated LCD click handling via button_pressed()
795
+    //
796
+    if (!external_control && button_pressed()) {
797
+      if (!wait_for_unclick) {                        // If not waiting for a debounce release:
798
+        wait_for_unclick = true;                      //  - Set debounce flag to ignore continous clicks
799
+        lcd_clicked = !wait_for_user && !no_reentry;  //  - Keep the click if not waiting for a user-click
800
+        wait_for_user = false;                        //  - Any click clears wait for user
801
+        quick_feedback();                             //  - Always make a click sound
803 802
       }
804 803
     }
805 804
     else wait_for_unclick = false;

Loading…
Отказ
Запис