浏览代码

Boot-screen for text-displays improvements

Centred the logo for 16x4 and 20 x4.
Moved version to the bottom line
Code shrink to 704 bytes.
AnHardt 9 年前
父节点
当前提交
244ea2014a
共有 1 个文件被更改,包括 12 次插入16 次删除
  1. 12
    16
      Marlin/ultralcd_implementation_hitachi_HD44780.h

+ 12
- 16
Marlin/ultralcd_implementation_hitachi_HD44780.h 查看文件

@@ -422,15 +422,13 @@ unsigned lcd_print(char c) { return charset_mapper(c); }
422 422
 
423 423
   // scrol the PSTR'text' in a 'len' wide field for 'time' milliseconds at position col,line
424 424
   void lcd_scroll(int col, int line, const char * text, int len, int time) {
425
-    int l = lcd_strlen_P(text);
426 425
     char tmp[LCD_WIDTH+1] = {0};
427
-    int n = l - len;
428
-    int t = time / ((n>1) ? n: 1);
429
-    for (int i = 0; i <= (((n-1)>0) ? n-1 : 0); i++) {
426
+    int n = max(lcd_strlen_P(text) - len, 0);
427
+    for (int i = 0; i <= n; i++) {
430 428
       strncpy_P(tmp, text+i, min(len, LCD_WIDTH));
431 429
       lcd.setCursor(col, line);
432 430
       lcd_print(tmp);
433
-      delay(t);
431
+      delay(time / max(n, 1));
434 432
     }
435 433
   }
436 434
 
@@ -482,23 +480,21 @@ unsigned lcd_print(char c) { return charset_mapper(c); }
482 480
     lcd.createChar(3, botom_right);
483 481
 
484 482
     lcd.clear();
485
-    //                                                         12345678901234567890
486
-    lcd.setCursor(0, 0); lcd.print('\x00'); lcd_printPGM(PSTR( "------"));  lcd.print('\x01');
487
-    lcd.setCursor(0, 1);                    lcd_printPGM(PSTR("|Marlin| "));
488
-    #if (LCD_WIDTH > 16) && defined(STRING_SPLASH_LINE1)
489
-       lcd_printPGM(PSTR(STRING_SPLASH_LINE1));
490
-    #endif
491
-    lcd.setCursor(0, 2); lcd.print('\x02'); lcd_printPGM(PSTR( "------"));  lcd.print('\x03');
492 483
 
493
-    lcd_scroll(0, 3, PSTR("www.marlinfirmware.org" " "), LCD_WIDTH, 2000);
484
+    #define TEXT_SCREEN_LOGO_SHIFT ((LCD_WIDTH/2) - 4)
485
+    lcd.setCursor(TEXT_SCREEN_LOGO_SHIFT, 0); lcd.print('\x00'); lcd_printPGM(PSTR( "------" ));  lcd.print('\x01');
486
+    lcd.setCursor(TEXT_SCREEN_LOGO_SHIFT, 1);                    lcd_printPGM(PSTR("|Marlin|"));
487
+    lcd.setCursor(TEXT_SCREEN_LOGO_SHIFT, 2); lcd.print('\x02'); lcd_printPGM(PSTR( "------" ));  lcd.print('\x03');
488
+
489
+    lcd_scroll(0, 3, PSTR("www.marlinfirmware.org"), LCD_WIDTH, 3000);
494 490
 
495
-    #if (LCD_WIDTH <= 16) && defined(STRING_SPLASH_LINE1)
491
+    #ifdef STRING_SPLASH_LINE1
496 492
       lcd_erase_line(3);
497
-      lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE1 " "), LCD_WIDTH, 1000);
493
+      lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE1), LCD_WIDTH, 1000);
498 494
     #endif
499 495
     #ifdef STRING_SPLASH_LINE2
500 496
       lcd_erase_line(3);
501
-      lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE2 " "), LCD_WIDTH, 1000);
497
+      lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE2), LCD_WIDTH, 1000);
502 498
     #endif
503 499
   }
504 500
 #endif // SHOW_BOOTSCREEN

正在加载...
取消
保存