Browse Source

Space-separate scrolling Status Message (#21523)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
vanilla_fb_2.0.x
XDA-Bam 4 years ago
committed by Scott Lahteine
parent
commit
761d283d6d
  1. 9
      Marlin/src/lcd/HD44780/marlinui_HD44780.cpp
  2. 9
      Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp
  3. 9
      Marlin/src/lcd/dogm/status_screen_DOGM.cpp
  4. 9
      Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp

9
Marlin/src/lcd/HD44780/marlinui_HD44780.cpp

@ -684,14 +684,17 @@ 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
lcd_put_wchar(' ');
if (--chars) { // Draw a third space if there's room
lcd_put_wchar(' ');
if (--chars) if (--chars)
lcd_put_u8str_max(status_message, chars); // Print a second copy of the message lcd_put_u8str_max(status_message, chars); // Print a second copy of the message
} }
} }
}
if (last_blink != blink) { if (last_blink != blink) {
last_blink = blink; last_blink = blink;
advance_status_scroll(); advance_status_scroll();

9
Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp

@ -581,14 +581,17 @@ 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
lcd.write(' ');
if (--chars) { // Draw a third space if there's room
lcd.write(' ');
if (--chars) if (--chars)
lcd_put_u8str_max(status_message, chars); // Print a second copy of the message lcd_put_u8str_max(status_message, chars); // Print a second copy of the message
} }
} }
}
if (last_blink != blink) { if (last_blink != blink) {
last_blink = blink; last_blink = blink;
advance_status_scroll(); advance_status_scroll();

9
Marlin/src/lcd/dogm/status_screen_DOGM.cpp

@ -959,10 +959,12 @@ 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
lcd_put_wchar(' ');
if (--chars) { // Draw a third space if there's room
lcd_put_wchar(' ');
if (--chars) { // Print a second copy of the message if (--chars) { // Print a second copy of the message
lcd_put_u8str_max(status_message, pixel_width - (rlen + 2) * (MENU_FONT_WIDTH)); lcd_put_u8str_max(status_message, pixel_width - (rlen + 2) * (MENU_FONT_WIDTH));
lcd_put_wchar(' '); lcd_put_wchar(' ');
@ -970,6 +972,7 @@ void MarlinUI::draw_status_message(const bool blink) {
} }
} }
} }
}
#else // !STATUS_MESSAGE_SCROLLING #else // !STATUS_MESSAGE_SCROLLING

9
Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp

@ -642,13 +642,16 @@ 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
if (--chars) { // Draw a second dot if there's space write_byte(' '); // Always at 1+ spaces left, draw a space
write_byte('.'); if (--chars) { // Draw a second space if there's room
write_byte(' ');
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 if (--chars) write_str(str, chars); // Print a second copy of the message
} }
} }
}
ui.advance_status_scroll(); ui.advance_status_scroll();
} }

Loading…
Cancel
Save