Pārlūkot izejas kodu

Make lcd_bootscreen common to both

Scott Lahteine 8 gadus atpakaļ
vecāks
revīzija
ae5923a3d0

+ 8
- 3
Marlin/Marlin_main.cpp Parādīt failu

13034
   #endif
13034
   #endif
13035
 
13035
 
13036
   lcd_init();
13036
   lcd_init();
13037
+
13037
   #if ENABLED(SHOW_BOOTSCREEN)
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
     #elif ENABLED(ULTRA_LCD)
13045
     #elif ENABLED(ULTRA_LCD)
13041
-      bootscreen();
13046
+      lcd_bootscreen();
13042
       #if DISABLED(SDSUPPORT)
13047
       #if DISABLED(SDSUPPORT)
13043
         lcd_init();
13048
         lcd_init();
13044
       #endif
13049
       #endif

+ 4
- 2
Marlin/ultralcd.h Parādīt failu

64
   #if ENABLED(DOGLCD)
64
   #if ENABLED(DOGLCD)
65
     extern uint16_t lcd_contrast;
65
     extern uint16_t lcd_contrast;
66
     void set_lcd_contrast(const uint16_t value);
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
   #endif
71
   #endif
70
 
72
 
71
   #define LCD_UPDATE_INTERVAL 100
73
   #define LCD_UPDATE_INTERVAL 100

+ 52
- 40
Marlin/ultralcd_impl_DOGM.h Parādīt failu

256
   while (n && (c = pgm_read_byte(str))) n -= charset_mapper(c), ++str;
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
 // Initialize or re-initialize the LCD
308
 // Initialize or re-initialize the LCD
260
 static void lcd_implementation_init() {
309
 static void lcd_implementation_init() {
261
 
310
 
284
   #endif
333
   #endif
285
 
334
 
286
   #if ENABLED(SHOW_BOOTSCREEN)
335
   #if ENABLED(SHOW_BOOTSCREEN)
287
-    static bool show_bootscreen = true;
288
-
289
     #if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
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
     #else
338
     #else
307
-      constexpr uint8_t offy = DOG_CHAR_HEIGHT;
339
+      lcd_bootscreen();
308
     #endif
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
 // The kill screen is displayed for unrecoverable conditions
344
 // The kill screen is displayed for unrecoverable conditions

+ 1
- 1
Marlin/ultralcd_impl_HD44780.h Parādīt failu

443
     lcd.setCursor(indent, 2); lcd.write('\x02'); lcd_printPGM(PSTR( "------" ));  lcd.write('\x03');
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
     const static PROGMEM byte corner[4][8] = { {
447
     const static PROGMEM byte corner[4][8] = { {
448
       B00000,
448
       B00000,
449
       B00000,
449
       B00000,

Notiek ielāde…
Atcelt
Saglabāt