Browse Source

Merge pull request #6816 from thinkyhead/bf_lcd_live_editing

Constrain LCD status message rendering
Scott Lahteine 7 years ago
parent
commit
850203fb3a
3 changed files with 18 additions and 6 deletions
  1. 4
    1
      Marlin/ultralcd.cpp
  2. 8
    2
      Marlin/ultralcd_impl_DOGM.h
  3. 6
    3
      Marlin/ultralcd_impl_HD44780.h

+ 4
- 1
Marlin/ultralcd.cpp View File

@@ -2509,9 +2509,12 @@ void kill_screen(const char* lcd_msg) {
2509 2509
     #if ENABLED(EEPROM_SETTINGS)
2510 2510
       MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings);
2511 2511
       MENU_ITEM(function, MSG_LOAD_EEPROM, lcd_load_settings);
2512
-      MENU_ITEM(function, MSG_RESTORE_FAILSAFE, lcd_factory_settings);
2512
+    #endif
2513
+    MENU_ITEM(function, MSG_RESTORE_FAILSAFE, lcd_factory_settings);
2514
+    #if ENABLED(EEPROM_SETTINGS)
2513 2515
       MENU_ITEM(gcode, MSG_INIT_EEPROM, PSTR("M502\nM500")); // TODO: Add "Are You Sure?" step
2514 2516
     #endif
2517
+
2515 2518
     END_MENU();
2516 2519
   }
2517 2520
 

+ 8
- 2
Marlin/ultralcd_impl_DOGM.h View File

@@ -634,7 +634,10 @@ static void lcd_implementation_status_screen() {
634 634
 
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
-        lcd_print(lcd_status_message);
637
+        const char *str = lcd_status_message;
638
+        uint8_t i = LCD_WIDTH;
639
+        char c;
640
+        while (i-- && (c = *str++)) lcd_print(c);
638 641
       }
639 642
       else {
640 643
         lcd_printPGM(PSTR(LCD_STR_FILAM_DIA));
@@ -646,7 +649,10 @@ static void lcd_implementation_status_screen() {
646 649
         u8g.print('%');
647 650
       }
648 651
     #else
649
-      lcd_print(lcd_status_message);
652
+      const char *str = lcd_status_message;
653
+      uint8_t i = LCD_WIDTH;
654
+      char c;
655
+      while (i-- && (c = *str++)) lcd_print(c);
650 656
     #endif
651 657
   }
652 658
 }

+ 6
- 3
Marlin/ultralcd_impl_HD44780.h View File

@@ -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
 
@@ -795,7 +795,10 @@ static void lcd_implementation_status_screen() {
795 795
 
796 796
   #endif // FILAMENT_LCD_DISPLAY && SDSUPPORT
797 797
 
798
-  lcd_print(lcd_status_message);
798
+  const char *str = lcd_status_message;
799
+  uint8_t i = LCD_WIDTH;
800
+  char c;
801
+  while (i-- && (c = *str++)) lcd_print(c);
799 802
 }
800 803
 
801 804
 #if ENABLED(ULTIPANEL)

Loading…
Cancel
Save