Browse Source

Relocate click ignore code into info screen

Scott Lahteine 10 years ago
parent
commit
3f54c9ba33
1 changed files with 22 additions and 21 deletions
  1. 22
    21
      Marlin/ultralcd.cpp

+ 22
- 21
Marlin/ultralcd.cpp View File

@@ -163,6 +163,7 @@ menuFunc_t currentMenu = lcd_status_screen; /* function pointer to the currently
163 163
 uint32_t lcd_next_update_millis;
164 164
 uint8_t lcd_status_update_delay;
165 165
 bool ignore_click = false;
166
+bool wait_for_unclick;
166 167
 uint8_t lcdDrawUpdate = 2;                  /* Set to none-zero when the LCD needs to draw, decreased after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial) */
167 168
 
168 169
 //prevMenu and prevEncoderPosition are used to store the previous menu location when editing settings.
@@ -191,7 +192,25 @@ static void lcd_status_screen()
191 192
     }
192 193
 #ifdef ULTIPANEL
193 194
 
194
-    if (lcd_clicked())
195
+    bool current_click = LCD_CLICKED;
196
+
197
+    if (ignore_click) {
198
+        if (wait_for_unclick) {
199
+          if (!current_click) {
200
+              ignore_click = wait_for_unclick = false;
201
+          }
202
+          else {
203
+              current_click = false;
204
+          }
205
+        }
206
+        else if (current_click) {
207
+            lcd_quick_feedback();
208
+            wait_for_unclick = true;
209
+            current_click = false;
210
+        }
211
+    }
212
+
213
+    if (current_click)
195 214
     {
196 215
         currentMenu = lcd_main_menu;
197 216
         encoderPosition = 0;
@@ -1320,6 +1339,7 @@ void lcd_update()
1320 1339
 void lcd_ignore_click(bool b)
1321 1340
 {
1322 1341
     ignore_click = b;
1342
+    wait_for_unclick = false;
1323 1343
 }
1324 1344
 
1325 1345
 void lcd_setstatus(const char* message)
@@ -1451,26 +1471,7 @@ void lcd_buzz(long duration, uint16_t freq)
1451 1471
 
1452 1472
 bool lcd_clicked()
1453 1473
 {
1454
-  static bool wait_for_unclick = false;
1455
-  bool current_click = LCD_CLICKED;
1456
-
1457
-  if (ignore_click) {
1458
-    if (wait_for_unclick) {
1459
-      if (!current_click) {
1460
-        ignore_click = wait_for_unclick = false;
1461
-      }
1462
-      else {
1463
-        current_click = false;
1464
-      }
1465
-    }
1466
-    else if (current_click) {
1467
-      wait_for_unclick = true;
1468
-      current_click = false;
1469
-      lcd_quick_feedback();
1470
-    }
1471
-  }
1472
-
1473
-  return current_click;
1474
+  return LCD_CLICKED;
1474 1475
 }
1475 1476
 #endif//ULTIPANEL
1476 1477
 

Loading…
Cancel
Save