Browse Source

On wider screens show a wider splash page, if possible

Scott Lahteine 9 years ago
parent
commit
86467c24be
1 changed files with 41 additions and 12 deletions
  1. 41
    12
      Marlin/ultralcd_implementation_hitachi_HD44780.h

+ 41
- 12
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

445
     }
445
     }
446
   }
446
   }
447
 
447
 
448
+  inline void logo_lines(const char *extra) {
449
+    int indent = (LCD_WIDTH - 8 - lcd_strlen_P(extra)) / 2;
450
+    lcd.setCursor(indent, 0); lcd.print('\x00'); lcd_printPGM(PSTR( "------" ));  lcd.print('\x01');
451
+    lcd.setCursor(indent, 1);                    lcd_printPGM(PSTR("|Marlin|"));  lcd_printPGM(extra);
452
+    lcd.setCursor(indent, 2); lcd.print('\x02'); lcd_printPGM(PSTR( "------" ));  lcd.print('\x03');
453
+  }
454
+
448
   static void bootscreen() {
455
   static void bootscreen() {
449
     show_bootscreen = false;
456
     show_bootscreen = false;
450
     byte top_left[8] = {
457
     byte top_left[8] = {
494
 
501
 
495
     lcd.clear();
502
     lcd.clear();
496
 
503
 
497
-    #define TEXT_SCREEN_LOGO_SHIFT ((LCD_WIDTH/2) - 4)
498
-    lcd.setCursor(TEXT_SCREEN_LOGO_SHIFT, 0); lcd.print('\x00'); lcd_printPGM(PSTR( "------" ));  lcd.print('\x01');
499
-    lcd.setCursor(TEXT_SCREEN_LOGO_SHIFT, 1);                    lcd_printPGM(PSTR("|Marlin|"));
500
-    lcd.setCursor(TEXT_SCREEN_LOGO_SHIFT, 2); lcd.print('\x02'); lcd_printPGM(PSTR( "------" ));  lcd.print('\x03');
501
-
502
-    delay(2000);
504
+    #define LCD_EXTRA_SPACE (LCD_WIDTH-8)
503
 
505
 
504
     #ifdef STRING_SPLASH_LINE1
506
     #ifdef STRING_SPLASH_LINE1
505
-      lcd_erase_line(3);
506
-      lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE1), LCD_WIDTH, 1000);
507
+      // Combine into a single splash screen if possible
508
+      if (LCD_EXTRA_SPACE >= strlen(STRING_SPLASH_LINE1) + 1) {
509
+        logo_lines(PSTR(" " STRING_SPLASH_LINE1));
510
+        #ifdef STRING_SPLASH_LINE2
511
+          lcd_erase_line(3);
512
+          lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE2), LCD_WIDTH, 2000);
513
+        #else
514
+          delay(2000);
515
+        #endif
516
+      }
517
+      else {
518
+        logo_lines(PSTR(""));
519
+        lcd_erase_line(3);
520
+        lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE1), LCD_WIDTH, 1500);
521
+        #ifdef STRING_SPLASH_LINE2
522
+          lcd_erase_line(3);
523
+          lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE2), LCD_WIDTH, 1500);
524
+        #endif
525
+      }
526
+    #elif defined(STRING_SPLASH_LINE2)
527
+      // Combine into a single splash screen if possible
528
+      if (LCD_EXTRA_SPACE >= strlen(STRING_SPLASH_LINE2) + 1) {
529
+        logo_lines(PSTR(" " STRING_SPLASH_LINE2));
530
+        delay(2000);
531
+      }
532
+      else {
533
+        logo_lines(PSTR(""));
534
+        lcd_erase_line(3);
535
+        lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE2), LCD_WIDTH, 2000);
536
+      }
537
+    #else
538
+      logo_lines(PSTR(""));
539
+      delay(2000);
507
     #endif
540
     #endif
508
 
541
 
509
-    #ifdef STRING_SPLASH_LINE2
510
-      lcd_erase_line(3);
511
-      lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE2), LCD_WIDTH, 1000);
512
-    #endif
513
   }
542
   }
514
 
543
 
515
 #endif // SHOW_BOOTSCREEN
544
 #endif // SHOW_BOOTSCREEN

Loading…
Cancel
Save