Browse Source

Merge pull request #7211 from thinkyhead/bf_lcd_bootscreen

Use lcd_bootscreen for both
Scott Lahteine 7 years ago
parent
commit
395a9f59ac
5 changed files with 66 additions and 47 deletions
  1. 8
    3
      Marlin/Marlin_main.cpp
  2. 1
    1
      Marlin/gcode.h
  3. 4
    2
      Marlin/ultralcd.h
  4. 52
    40
      Marlin/ultralcd_impl_DOGM.h
  5. 1
    1
      Marlin/ultralcd_impl_HD44780.h

+ 8
- 3
Marlin/Marlin_main.cpp View File

@@ -13034,11 +13034,16 @@ void setup() {
13034 13034
   #endif
13035 13035
 
13036 13036
   lcd_init();
13037
+
13037 13038
   #if ENABLED(SHOW_BOOTSCREEN)
13038
-    #if ENABLED(DOGLCD)
13039
-      safe_delay(BOOTSCREEN_TIMEOUT);
13039
+    #if ENABLED(DOGLCD)                           // On DOGM the first bootscreen is already drawn
13040
+      #if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
13041
+        safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT);    // Custom boot screen pause
13042
+        lcd_bootscreen();                         // Show Marlin boot screen
13043
+      #endif
13044
+      safe_delay(BOOTSCREEN_TIMEOUT);             // Pause
13040 13045
     #elif ENABLED(ULTRA_LCD)
13041
-      bootscreen();
13046
+      lcd_bootscreen();
13042 13047
       #if DISABLED(SDSUPPORT)
13043 13048
         lcd_init();
13044 13049
       #endif

+ 1
- 1
Marlin/gcode.h View File

@@ -124,7 +124,7 @@ public:
124 124
         if (debug) {
125 125
           SERIAL_ECHOPAIR("Set bit ", (int)PARAM_BIT(ind));
126 126
           SERIAL_ECHOPAIR(" of index ", (int)PARAM_IND(ind));
127
-          SERIAL_ECHOLNPAIR(" | param = ", hex_address((void*)param[ind]));
127
+          SERIAL_ECHOLNPAIR(" | param = ", (int)param[ind]);
128 128
         }
129 129
       #endif
130 130
     }

+ 4
- 2
Marlin/ultralcd.h View File

@@ -64,8 +64,10 @@
64 64
   #if ENABLED(DOGLCD)
65 65
     extern uint16_t lcd_contrast;
66 66
     void set_lcd_contrast(const uint16_t value);
67
-  #elif ENABLED(SHOW_BOOTSCREEN)
68
-    void bootscreen();
67
+  #endif
68
+
69
+  #if ENABLED(SHOW_BOOTSCREEN)
70
+    void lcd_bootscreen();
69 71
   #endif
70 72
 
71 73
   #define LCD_UPDATE_INTERVAL 100

+ 52
- 40
Marlin/ultralcd_impl_DOGM.h View File

@@ -256,6 +256,55 @@ void lcd_printPGM_utf(const char *str, uint8_t n=LCD_WIDTH) {
256 256
   while (n && (c = pgm_read_byte(str))) n -= charset_mapper(c), ++str;
257 257
 }
258 258
 
259
+#if ENABLED(SHOW_BOOTSCREEN)
260
+
261
+  #if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
262
+
263
+    void lcd_custom_bootscreen() {
264
+      u8g.firstPage();
265
+      do {
266
+        u8g.drawBitmapP(
267
+          (128 - (CUSTOM_BOOTSCREEN_BMPWIDTH))  /2,
268
+          ( 64 - (CUSTOM_BOOTSCREEN_BMPHEIGHT)) /2,
269
+          CEILING(CUSTOM_BOOTSCREEN_BMPWIDTH, 8), CUSTOM_BOOTSCREEN_BMPHEIGHT, custom_start_bmp);
270
+      } while (u8g.nextPage());
271
+    }
272
+
273
+  #endif // SHOW_CUSTOM_BOOTSCREEN
274
+
275
+  void lcd_bootscreen() {
276
+
277
+    static bool show_bootscreen = true;
278
+
279
+    if (show_bootscreen) {
280
+      show_bootscreen = false;
281
+
282
+      #if ENABLED(START_BMPHIGH)
283
+        constexpr uint8_t offy = 0;
284
+      #else
285
+        constexpr uint8_t offy = DOG_CHAR_HEIGHT;
286
+      #endif
287
+
288
+      const uint8_t offx = (u8g.getWidth() - (START_BMPWIDTH)) / 2,
289
+                    txt1X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE1) - 1) * (DOG_CHAR_WIDTH)) / 2;
290
+
291
+      u8g.firstPage();
292
+      do {
293
+        u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
294
+        lcd_setFont(FONT_MENU);
295
+        #ifndef STRING_SPLASH_LINE2
296
+          u8g.drawStr(txt1X, u8g.getHeight() - (DOG_CHAR_HEIGHT), STRING_SPLASH_LINE1);
297
+        #else
298
+          const uint8_t txt2X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE2) - 1) * (DOG_CHAR_WIDTH)) / 2;
299
+          u8g.drawStr(txt1X, u8g.getHeight() - (DOG_CHAR_HEIGHT) * 3 / 2, STRING_SPLASH_LINE1);
300
+          u8g.drawStr(txt2X, u8g.getHeight() - (DOG_CHAR_HEIGHT) * 1 / 2, STRING_SPLASH_LINE2);
301
+        #endif
302
+      } while (u8g.nextPage());
303
+    }
304
+  }
305
+
306
+#endif // SHOW_BOOTSCREEN
307
+
259 308
 // Initialize or re-initialize the LCD
260 309
 static void lcd_implementation_init() {
261 310
 
@@ -284,49 +333,12 @@ static void lcd_implementation_init() {
284 333
   #endif
285 334
 
286 335
   #if ENABLED(SHOW_BOOTSCREEN)
287
-    static bool show_bootscreen = true;
288
-
289 336
     #if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
290
-      if (show_bootscreen) {
291
-        u8g.firstPage();
292
-        do {
293
-          u8g.drawBitmapP(
294
-            (128 - (CUSTOM_BOOTSCREEN_BMPWIDTH))  /2,
295
-            ( 64 - (CUSTOM_BOOTSCREEN_BMPHEIGHT)) /2,
296
-            CEILING(CUSTOM_BOOTSCREEN_BMPWIDTH, 8), CUSTOM_BOOTSCREEN_BMPHEIGHT, custom_start_bmp);
297
-        } while (u8g.nextPage());
298
-        safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT);
299
-      }
300
-    #endif // SHOW_CUSTOM_BOOTSCREEN
301
-
302
-    const uint8_t offx = (u8g.getWidth() - (START_BMPWIDTH)) / 2;
303
-
304
-    #if ENABLED(START_BMPHIGH)
305
-      constexpr uint8_t offy = 0;
337
+      lcd_custom_bootscreen();
306 338
     #else
307
-      constexpr uint8_t offy = DOG_CHAR_HEIGHT;
339
+      lcd_bootscreen();
308 340
     #endif
309
-
310
-    const uint8_t txt1X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE1) - 1) * (DOG_CHAR_WIDTH)) / 2;
311
-
312
-    if (show_bootscreen) {
313
-      u8g.firstPage();
314
-      do {
315
-        u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
316
-        lcd_setFont(FONT_MENU);
317
-        #ifndef STRING_SPLASH_LINE2
318
-          u8g.drawStr(txt1X, u8g.getHeight() - (DOG_CHAR_HEIGHT), STRING_SPLASH_LINE1);
319
-        #else
320
-          const uint8_t txt2X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE2) - 1) * (DOG_CHAR_WIDTH)) / 2;
321
-          u8g.drawStr(txt1X, u8g.getHeight() - (DOG_CHAR_HEIGHT) * 3 / 2, STRING_SPLASH_LINE1);
322
-          u8g.drawStr(txt2X, u8g.getHeight() - (DOG_CHAR_HEIGHT) * 1 / 2, STRING_SPLASH_LINE2);
323
-        #endif
324
-      } while (u8g.nextPage());
325
-    }
326
-
327
-    show_bootscreen = false;
328
-
329
-  #endif // SHOW_BOOTSCREEN
341
+  #endif
330 342
 }
331 343
 
332 344
 // The kill screen is displayed for unrecoverable conditions

+ 1
- 1
Marlin/ultralcd_impl_HD44780.h View File

@@ -443,7 +443,7 @@ void lcd_printPGM_utf(const char *str, uint8_t n=LCD_WIDTH) {
443 443
     lcd.setCursor(indent, 2); lcd.write('\x02'); lcd_printPGM(PSTR( "------" ));  lcd.write('\x03');
444 444
   }
445 445
 
446
-  void bootscreen() {
446
+  void lcd_bootscreen() {
447 447
     const static PROGMEM byte corner[4][8] = { {
448 448
       B00000,
449 449
       B00000,

Loading…
Cancel
Save