瀏覽代碼

Merge pull request #1817 from AnHardt/dogm_looptest

Execute DOGM display-loop less often
Scott Lahteine 9 年之前
父節點
當前提交
cb02bc6db4
共有 1 個文件被更改,包括 24 次插入24 次删除
  1. 24
    24
      Marlin/ultralcd.cpp

+ 24
- 24
Marlin/ultralcd.cpp 查看文件

@@ -262,8 +262,7 @@ static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool
262 262
 }
263 263
 
264 264
 /* Main status screen. It's up to the implementation specific part to show what is needed. As this is very display dependent */
265
-static void lcd_status_screen()
266
-{
265
+static void lcd_status_screen() {
267 266
 	encoderRateMultiplierEnabled = false;
268 267
 
269 268
   #ifdef LCD_PROGRESS_BAR
@@ -296,15 +295,7 @@ static void lcd_status_screen()
296 295
     #endif
297 296
   #endif //LCD_PROGRESS_BAR
298 297
 
299
-  if (lcd_status_update_delay)
300
-    lcd_status_update_delay--;
301
-  else
302
-    lcdDrawUpdate = 1;
303
-
304
-  if (lcdDrawUpdate) {
305 298
     lcd_implementation_status_screen();
306
-    lcd_status_update_delay = 10;   /* redraw the main screen every second. This is easier then trying keep track of all things that change on the screen */
307
-  }
308 299
 
309 300
 #ifdef ULTIPANEL
310 301
 
@@ -1298,7 +1289,7 @@ void lcd_update() {
1298 1289
       }
1299 1290
     }
1300 1291
   #endif//CARDINSERTED
1301
-
1292
+  
1302 1293
   uint32_t ms = millis();
1303 1294
   if (ms > lcd_next_update_millis) {
1304 1295
 
@@ -1349,27 +1340,36 @@ void lcd_update() {
1349 1340
             } // encoderRateMultiplierEnabled
1350 1341
           #endif //ENCODER_RATE_MULTIPLIER
1351 1342
 
1352
-          lcdDrawUpdate = 1;
1353 1343
           encoderPosition += (encoderDiff * encoderMultiplier) / ENCODER_PULSES_PER_STEP;
1354 1344
           encoderDiff = 0;
1355 1345
         }
1356 1346
         timeoutToStatus = ms + LCD_TIMEOUT_TO_STATUS;
1347
+        lcdDrawUpdate = 1;
1357 1348
       }
1358
-
1359 1349
     #endif //ULTIPANEL
1360 1350
 
1351
+    if (currentMenu == lcd_status_screen) {
1352
+      if (!lcd_status_update_delay) {
1353
+        lcdDrawUpdate = 1;
1354
+        lcd_status_update_delay = 10;   /* redraw the main screen every second. This is easier then trying keep track of all things that change on the screen */
1355
+      }
1356
+      else {
1357
+        lcd_status_update_delay--;
1358
+      }
1359
+    }
1361 1360
     #ifdef DOGLCD  // Changes due to different driver architecture of the DOGM display
1362
-      blink++;     // Variable for fan animation and alive dot
1363
-      u8g.firstPage();
1364
-      do {
1365
-        lcd_setFont(FONT_MENU);
1366
-        u8g.setPrintPos(125, 0);
1367
-        if (blink % 2) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot
1368
-        u8g.drawPixel(127, 63); // draw alive dot
1369
-        u8g.setColorIndex(1); // black on white
1370
-        (*currentMenu)();
1371
-        if (!lcdDrawUpdate) break; // Terminate display update, when nothing new to draw. This must be done before the last dogm.next()
1372
-      } while( u8g.nextPage() );
1361
+      if (lcdDrawUpdate) {
1362
+        blink++;     // Variable for fan animation and alive dot
1363
+        u8g.firstPage();
1364
+        do {
1365
+          lcd_setFont(FONT_MENU);
1366
+          u8g.setPrintPos(125, 0);
1367
+          if (blink % 2) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot
1368
+          u8g.drawPixel(127, 63); // draw alive dot
1369
+          u8g.setColorIndex(1); // black on white
1370
+          (*currentMenu)();
1371
+        } while( u8g.nextPage() );
1372
+      }
1373 1373
     #else
1374 1374
       (*currentMenu)();
1375 1375
     #endif

Loading…
取消
儲存