|
@@ -218,11 +218,57 @@ static void createChar_P(const char c, const byte * const ptr) {
|
218
|
218
|
lcd.createChar(c, temp);
|
219
|
219
|
}
|
220
|
220
|
|
|
221
|
+#define CHARSET_MENU 0
|
|
222
|
+#define CHARSET_INFO 1
|
|
223
|
+#define CHARSET_BOOT 2
|
|
224
|
+
|
221
|
225
|
static void lcd_set_custom_characters(
|
222
|
|
- #if ENABLED(LCD_PROGRESS_BAR)
|
223
|
|
- const bool info_screen_charset = true
|
|
226
|
+ #if ENABLED(LCD_PROGRESS_BAR) || ENABLED(SHOW_BOOTSCREEN)
|
|
227
|
+ const uint8_t screen_charset=CHARSET_INFO
|
224
|
228
|
#endif
|
225
|
229
|
) {
|
|
230
|
+ // CHARSET_BOOT
|
|
231
|
+ #if ENABLED(SHOW_BOOTSCREEN)
|
|
232
|
+ const static PROGMEM byte corner[4][8] = { {
|
|
233
|
+ B00000,
|
|
234
|
+ B00000,
|
|
235
|
+ B00000,
|
|
236
|
+ B00000,
|
|
237
|
+ B00001,
|
|
238
|
+ B00010,
|
|
239
|
+ B00100,
|
|
240
|
+ B00100
|
|
241
|
+ }, {
|
|
242
|
+ B00000,
|
|
243
|
+ B00000,
|
|
244
|
+ B00000,
|
|
245
|
+ B11100,
|
|
246
|
+ B11100,
|
|
247
|
+ B01100,
|
|
248
|
+ B00100,
|
|
249
|
+ B00100
|
|
250
|
+ }, {
|
|
251
|
+ B00100,
|
|
252
|
+ B00010,
|
|
253
|
+ B00001,
|
|
254
|
+ B00000,
|
|
255
|
+ B00000,
|
|
256
|
+ B00000,
|
|
257
|
+ B00000,
|
|
258
|
+ B00000
|
|
259
|
+ }, {
|
|
260
|
+ B00100,
|
|
261
|
+ B01000,
|
|
262
|
+ B10000,
|
|
263
|
+ B00000,
|
|
264
|
+ B00000,
|
|
265
|
+ B00000,
|
|
266
|
+ B00000,
|
|
267
|
+ B00000
|
|
268
|
+ } };
|
|
269
|
+ #endif // SHOW_BOOTSCREEN
|
|
270
|
+
|
|
271
|
+ // CHARSET_INFO
|
226
|
272
|
const static PROGMEM byte bedTemp[8] = {
|
227
|
273
|
B00000,
|
228
|
274
|
B11111,
|
|
@@ -290,6 +336,8 @@ static void lcd_set_custom_characters(
|
290
|
336
|
};
|
291
|
337
|
|
292
|
338
|
#if ENABLED(SDSUPPORT)
|
|
339
|
+
|
|
340
|
+ // CHARSET_MENU
|
293
|
341
|
const static PROGMEM byte refresh[8] = {
|
294
|
342
|
B00000,
|
295
|
343
|
B00110,
|
|
@@ -312,6 +360,8 @@ static void lcd_set_custom_characters(
|
312
|
360
|
};
|
313
|
361
|
|
314
|
362
|
#if ENABLED(LCD_PROGRESS_BAR)
|
|
363
|
+
|
|
364
|
+ // CHARSET_INFO
|
315
|
365
|
const static PROGMEM byte progress[3][8] = { {
|
316
|
366
|
B00000,
|
317
|
367
|
B10000,
|
|
@@ -340,43 +390,61 @@ static void lcd_set_custom_characters(
|
340
|
390
|
B10101,
|
341
|
391
|
B00000
|
342
|
392
|
} };
|
343
|
|
- #endif
|
344
|
|
- #endif
|
345
|
393
|
|
346
|
|
- createChar_P(LCD_BEDTEMP_CHAR, bedTemp);
|
347
|
|
- createChar_P(LCD_DEGREE_CHAR, degree);
|
348
|
|
- createChar_P(LCD_STR_THERMOMETER[0], thermometer);
|
349
|
|
- createChar_P(LCD_FEEDRATE_CHAR, feedrate);
|
350
|
|
- createChar_P(LCD_CLOCK_CHAR, clock);
|
|
394
|
+ #endif // LCD_PROGRESS_BAR
|
351
|
395
|
|
352
|
|
- #if ENABLED(SDSUPPORT)
|
353
|
|
- #if ENABLED(LCD_PROGRESS_BAR)
|
354
|
|
- static bool char_mode = false;
|
355
|
|
- if (info_screen_charset != char_mode) {
|
356
|
|
- char_mode = info_screen_charset;
|
357
|
|
- if (info_screen_charset) { // Progress bar characters for info screen
|
358
|
|
- for (int16_t i = 3; i--;) createChar_P(LCD_STR_PROGRESS[i], progress[i]);
|
359
|
|
- }
|
360
|
|
- else { // Custom characters for submenus
|
361
|
|
- createChar_P(LCD_UPLEVEL_CHAR, uplevel);
|
362
|
|
- createChar_P(LCD_STR_REFRESH[0], refresh);
|
363
|
|
- createChar_P(LCD_STR_FOLDER[0], folder);
|
364
|
|
- }
|
365
|
|
- }
|
366
|
|
- #else
|
367
|
|
- createChar_P(LCD_UPLEVEL_CHAR, uplevel);
|
368
|
|
- createChar_P(LCD_STR_REFRESH[0], refresh);
|
369
|
|
- createChar_P(LCD_STR_FOLDER[0], folder);
|
370
|
|
- #endif
|
|
396
|
+ #endif // SDSUPPORT
|
371
|
397
|
|
|
398
|
+ #if ENABLED(SHOW_BOOTSCREEN) || ENABLED(LCD_PROGRESS_BAR)
|
|
399
|
+ static uint8_t char_mode = 0;
|
|
400
|
+ #define CHAR_COND (screen_charset != char_mode)
|
372
|
401
|
#else
|
373
|
|
- createChar_P(LCD_UPLEVEL_CHAR, uplevel);
|
|
402
|
+ #define CHAR_COND true
|
374
|
403
|
#endif
|
|
404
|
+
|
|
405
|
+ if (CHAR_COND) {
|
|
406
|
+ #if ENABLED(SHOW_BOOTSCREEN) || ENABLED(LCD_PROGRESS_BAR)
|
|
407
|
+ char_mode = screen_charset;
|
|
408
|
+ #if ENABLED(SHOW_BOOTSCREEN)
|
|
409
|
+ // Set boot screen corner characters
|
|
410
|
+ if (screen_charset == CHARSET_BOOT) {
|
|
411
|
+ for (uint8_t i = 4; i--;)
|
|
412
|
+ createChar_P(i, corner[i]);
|
|
413
|
+ }
|
|
414
|
+ else
|
|
415
|
+ #endif
|
|
416
|
+ #endif
|
|
417
|
+ { // Info Screen uses 5 special characters
|
|
418
|
+ createChar_P(LCD_BEDTEMP_CHAR, bedTemp);
|
|
419
|
+ createChar_P(LCD_DEGREE_CHAR, degree);
|
|
420
|
+ createChar_P(LCD_STR_THERMOMETER[0], thermometer);
|
|
421
|
+ createChar_P(LCD_FEEDRATE_CHAR, feedrate);
|
|
422
|
+ createChar_P(LCD_CLOCK_CHAR, clock);
|
|
423
|
+
|
|
424
|
+ #if ENABLED(SDSUPPORT)
|
|
425
|
+ #if ENABLED(LCD_PROGRESS_BAR)
|
|
426
|
+ if (screen_charset == CHARSET_INFO) { // 3 Progress bar characters for info screen
|
|
427
|
+ for (int16_t i = 3; i--;)
|
|
428
|
+ createChar_P(LCD_STR_PROGRESS[i], progress[i]);
|
|
429
|
+ }
|
|
430
|
+ else
|
|
431
|
+ #endif
|
|
432
|
+ { // SD Card sub-menu special characters
|
|
433
|
+ createChar_P(LCD_UPLEVEL_CHAR, uplevel);
|
|
434
|
+ createChar_P(LCD_STR_REFRESH[0], refresh);
|
|
435
|
+ createChar_P(LCD_STR_FOLDER[0], folder);
|
|
436
|
+ }
|
|
437
|
+ #else
|
|
438
|
+ // With no SD support, only need the uplevel character
|
|
439
|
+ createChar_P(LCD_UPLEVEL_CHAR, uplevel);
|
|
440
|
+ #endif
|
|
441
|
+ }
|
|
442
|
+ }
|
375
|
443
|
}
|
376
|
444
|
|
377
|
445
|
static void lcd_implementation_init(
|
378
|
446
|
#if ENABLED(LCD_PROGRESS_BAR)
|
379
|
|
- const bool info_screen_charset = true
|
|
447
|
+ const uint8_t screen_charset=CHARSET_INFO
|
380
|
448
|
#endif
|
381
|
449
|
) {
|
382
|
450
|
|
|
@@ -406,7 +474,7 @@ static void lcd_implementation_init(
|
406
|
474
|
|
407
|
475
|
lcd_set_custom_characters(
|
408
|
476
|
#if ENABLED(LCD_PROGRESS_BAR)
|
409
|
|
- info_screen_charset
|
|
477
|
+ screen_charset
|
410
|
478
|
#endif
|
411
|
479
|
);
|
412
|
480
|
|
|
@@ -458,46 +526,7 @@ void lcd_printPGM_utf(const char *str, uint8_t n=LCD_WIDTH) {
|
458
|
526
|
}
|
459
|
527
|
|
460
|
528
|
void lcd_bootscreen() {
|
461
|
|
- const static PROGMEM byte corner[4][8] = { {
|
462
|
|
- B00000,
|
463
|
|
- B00000,
|
464
|
|
- B00000,
|
465
|
|
- B00000,
|
466
|
|
- B00001,
|
467
|
|
- B00010,
|
468
|
|
- B00100,
|
469
|
|
- B00100
|
470
|
|
- }, {
|
471
|
|
- B00000,
|
472
|
|
- B00000,
|
473
|
|
- B00000,
|
474
|
|
- B11100,
|
475
|
|
- B11100,
|
476
|
|
- B01100,
|
477
|
|
- B00100,
|
478
|
|
- B00100
|
479
|
|
- }, {
|
480
|
|
- B00100,
|
481
|
|
- B00010,
|
482
|
|
- B00001,
|
483
|
|
- B00000,
|
484
|
|
- B00000,
|
485
|
|
- B00000,
|
486
|
|
- B00000,
|
487
|
|
- B00000
|
488
|
|
- }, {
|
489
|
|
- B00100,
|
490
|
|
- B01000,
|
491
|
|
- B10000,
|
492
|
|
- B00000,
|
493
|
|
- B00000,
|
494
|
|
- B00000,
|
495
|
|
- B00000,
|
496
|
|
- B00000
|
497
|
|
- } };
|
498
|
|
- for (uint8_t i = 0; i < 4; i++)
|
499
|
|
- createChar_P(i, corner[i]);
|
500
|
|
-
|
|
529
|
+ lcd_set_custom_characters(CHARSET_BOOT);
|
501
|
530
|
lcd.clear();
|
502
|
531
|
|
503
|
532
|
#define LCD_EXTRA_SPACE (LCD_WIDTH-8)
|
|
@@ -568,11 +597,7 @@ void lcd_printPGM_utf(const char *str, uint8_t n=LCD_WIDTH) {
|
568
|
597
|
|
569
|
598
|
safe_delay(100);
|
570
|
599
|
|
571
|
|
- lcd_set_custom_characters(
|
572
|
|
- #if ENABLED(LCD_PROGRESS_BAR)
|
573
|
|
- false
|
574
|
|
- #endif
|
575
|
|
- );
|
|
600
|
+ lcd_set_custom_characters();
|
576
|
601
|
}
|
577
|
602
|
|
578
|
603
|
#endif // SHOW_BOOTSCREEN
|