瀏覽代碼

General cosmetic LCD

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,14 +4590,20 @@ void lcd_update() {
4590 4590
 
4591 4591
   #if ENABLED(ULTIPANEL)
4592 4592
     static millis_t return_to_status_ms = 0;
4593
+
4594
+    // Handle any queued Move Axis motion
4593 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 4600
     lcd_buttons_update();
4596 4601
 
4597 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 4605
     #else
4600
-      constexpr bool UBL_CONDITION = true;
4606
+      #define UBL_CONDITION true
4601 4607
     #endif
4602 4608
 
4603 4609
     // If the action button is pressed...
@@ -4944,7 +4950,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
4944 4950
    */
4945 4951
   void lcd_buttons_update() {
4946 4952
     static uint8_t lastEncoderBits;
4947
-    millis_t now = millis();
4953
+    const millis_t now = millis();
4948 4954
     if (ELAPSED(now, next_button_update_ms)) {
4949 4955
 
4950 4956
       #if ENABLED(NEWPANEL)
@@ -4962,9 +4968,16 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
4962 4968
           if (BUTTON_PRESSED(ENC)) newbutton |= EN_C;
4963 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 4979
         #if LCD_HAS_DIRECTIONAL_BUTTONS
4966 4980
 
4967
-          // Manage directional buttons
4968 4981
           #if ENABLED(REVERSE_MENU_DIRECTION)
4969 4982
             #define _ENCODER_UD_STEPS (ENCODER_STEPS_PER_MENU_ITEM * encoderDirection)
4970 4983
           #else
@@ -5008,11 +5021,6 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
5008 5021
 
5009 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 5024
         #if ENABLED(ADC_KEYPAD)
5017 5025
 
5018 5026
           uint8_t newbutton_reprapworld_keypad = 0;

+ 4
- 4
Marlin/src/lcd/ultralcd_impl_HD44780.h 查看文件

@@ -78,12 +78,12 @@ extern volatile uint8_t buttons;  //an extended version of the last checked butt
78 78
 
79 79
     #if BUTTON_EXISTS(ENC)
80 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 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 84
     #else
85 85
       #undef LCD_CLICKED
86
-      #define LCD_CLICKED (buttons&(B_MI|B_RI))
86
+      #define LCD_CLICKED (buttons & (B_MI|B_RI))
87 87
     #endif
88 88
 
89 89
     // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
@@ -119,7 +119,7 @@ extern volatile uint8_t buttons;  //an extended version of the last checked butt
119 119
     #define B_DW (_BV(BL_DW))
120 120
     #define B_RI (_BV(BL_RI))
121 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 123
   #endif
124 124
 
125 125
 #endif // ULTIPANEL

Loading…
取消
儲存