Scott Lahteine преди 7 години
родител
ревизия
3994d3b935
променени са 2 файла, в които са добавени 21 реда и са изтрити 13 реда
  1. 17
    9
      Marlin/src/lcd/ultralcd.cpp
  2. 4
    4
      Marlin/src/lcd/ultralcd_impl_HD44780.h

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

4590
 
4590
 
4591
   #if ENABLED(ULTIPANEL)
4591
   #if ENABLED(ULTIPANEL)
4592
     static millis_t return_to_status_ms = 0;
4592
     static millis_t return_to_status_ms = 0;
4593
+
4594
+    // Handle any queued Move Axis motion
4593
     manage_manual_move();
4595
     manage_manual_move();
4594
 
4596
 
4597
+    // Update button states for LCD_CLICKED, etc.
4598
+    // After state changes the next button update
4599
+    // may be delayed 300-500ms.
4595
     lcd_buttons_update();
4600
     lcd_buttons_update();
4596
 
4601
 
4597
     #if ENABLED(AUTO_BED_LEVELING_UBL)
4602
     #if ENABLED(AUTO_BED_LEVELING_UBL)
4598
-      const bool UBL_CONDITION = !ubl.has_control_of_lcd_panel;
4603
+      // Don't run the debouncer if UBL owns the display
4604
+      #define UBL_CONDITION !ubl.has_control_of_lcd_panel
4599
     #else
4605
     #else
4600
-      constexpr bool UBL_CONDITION = true;
4606
+      #define UBL_CONDITION true
4601
     #endif
4607
     #endif
4602
 
4608
 
4603
     // If the action button is pressed...
4609
     // If the action button is pressed...
4944
    */
4950
    */
4945
   void lcd_buttons_update() {
4951
   void lcd_buttons_update() {
4946
     static uint8_t lastEncoderBits;
4952
     static uint8_t lastEncoderBits;
4947
-    millis_t now = millis();
4953
+    const millis_t now = millis();
4948
     if (ELAPSED(now, next_button_update_ms)) {
4954
     if (ELAPSED(now, next_button_update_ms)) {
4949
 
4955
 
4950
       #if ENABLED(NEWPANEL)
4956
       #if ENABLED(NEWPANEL)
4962
           if (BUTTON_PRESSED(ENC)) newbutton |= EN_C;
4968
           if (BUTTON_PRESSED(ENC)) newbutton |= EN_C;
4963
         #endif
4969
         #endif
4964
 
4970
 
4971
+        buttons = newbutton;
4972
+        #if ENABLED(LCD_HAS_SLOW_BUTTONS)
4973
+          buttons |= slow_buttons;
4974
+        #endif
4975
+
4976
+        //
4977
+        // Directional buttons
4978
+        //
4965
         #if LCD_HAS_DIRECTIONAL_BUTTONS
4979
         #if LCD_HAS_DIRECTIONAL_BUTTONS
4966
 
4980
 
4967
-          // Manage directional buttons
4968
           #if ENABLED(REVERSE_MENU_DIRECTION)
4981
           #if ENABLED(REVERSE_MENU_DIRECTION)
4969
             #define _ENCODER_UD_STEPS (ENCODER_STEPS_PER_MENU_ITEM * encoderDirection)
4982
             #define _ENCODER_UD_STEPS (ENCODER_STEPS_PER_MENU_ITEM * encoderDirection)
4970
           #else
4983
           #else
5008
 
5021
 
5009
         #endif // LCD_HAS_DIRECTIONAL_BUTTONS
5022
         #endif // LCD_HAS_DIRECTIONAL_BUTTONS
5010
 
5023
 
5011
-        buttons = newbutton;
5012
-        #if ENABLED(LCD_HAS_SLOW_BUTTONS)
5013
-          buttons |= slow_buttons;
5014
-        #endif
5015
-
5016
         #if ENABLED(ADC_KEYPAD)
5024
         #if ENABLED(ADC_KEYPAD)
5017
 
5025
 
5018
           uint8_t newbutton_reprapworld_keypad = 0;
5026
           uint8_t newbutton_reprapworld_keypad = 0;

+ 4
- 4
Marlin/src/lcd/ultralcd_impl_HD44780.h Целия файл

78
 
78
 
79
     #if BUTTON_EXISTS(ENC)
79
     #if BUTTON_EXISTS(ENC)
80
       // the pause/stop/restart button is connected to BTN_ENC when used
80
       // the pause/stop/restart button is connected to BTN_ENC when used
81
-      #define B_ST (EN_C)                            // Map the pause/stop/resume button into its normalized functional name
81
+      #define B_ST (EN_C)                              // Map the pause/stop/resume button into its normalized functional name
82
       #undef LCD_CLICKED
82
       #undef LCD_CLICKED
83
-      #define LCD_CLICKED (buttons&(B_MI|B_RI|B_ST)) // pause/stop button also acts as click until we implement proper pause/stop.
83
+      #define LCD_CLICKED (buttons & (B_MI|B_RI|B_ST)) // pause/stop button also acts as click until we implement proper pause/stop.
84
     #else
84
     #else
85
       #undef LCD_CLICKED
85
       #undef LCD_CLICKED
86
-      #define LCD_CLICKED (buttons&(B_MI|B_RI))
86
+      #define LCD_CLICKED (buttons & (B_MI|B_RI))
87
     #endif
87
     #endif
88
 
88
 
89
     // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
89
     // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
119
     #define B_DW (_BV(BL_DW))
119
     #define B_DW (_BV(BL_DW))
120
     #define B_RI (_BV(BL_RI))
120
     #define B_RI (_BV(BL_RI))
121
     #define B_ST (_BV(BL_ST))
121
     #define B_ST (_BV(BL_ST))
122
-    #define LCD_CLICKED ((buttons & B_MI) || (buttons & B_ST))
122
+    #define LCD_CLICKED (buttons & (B_MI|B_ST))
123
   #endif
123
   #endif
124
 
124
 
125
 #endif // ULTIPANEL
125
 #endif // ULTIPANEL

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