Przeglądaj źródła

Speedup sreen update delay

Speedup sreen update delay
and correct a comment.

A module division by 10 is slooooow. (powers of 2 are fast - but then you can AND a bitmask with the same result)
AnHardt 9 lat temu
rodzic
commit
0c4d885d5b
1 zmienionych plików z 6 dodań i 3 usunięć
  1. 6
    3
      Marlin/ultralcd.cpp

+ 6
- 3
Marlin/ultralcd.cpp Wyświetl plik

@@ -282,7 +282,6 @@ menuPosition menu_history[10];
282 282
 uint8_t menu_history_depth = 0;
283 283
 
284 284
 millis_t next_lcd_update_ms;
285
-uint8_t lcd_status_update_delay;
286 285
 bool ignore_click = false;
287 286
 bool wait_for_unclick;
288 287
 bool defer_return_to_status = false;
@@ -2248,9 +2247,13 @@ void lcd_update() {
2248 2247
       }
2249 2248
     #endif //ULTIPANEL
2250 2249
 
2251
-    // Simply redraw the Info Screen 10 times a second
2252
-    if (currentMenu == lcd_status_screen && !(++lcd_status_update_delay % 10))
2250
+    // Here we arrive every ~100ms when ideling often enough.
2251
+    // Instead of tracking the changes simply redraw the Info Screen ~1 time a second.
2252
+    static int8_t lcd_status_update_delay = 1; // first update one loop delayed
2253
+    if (currentMenu == lcd_status_screen && !lcd_status_update_delay--) {
2254
+      lcd_status_update_delay = 9;
2253 2255
       lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
2256
+    }
2254 2257
 
2255 2258
     if (lcdDrawUpdate) {
2256 2259
 

Ładowanie…
Anuluj
Zapisz