Scott Lahteine 7 年之前
父節點
當前提交
76af9ac7c5
共有 2 個文件被更改,包括 11 次插入5 次删除
  1. 6
    2
      Marlin/ultralcd_impl_DOGM.h
  2. 5
    3
      Marlin/ultralcd_impl_HD44780.h

+ 6
- 2
Marlin/ultralcd_impl_DOGM.h 查看文件

@@ -635,7 +635,9 @@ static void lcd_implementation_status_screen() {
635 635
     #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
636 636
       if (PENDING(millis(), previous_lcd_status_ms + 5000UL)) {  //Display both Status message line and Filament display on the last line
637 637
         const char *str = lcd_status_message;
638
-        for (uint8_t i = 0; char c = str[i] && i < LCD_WIDTH; ++i) lcd_print(c);
638
+        uint8_t i = LCD_WIDTH;
639
+        char c;
640
+        while (i-- && (c = *str++)) lcd_print(c);
639 641
       }
640 642
       else {
641 643
         lcd_printPGM(PSTR(LCD_STR_FILAM_DIA));
@@ -648,7 +650,9 @@ static void lcd_implementation_status_screen() {
648 650
       }
649 651
     #else
650 652
       const char *str = lcd_status_message;
651
-      for (uint8_t i = 0; char c = str[i] && i < LCD_WIDTH; ++i) lcd_print(c);
653
+      uint8_t i = LCD_WIDTH;
654
+      char c;
655
+      while (i-- && (c = *str++)) lcd_print(c);
652 656
     #endif
653 657
   }
654 658
 }

+ 5
- 3
Marlin/ultralcd_impl_HD44780.h 查看文件

@@ -386,10 +386,10 @@ void lcd_printPGM(const char *str) {
386 386
 }
387 387
 
388 388
 void lcd_print(const char* const str) {
389
-  for (uint8_t i = 0; char c = str[i]; ++i) charset_mapper(c);
389
+  for (uint8_t i = 0; const char c = str[i]; ++i) charset_mapper(c);
390 390
 }
391 391
 
392
-void lcd_print(char c) { charset_mapper(c); }
392
+void lcd_print(const char c) { charset_mapper(c); }
393 393
 
394 394
 #if ENABLED(SHOW_BOOTSCREEN)
395 395
 
@@ -796,7 +796,9 @@ static void lcd_implementation_status_screen() {
796 796
   #endif // FILAMENT_LCD_DISPLAY && SDSUPPORT
797 797
 
798 798
   const char *str = lcd_status_message;
799
-  for (uint8_t i = 0; char c = str[i] && i < LCD_WIDTH; ++i) lcd_print(c);
799
+  uint8_t i = LCD_WIDTH;
800
+  char c;
801
+  while (i-- && (c = *str++)) lcd_print(c);
800 802
 }
801 803
 
802 804
 #if ENABLED(ULTIPANEL)

Loading…
取消
儲存