Scroll too long strings on bootscreen

master
AnHardt 9 years ago committed by Richard Wackerbarth
parent 4f46df5dab
commit 2684d061ed

@ -414,6 +414,26 @@ char lcd_print(char* str) {
unsigned lcd_print(char c) { return charset_mapper(c); }
#if ENABLED(SHOW_BOOTSCREEN)
void lcd_erase_line(int line) {
lcd.setCursor(0, 3);
for (int i=0; i < LCD_WIDTH; i++)
lcd_print(' ');
}
// scrol the PSTR'text' in a 'len' wide field for 'time' milliseconds at position col,line
void lcd_scroll(int col, int line, const char * text, int len, int time) {
int l = lcd_strlen_P(text);
char tmp[LCD_WIDTH+1] = {0};
int n = l - len;
int t = time / ((n>1) ? n: 1);
for (int i = 0; i <= (((n-1)>0) ? n-1 : 0); i++) {
strncpy_P(tmp, text+i, min(len, LCD_WIDTH));
lcd.setCursor(col, line);
lcd_print(tmp);
delay(t);
}
}
static void bootscreen() {
show_bootscreen = false;
byte top_left[8] = {
@ -469,23 +489,16 @@ unsigned lcd_print(char c) { return charset_mapper(c); }
lcd_printPGM(PSTR(STRING_SPLASH_LINE1));
#endif
lcd.setCursor(0, 2); lcd.print('\x02'); lcd_printPGM(PSTR( "------")); lcd.print('\x03');
lcd.setCursor(0, 3); lcd_printPGM(PSTR("marlinfirmware.org"));
delay(2000);
lcd_scroll(0, 3, PSTR("www.marlinfirmware.org" " "), LCD_WIDTH, 2000);
#if (LCD_WIDTH <= 16) && defined(STRING_SPLASH_LINE1)
lcd.setCursor(0, 3);
lcd_printPGM(PSTR(" "));
lcd.setCursor(0, 3);
lcd_printPGM(PSTR(STRING_SPLASH_LINE1));
delay(1000);
lcd_erase_line(3);
lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE1 " "), LCD_WIDTH, 1000);
#endif
#ifdef STRING_SPLASH_LINE2
lcd.setCursor(0, 3);
lcd_printPGM(PSTR(" "));
lcd.setCursor(0, 3);
lcd_printPGM(PSTR(STRING_SPLASH_LINE2));
delay(1000);
lcd_erase_line(3);
lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE2 " "), LCD_WIDTH, 1000);
#endif
}
#endif // SHOW_BOOTSCREEN

Loading…
Cancel
Save