|
@@ -407,15 +407,31 @@ FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr,
|
407
|
407
|
inline void lcd_implementation_status_message() {
|
408
|
408
|
#if ENABLED(STATUS_MESSAGE_SCROLLING)
|
409
|
409
|
static bool last_blink = false;
|
410
|
|
- lcd_print_utf(lcd_status_message + status_scroll_pos);
|
411
|
410
|
const uint8_t slen = lcd_strlen(lcd_status_message);
|
412
|
|
- if (slen > LCD_WIDTH) {
|
413
|
|
- const bool new_blink = lcd_blink();
|
414
|
|
- if (last_blink != new_blink) {
|
415
|
|
- last_blink = new_blink;
|
|
411
|
+ const char *stat = lcd_status_message + status_scroll_pos;
|
|
412
|
+ if (slen <= LCD_WIDTH)
|
|
413
|
+ lcd_print_utf(stat); // The string isn't scrolling
|
|
414
|
+ else {
|
|
415
|
+ if (status_scroll_pos <= slen - LCD_WIDTH)
|
|
416
|
+ lcd_print_utf(stat); // The string fills the screen
|
|
417
|
+ else {
|
|
418
|
+ uint8_t chars = LCD_WIDTH;
|
|
419
|
+ if (status_scroll_pos < slen) { // First string still visible
|
|
420
|
+ lcd_print_utf(stat); // The string leaves space
|
|
421
|
+ chars -= slen - status_scroll_pos; // Amount of space left
|
|
422
|
+ }
|
|
423
|
+ lcd.print('.'); // Always at 1+ spaces left, draw a dot
|
|
424
|
+ if (--chars) {
|
|
425
|
+ if (status_scroll_pos < slen + 1) // Draw a second dot if there's space
|
|
426
|
+ --chars, lcd.print('.');
|
|
427
|
+ if (chars) lcd_print_utf(lcd_status_message, chars); // Print a second copy of the message
|
|
428
|
+ }
|
|
429
|
+ }
|
|
430
|
+ if (last_blink != blink) {
|
|
431
|
+ last_blink = blink;
|
416
|
432
|
// Skip any non-printing bytes
|
417
|
|
- while (!PRINTABLE(lcd_status_message[status_scroll_pos])) status_scroll_pos++;
|
418
|
|
- if (++status_scroll_pos > slen - LCD_WIDTH) status_scroll_pos = 0;
|
|
433
|
+ if (status_scroll_pos < slen) while (!PRINTABLE(lcd_status_message[status_scroll_pos])) status_scroll_pos++;
|
|
434
|
+ if (++status_scroll_pos >= slen + 2) status_scroll_pos = 0;
|
419
|
435
|
}
|
420
|
436
|
}
|
421
|
437
|
#else
|