Space-separate scrolling Status Message (#21523)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
XDA-Bam 2021-04-14 11:42:04 +02:00 committed by GitHub
parent 1595fdb54b
commit cc5297d637
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 20 deletions

View File

@ -684,12 +684,15 @@ void MarlinUI::draw_status_message(const bool blink) {
// If the remaining string doesn't completely fill the screen // If the remaining string doesn't completely fill the screen
if (rlen < LCD_WIDTH) { if (rlen < LCD_WIDTH) {
lcd_put_wchar('.'); // Always at 1+ spaces left, draw a dot
uint8_t chars = LCD_WIDTH - rlen; // Amount of space left in characters uint8_t chars = LCD_WIDTH - rlen; // Amount of space left in characters
if (--chars) { // Draw a second dot if there's space lcd_put_wchar(' '); // Always at 1+ spaces left, draw a space
lcd_put_wchar('.'); if (--chars) { // Draw a second space if there's room
if (--chars) lcd_put_wchar(' ');
lcd_put_u8str_max(status_message, chars); // Print a second copy of the message if (--chars) { // Draw a third space if there's room
lcd_put_wchar(' ');
if (--chars)
lcd_put_u8str_max(status_message, chars); // Print a second copy of the message
}
} }
} }
if (last_blink != blink) { if (last_blink != blink) {

View File

@ -581,12 +581,15 @@ void MarlinUI::draw_status_message(const bool blink) {
// If the remaining string doesn't completely fill the screen // If the remaining string doesn't completely fill the screen
if (rlen < LCD_WIDTH) { if (rlen < LCD_WIDTH) {
lcd.write('.'); // Always at 1+ spaces left, draw a dot
uint8_t chars = LCD_WIDTH - rlen; // Amount of space left in characters uint8_t chars = LCD_WIDTH - rlen; // Amount of space left in characters
if (--chars) { // Draw a second dot if there's space lcd.write(' '); // Always at 1+ spaces left, draw a space
lcd.write('.'); if (--chars) { // Draw a second space if there's room
if (--chars) lcd.write(' ');
lcd_put_u8str_max(status_message, chars); // Print a second copy of the message if (--chars) { // Draw a third space if there's room
lcd.write(' ');
if (--chars)
lcd_put_u8str_max(status_message, chars); // Print a second copy of the message
}
} }
} }
if (last_blink != blink) { if (last_blink != blink) {

View File

@ -959,13 +959,16 @@ void MarlinUI::draw_status_message(const bool blink) {
// If the remaining string doesn't completely fill the screen // If the remaining string doesn't completely fill the screen
if (rlen < lcd_width) { if (rlen < lcd_width) {
lcd_put_wchar('.'); // Always at 1+ spaces left, draw a dot
uint8_t chars = lcd_width - rlen; // Amount of space left in characters uint8_t chars = lcd_width - rlen; // Amount of space left in characters
if (--chars) { // Draw a second dot if there's space lcd_put_wchar(' '); // Always at 1+ spaces left, draw a space
lcd_put_wchar('.'); if (--chars) { // Draw a second space if there's room
if (--chars) { // Print a second copy of the message lcd_put_wchar(' ');
lcd_put_u8str_max(status_message, pixel_width - (rlen + 2) * (MENU_FONT_WIDTH)); if (--chars) { // Draw a third space if there's room
lcd_put_wchar(' '); lcd_put_wchar(' ');
if (--chars) { // Print a second copy of the message
lcd_put_u8str_max(status_message, pixel_width - (rlen + 2) * (MENU_FONT_WIDTH));
lcd_put_wchar(' ');
}
} }
} }
} }

View File

@ -642,11 +642,14 @@ void ST7920_Lite_Status_Screen::draw_status_message() {
// If the remaining string doesn't completely fill the screen // If the remaining string doesn't completely fill the screen
if (rlen < TEXT_MODE_LCD_WIDTH) { if (rlen < TEXT_MODE_LCD_WIDTH) {
write_byte('.'); // Always at 1+ spaces left, draw a dot uint8_t chars = TEXT_MODE_LCD_WIDTH - rlen; // Amount of space left in characters
uint8_t chars = TEXT_MODE_LCD_WIDTH - rlen; // Amount of space left in characters write_byte(' '); // Always at 1+ spaces left, draw a space
if (--chars) { // Draw a second dot if there's space if (--chars) { // Draw a second space if there's room
write_byte('.'); write_byte(' ');
if (--chars) write_str(str, chars); // Print a second copy of the message if (--chars) { // Draw a third space if there's room
write_byte(' ');
if (--chars) write_str(str, chars); // Print a second copy of the message
}
} }
} }
ui.advance_status_scroll(); ui.advance_status_scroll();