Browse Source

Merge pull request #4803 from thinkyhead/rc_lcd_button_fix

Clear LCD button state, apply timer to all
Scott Lahteine 8 years ago
parent
commit
e40646de42
1 changed files with 33 additions and 28 deletions
  1. 33
    28
      Marlin/ultralcd.cpp

+ 33
- 28
Marlin/ultralcd.cpp View File

2361
 
2361
 
2362
   void lcd_quick_feedback() {
2362
   void lcd_quick_feedback() {
2363
     lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
2363
     lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
2364
+    buttons = 0;
2364
     next_button_update_ms = millis() + 500;
2365
     next_button_update_ms = millis() + 500;
2365
 
2366
 
2366
     // Buzz and wait. The delay is needed for buttons to settle!
2367
     // Buzz and wait. The delay is needed for buttons to settle!
2850
    * Warning: This function is called from interrupt context!
2851
    * Warning: This function is called from interrupt context!
2851
    */
2852
    */
2852
   void lcd_buttons_update() {
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
           if (false) {
2874
           if (false) {
2868
             // for the else-ifs below
2875
             // for the else-ifs below
2869
           }
2876
           }
2891
               next_button_update_ms = now + 300;
2898
               next_button_update_ms = now + 300;
2892
             }
2899
             }
2893
           #endif
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
     // Manage encoder rotation
2917
     // Manage encoder rotation
2913
     #if ENABLED(REVERSE_MENU_DIRECTION) && ENABLED(REVERSE_ENCODER_DIRECTION)
2918
     #if ENABLED(REVERSE_MENU_DIRECTION) && ENABLED(REVERSE_ENCODER_DIRECTION)

Loading…
Cancel
Save