Explorar el Código

Followup to G33/LCD patch #8318

Scott Lahteine hace 7 años
padre
commit
4a857f1af6
Se han modificado 1 ficheros con 39 adiciones y 40 borrados
  1. 39
    40
      Marlin/ultralcd.cpp

+ 39
- 40
Marlin/ultralcd.cpp Ver fichero

@@ -4746,22 +4746,18 @@ void lcd_update() {
4746 4746
     #endif
4747 4747
 
4748 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 4762
       #if ENABLED(ADC_KEYPAD)
4767 4763
         buttons_reprapworld_keypad = 0;
@@ -4773,14 +4769,18 @@ void lcd_update() {
4773 4769
         #define CURRENTSCREEN() lcd_status_screen()
4774 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 4784
         if (drawing_screen && (drawing_screen = u8g.nextPage())) {
4785 4785
           NOLESS(max_display_update_time, millis() - ms);
4786 4786
           return;
@@ -4788,6 +4788,9 @@ void lcd_update() {
4788 4788
       #else
4789 4789
         CURRENTSCREEN();
4790 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 4794
       NOLESS(max_display_update_time, millis() - ms);
4792 4795
     }
4793 4796
 
@@ -4801,23 +4804,19 @@ void lcd_update() {
4801 4804
 
4802 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 4820
   } // ELAPSED(ms, next_lcd_update_ms)
4822 4821
 }
4823 4822
 

Loading…
Cancelar
Guardar