Procházet zdrojové kódy

Relocate click ignore code into info screen

Scott Lahteine před 10 roky
rodič
revize
aa4160ba62
1 změnil soubory, kde provedl 22 přidání a 21 odebrání
  1. 22
    21
      Marlin/ultralcd.cpp

+ 22
- 21
Marlin/ultralcd.cpp Zobrazit soubor

163
 uint32_t lcd_next_update_millis;
163
 uint32_t lcd_next_update_millis;
164
 uint8_t lcd_status_update_delay;
164
 uint8_t lcd_status_update_delay;
165
 bool ignore_click = false;
165
 bool ignore_click = false;
166
+bool wait_for_unclick;
166
 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
 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
 //prevMenu and prevEncoderPosition are used to store the previous menu location when editing settings.
169
 //prevMenu and prevEncoderPosition are used to store the previous menu location when editing settings.
191
     }
192
     }
192
 #ifdef ULTIPANEL
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
         currentMenu = lcd_main_menu;
215
         currentMenu = lcd_main_menu;
197
         encoderPosition = 0;
216
         encoderPosition = 0;
1294
 void lcd_ignore_click(bool b)
1313
 void lcd_ignore_click(bool b)
1295
 {
1314
 {
1296
     ignore_click = b;
1315
     ignore_click = b;
1316
+    wait_for_unclick = false;
1297
 }
1317
 }
1298
 
1318
 
1299
 void lcd_setstatus(const char* message)
1319
 void lcd_setstatus(const char* message)
1425
 
1445
 
1426
 bool lcd_clicked()
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
 #endif//ULTIPANEL
1450
 #endif//ULTIPANEL
1450
 
1451
 

Loading…
Zrušit
Uložit