|
@@ -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
|