Scrolling status message option
This commit is contained in:
@ -380,17 +380,23 @@ static void lcd_implementation_init(
|
||||
|
||||
void lcd_implementation_clear() { lcd.clear(); }
|
||||
|
||||
/* Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own */
|
||||
void lcd_printPGM(const char *str) {
|
||||
for (; char c = pgm_read_byte(str); ++str) charset_mapper(c);
|
||||
}
|
||||
|
||||
void lcd_print(const char* const str) {
|
||||
for (uint8_t i = 0; const char c = str[i]; ++i) charset_mapper(c);
|
||||
}
|
||||
|
||||
void lcd_print(const char c) { charset_mapper(c); }
|
||||
|
||||
void lcd_print(const char * const str) { for (uint8_t i = 0; char c = str[i]; ++i) lcd.print(c); }
|
||||
void lcd_printPGM(const char* str) { for (; char c = pgm_read_byte(str); ++str) lcd.print(c); }
|
||||
|
||||
void lcd_print_utf(const char * const str, const uint8_t maxLength=LCD_WIDTH) {
|
||||
char c;
|
||||
for (uint8_t i = 0, n = maxLength; n && (c = str[i]); ++i)
|
||||
n -= charset_mapper(c);
|
||||
}
|
||||
|
||||
void lcd_printPGM_utf(const char* str, const uint8_t maxLength=LCD_WIDTH) {
|
||||
char c;
|
||||
for (uint8_t i = 0, n = maxLength; n && (c = str[i]); ++i)
|
||||
n -= charset_mapper(c);
|
||||
}
|
||||
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
|
||||
void lcd_erase_line(const int line) {
|
||||
@ -545,7 +551,7 @@ void lcd_print(const char c) { charset_mapper(c); }
|
||||
|
||||
void lcd_kill_screen() {
|
||||
lcd.setCursor(0, 0);
|
||||
lcd_print(lcd_status_message);
|
||||
lcd_print_utf(lcd_status_message);
|
||||
#if LCD_HEIGHT < 4
|
||||
lcd.setCursor(0, 2);
|
||||
#else
|
||||
@ -818,10 +824,17 @@ static void lcd_implementation_status_screen() {
|
||||
|
||||
#endif // FILAMENT_LCD_DISPLAY && SDSUPPORT
|
||||
|
||||
const char *str = lcd_status_message;
|
||||
uint8_t i = LCD_WIDTH;
|
||||
char c;
|
||||
while (i-- && (c = *str++)) lcd_print(c);
|
||||
#if ENABLED(STATUS_MESSAGE_SCROLLING)
|
||||
lcd_print_utf(lcd_status_message + status_scroll_pos);
|
||||
const uint8_t slen = lcd_strlen(lcd_status_message);
|
||||
if (slen > LCD_WIDTH) {
|
||||
// Skip any non-printing bytes
|
||||
while (!charset_mapper(lcd_status_message[status_scroll_pos])) ++status_scroll_pos;
|
||||
if (++status_scroll_pos > slen - LCD_WIDTH) status_scroll_pos = 0;
|
||||
}
|
||||
#else
|
||||
lcd_print_utf(lcd_status_message);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if ENABLED(ULTIPANEL)
|
||||
|
Reference in New Issue
Block a user