瀏覽代碼

Followup to G33/LCD patch #8318

Scott Lahteine 7 年之前
父節點
當前提交
4a857f1af6
共有 1 個檔案被更改,包括 39 行新增40 行删除
  1. 39
    40
      Marlin/ultralcd.cpp

+ 39
- 40
Marlin/ultralcd.cpp 查看文件

4746
     #endif
4746
     #endif
4747
 
4747
 
4748
     if ((lcdDrawUpdate || IS_DRAWING) && (!bbr2 || bbr2 > max_display_update_time)) {
4748
     if ((lcdDrawUpdate || IS_DRAWING) && (!bbr2 || bbr2 > max_display_update_time)) {
4749
-      #if ENABLED(DOGLCD)
4750
-        if (!drawing_screen)
4751
-      #endif
4752
-        {
4753
-          switch (lcdDrawUpdate) {
4754
-            case LCDVIEW_CALL_NO_REDRAW:
4755
-              lcdDrawUpdate = LCDVIEW_NONE;
4756
-              break;
4757
-            case LCDVIEW_CLEAR_CALL_REDRAW: // set by handlers, then altered after (rarely occurs here)
4758
-            case LCDVIEW_CALL_REDRAW_NEXT:  // set by handlers, then altered after (never occurs here?)
4759
-              lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
4760
-            case LCDVIEW_REDRAW_NOW:        // set above, or by a handler through LCDVIEW_CALL_REDRAW_NEXT
4761
-            case LCDVIEW_NONE:
4762
-              break;
4763
-          } // switch
4764
-        }
4749
+
4750
+      if (!IS_DRAWING) switch (lcdDrawUpdate) {
4751
+        case LCDVIEW_CALL_NO_REDRAW:
4752
+          lcdDrawUpdate = LCDVIEW_NONE;
4753
+          break;
4754
+        case LCDVIEW_CLEAR_CALL_REDRAW: // set by handlers, then altered after (rarely occurs here)
4755
+        case LCDVIEW_CALL_REDRAW_NEXT:  // set by handlers, then altered after (never occurs here?)
4756
+          lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
4757
+        case LCDVIEW_REDRAW_NOW:        // set above, or by a handler through LCDVIEW_CALL_REDRAW_NEXT
4758
+        case LCDVIEW_NONE:
4759
+          break;
4760
+      } // switch
4765
 
4761
 
4766
       #if ENABLED(ADC_KEYPAD)
4762
       #if ENABLED(ADC_KEYPAD)
4767
         buttons_reprapworld_keypad = 0;
4763
         buttons_reprapworld_keypad = 0;
4773
         #define CURRENTSCREEN() lcd_status_screen()
4769
         #define CURRENTSCREEN() lcd_status_screen()
4774
       #endif
4770
       #endif
4775
 
4771
 
4776
-      #if ENABLED(DOGLCD)  // Changes due to different driver architecture of the DOGM display
4777
-        if (!drawing_screen) {
4778
-          u8g.firstPage();
4779
-          drawing_screen = 1;
4772
+      #if ENABLED(DOGLCD)
4773
+        if (!drawing_screen) {                        // If not already drawing pages
4774
+          u8g.firstPage();                            // Start the first page
4775
+          drawing_screen = 1;                         // Flag as drawing pages
4780
         }
4776
         }
4781
-        lcd_setFont(FONT_MENU);
4782
-        u8g.setColorIndex(1);
4783
-        CURRENTSCREEN();
4777
+        lcd_setFont(FONT_MENU);                       // Setup font for every page draw
4778
+        u8g.setColorIndex(1);                         // And reset the color
4779
+        CURRENTSCREEN();                              // Draw and process the current screen
4780
+
4781
+        // The screen handler can clear drawing_screen for an action that changes the screen.
4782
+        // If still drawing and there's another page, update max-time and return now.
4783
+        // The nextPage will already be set up on the next call.
4784
         if (drawing_screen && (drawing_screen = u8g.nextPage())) {
4784
         if (drawing_screen && (drawing_screen = u8g.nextPage())) {
4785
           NOLESS(max_display_update_time, millis() - ms);
4785
           NOLESS(max_display_update_time, millis() - ms);
4786
           return;
4786
           return;
4788
       #else
4788
       #else
4789
         CURRENTSCREEN();
4789
         CURRENTSCREEN();
4790
       #endif
4790
       #endif
4791
+
4792
+      // Keeping track of the longest time for an individual LCD update.
4793
+      // Used to do screen throttling when the planner starts to fill up.
4791
       NOLESS(max_display_update_time, millis() - ms);
4794
       NOLESS(max_display_update_time, millis() - ms);
4792
     }
4795
     }
4793
 
4796
 
4801
 
4804
 
4802
     #endif // ULTIPANEL
4805
     #endif // ULTIPANEL
4803
 
4806
 
4804
-    #if ENABLED(DOGLCD)
4805
-      if (!drawing_screen)
4806
-    #endif
4807
-      {
4808
-        switch (lcdDrawUpdate) {
4809
-          case LCDVIEW_CLEAR_CALL_REDRAW:
4810
-            lcd_implementation_clear();
4811
-          case LCDVIEW_CALL_REDRAW_NEXT:
4812
-            lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
4813
-            break;
4814
-          case LCDVIEW_REDRAW_NOW:
4815
-            lcdDrawUpdate = LCDVIEW_NONE;
4816
-            break;
4817
-          case LCDVIEW_NONE:
4818
-            break;
4819
-        } // switch
4820
-      }
4807
+    if (!IS_DRAWING) switch (lcdDrawUpdate) {
4808
+      case LCDVIEW_CLEAR_CALL_REDRAW:
4809
+        lcd_implementation_clear();
4810
+      case LCDVIEW_CALL_REDRAW_NEXT:
4811
+        lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
4812
+        break;
4813
+      case LCDVIEW_REDRAW_NOW:
4814
+        lcdDrawUpdate = LCDVIEW_NONE;
4815
+        break;
4816
+      case LCDVIEW_NONE:
4817
+        break;
4818
+    } // switch
4819
+
4821
   } // ELAPSED(ms, next_lcd_update_ms)
4820
   } // ELAPSED(ms, next_lcd_update_ms)
4822
 }
4821
 }
4823
 
4822
 

Loading…
取消
儲存