瀏覽代碼

Merge pull request #4803 from thinkyhead/rc_lcd_button_fix

Clear LCD button state, apply timer to all
Scott Lahteine 7 年之前
父節點
當前提交
e40646de42
共有 1 個文件被更改,包括 33 次插入28 次删除
  1. 33
    28
      Marlin/ultralcd.cpp

+ 33
- 28
Marlin/ultralcd.cpp 查看文件

@@ -2361,6 +2361,7 @@ void kill_screen(const char* lcd_msg) {
2361 2361
 
2362 2362
   void lcd_quick_feedback() {
2363 2363
     lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
2364
+    buttons = 0;
2364 2365
     next_button_update_ms = millis() + 500;
2365 2366
 
2366 2367
     // Buzz and wait. The delay is needed for buttons to settle!
@@ -2850,20 +2851,26 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
2850 2851
    * Warning: This function is called from interrupt context!
2851 2852
    */
2852 2853
   void lcd_buttons_update() {
2853
-    #if ENABLED(NEWPANEL)
2854
-      uint8_t newbutton = 0;
2855
-      #if BUTTON_EXISTS(EN1)
2856
-        if (BUTTON_PRESSED(EN1)) newbutton |= EN_A;
2857
-      #endif
2858
-      #if BUTTON_EXISTS(EN2)
2859
-        if (BUTTON_PRESSED(EN2)) newbutton |= EN_B;
2860
-      #endif
2861
-      #if LCD_HAS_DIRECTIONAL_BUTTONS || BUTTON_EXISTS(ENC)
2862
-        millis_t now = millis();
2863
-      #endif
2854
+    millis_t now = millis();
2855
+    if (ELAPSED(now, next_button_update_ms)) {
2856
+
2857
+      #if ENABLED(NEWPANEL)
2858
+        uint8_t newbutton = 0;
2859
+
2860
+        #if BUTTON_EXISTS(EN1)
2861
+          if (BUTTON_PRESSED(EN1)) newbutton |= EN_A;
2862
+        #endif
2863
+
2864
+        #if BUTTON_EXISTS(EN2)
2865
+          if (BUTTON_PRESSED(EN2)) newbutton |= EN_B;
2866
+        #endif
2867
+
2868
+        #if BUTTON_EXISTS(ENC)
2869
+          if (BUTTON_PRESSED(ENC)) newbutton |= EN_C;
2870
+        #endif
2871
+
2872
+        #if LCD_HAS_DIRECTIONAL_BUTTONS
2864 2873
 
2865
-      #if LCD_HAS_DIRECTIONAL_BUTTONS
2866
-        if (ELAPSED(now, next_button_update_ms)) {
2867 2874
           if (false) {
2868 2875
             // for the else-ifs below
2869 2876
           }
@@ -2891,23 +2898,21 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
2891 2898
               next_button_update_ms = now + 300;
2892 2899
             }
2893 2900
           #endif
2894
-        }
2895
-      #endif
2896 2901
 
2897
-      #if BUTTON_EXISTS(ENC)
2898
-        if (ELAPSED(now, next_button_update_ms) && BUTTON_PRESSED(ENC)) newbutton |= EN_C;
2899
-      #endif
2902
+        #endif // LCD_HAS_DIRECTIONAL_BUTTONS
2900 2903
 
2901
-      buttons = newbutton;
2902
-      #if ENABLED(LCD_HAS_SLOW_BUTTONS)
2903
-        buttons |= slow_buttons;
2904
-      #endif
2905
-      #if ENABLED(REPRAPWORLD_KEYPAD)
2906
-        GET_BUTTON_STATES(buttons_reprapworld_keypad);
2907
-      #endif
2908
-    #else
2909
-      GET_BUTTON_STATES(buttons);
2910
-    #endif //!NEWPANEL
2904
+        buttons = newbutton;
2905
+        #if ENABLED(LCD_HAS_SLOW_BUTTONS)
2906
+          buttons |= slow_buttons;
2907
+        #endif
2908
+        #if ENABLED(REPRAPWORLD_KEYPAD)
2909
+          GET_BUTTON_STATES(buttons_reprapworld_keypad);
2910
+        #endif
2911
+      #else
2912
+        GET_BUTTON_STATES(buttons);
2913
+      #endif //!NEWPANEL
2914
+
2915
+    } // next_button_update_ms
2911 2916
 
2912 2917
     // Manage encoder rotation
2913 2918
     #if ENABLED(REVERSE_MENU_DIRECTION) && ENABLED(REVERSE_ENCODER_DIRECTION)

Loading…
取消
儲存