Browse Source

Merge pull request #3543 from thinkyhead/rc_better_bootscreen

Better splash screen consolidation
Scott Lahteine 8 years ago
parent
commit
09c6323b68
1 changed files with 37 additions and 11 deletions
  1. 37
    11
      Marlin/ultralcd_implementation_hitachi_HD44780.h

+ 37
- 11
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

@@ -445,7 +445,7 @@ unsigned lcd_print(char c) { return charset_mapper(c); }
445 445
     }
446 446
   }
447 447
 
448
-  inline void logo_lines(const char *extra) {
448
+  static void logo_lines(const char *extra) {
449 449
     int indent = (LCD_WIDTH - 8 - lcd_strlen_P(extra)) / 2;
450 450
     lcd.setCursor(indent, 0); lcd.print('\x00'); lcd_printPGM(PSTR( "------" ));  lcd.print('\x01');
451 451
     lcd.setCursor(indent, 1);                    lcd_printPGM(PSTR("|Marlin|"));  lcd_printPGM(extra);
@@ -503,38 +503,64 @@ unsigned lcd_print(char c) { return charset_mapper(c); }
503 503
 
504 504
     #define LCD_EXTRA_SPACE (LCD_WIDTH-8)
505 505
 
506
+    #define CENTER_OR_SCROLL(STRING,DELAY) \
507
+      lcd_erase_line(3); \
508
+      if (strlen(STRING) <= LCD_WIDTH) { \
509
+        lcd.setCursor((LCD_WIDTH - lcd_strlen_P(PSTR(STRING))) / 2, 3); \
510
+        lcd_printPGM(PSTR(STRING)); \
511
+        delay(DELAY); \
512
+      } \
513
+      else { \
514
+        lcd_scroll(0, 3, PSTR(STRING), LCD_WIDTH, DELAY); \
515
+      }
516
+
506 517
     #ifdef STRING_SPLASH_LINE1
507
-      // Combine into a single splash screen if possible
518
+      //
519
+      // Show the Marlin logo with splash line 1
520
+      //
508 521
       if (LCD_EXTRA_SPACE >= strlen(STRING_SPLASH_LINE1) + 1) {
522
+        //
523
+        // Show the Marlin logo, splash line1, and splash line 2
524
+        //
509 525
         logo_lines(PSTR(" " STRING_SPLASH_LINE1));
510 526
         #ifdef STRING_SPLASH_LINE2
511
-          lcd_erase_line(3);
512
-          lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE2), LCD_WIDTH, 2000);
527
+          CENTER_OR_SCROLL(STRING_SPLASH_LINE2, 2000);
513 528
         #else
514 529
           delay(2000);
515 530
         #endif
516 531
       }
517 532
       else {
533
+        //
534
+        // Show the Marlin logo with splash line 1
535
+        // After a delay show splash line 2, if it exists
536
+        //
537
+        #ifdef STRING_SPLASH_LINE2
538
+          #define _SPLASH_WAIT_1 1500
539
+        #else
540
+          #define _SPLASH_WAIT_1 2000
541
+        #endif
518 542
         logo_lines(PSTR(""));
519
-        lcd_erase_line(3);
520
-        lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE1), LCD_WIDTH, 1500);
543
+        CENTER_OR_SCROLL(STRING_SPLASH_LINE1, _SPLASH_WAIT_1);
521 544
         #ifdef STRING_SPLASH_LINE2
522
-          lcd_erase_line(3);
523
-          lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE2), LCD_WIDTH, 1500);
545
+          CENTER_OR_SCROLL(STRING_SPLASH_LINE2, 1500);
524 546
         #endif
525 547
       }
526 548
     #elif defined(STRING_SPLASH_LINE2)
527
-      // Combine into a single splash screen if possible
549
+      //
550
+      // Show splash line 2 only, alongside the logo if possible
551
+      //
528 552
       if (LCD_EXTRA_SPACE >= strlen(STRING_SPLASH_LINE2) + 1) {
529 553
         logo_lines(PSTR(" " STRING_SPLASH_LINE2));
530 554
         delay(2000);
531 555
       }
532 556
       else {
533 557
         logo_lines(PSTR(""));
534
-        lcd_erase_line(3);
535
-        lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE2), LCD_WIDTH, 2000);
558
+        CENTER_OR_SCROLL(STRING_SPLASH_LINE2, 2000);
536 559
       }
537 560
     #else
561
+      //
562
+      // Show only the Marlin logo
563
+      //
538 564
       logo_lines(PSTR(""));
539 565
       delay(2000);
540 566
     #endif

Loading…
Cancel
Save