Bläddra i källkod

Relocate click ignore code into info screen

Scott Lahteine 10 år sedan
förälder
incheckning
aa4160ba62
1 ändrade filer med 22 tillägg och 21 borttagningar
  1. 22
    21
      Marlin/ultralcd.cpp

+ 22
- 21
Marlin/ultralcd.cpp Visa fil

@@ -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;
@@ -1294,6 +1313,7 @@ void lcd_update()
1294 1313
 void lcd_ignore_click(bool b)
1295 1314
 {
1296 1315
     ignore_click = b;
1316
+    wait_for_unclick = false;
1297 1317
 }
1298 1318
 
1299 1319
 void lcd_setstatus(const char* message)
@@ -1425,26 +1445,7 @@ void lcd_buzz(long duration, uint16_t freq)
1425 1445
 
1426 1446
 bool lcd_clicked()
1427 1447
 {
1428
-  static bool wait_for_unclick = false;
1429
-  bool current_click = LCD_CLICKED;
1430
-
1431
-  if (ignore_click) {
1432
-    if (wait_for_unclick) {
1433
-      if (!current_click) {
1434
-        ignore_click = wait_for_unclick = false;
1435
-      }
1436
-      else {
1437
-        current_click = false;
1438
-      }
1439
-    }
1440
-    else if (current_click) {
1441
-      wait_for_unclick = true;
1442
-      current_click = false;
1443
-      lcd_quick_feedback();
1444
-    }
1445
-  }
1446
-
1447
-  return current_click;
1448
+  return LCD_CLICKED;
1448 1449
 }
1449 1450
 #endif//ULTIPANEL
1450 1451
 

Laddar…
Avbryt
Spara