|
@@ -59,6 +59,8 @@
|
59
|
59
|
#include "../../sd/cardreader.h"
|
60
|
60
|
#endif
|
61
|
61
|
|
|
62
|
+#define TEXT_MODE_LCD_WIDTH 16
|
|
63
|
+
|
62
|
64
|
#define BUFFER_WIDTH 256
|
63
|
65
|
#define BUFFER_HEIGHT 32
|
64
|
66
|
|
|
@@ -619,13 +621,12 @@ void ST7920_Lite_Status_Screen::draw_status_message() {
|
619
|
621
|
set_ddram_address(DDRAM_LINE_4);
|
620
|
622
|
begin_data();
|
621
|
623
|
#if ENABLED(STATUS_MESSAGE_SCROLLING)
|
622
|
|
-
|
623
|
624
|
uint8_t slen = utf8_strlen(str);
|
624
|
625
|
|
625
|
|
- if (slen <= LCD_WIDTH) {
|
|
626
|
+ if (slen <= TEXT_MODE_LCD_WIDTH) {
|
626
|
627
|
// String fits the LCD, so just print it
|
627
|
628
|
write_str(str);
|
628
|
|
- while (slen < LCD_WIDTH) { write_byte(' '); ++slen; }
|
|
629
|
+ while (slen < TEXT_MODE_LCD_WIDTH) { write_byte(' '); ++slen; }
|
629
|
630
|
}
|
630
|
631
|
else {
|
631
|
632
|
// String is larger than the available space in screen.
|
|
@@ -634,12 +635,12 @@ void ST7920_Lite_Status_Screen::draw_status_message() {
|
634
|
635
|
// and the string remaining length
|
635
|
636
|
uint8_t rlen;
|
636
|
637
|
const char *stat = ui.status_and_len(rlen);
|
637
|
|
- write_str(stat, LCD_WIDTH);
|
|
638
|
+ write_str(stat, TEXT_MODE_LCD_WIDTH);
|
638
|
639
|
|
639
|
640
|
// If the remaining string doesn't completely fill the screen
|
640
|
|
- if (rlen < LCD_WIDTH) {
|
|
641
|
+ if (rlen < TEXT_MODE_LCD_WIDTH) {
|
641
|
642
|
write_byte('.'); // Always at 1+ spaces left, draw a dot
|
642
|
|
- uint8_t chars = LCD_WIDTH - rlen; // Amount of space left in characters
|
|
643
|
+ uint8_t chars = TEXT_MODE_LCD_WIDTH - rlen; // Amount of space left in characters
|
643
|
644
|
if (--chars) { // Draw a second dot if there's space
|
644
|
645
|
write_byte('.');
|
645
|
646
|
if (--chars) write_str(str, chars); // Print a second copy of the message
|
|
@@ -651,8 +652,8 @@ void ST7920_Lite_Status_Screen::draw_status_message() {
|
651
|
652
|
#else
|
652
|
653
|
|
653
|
654
|
uint8_t slen = utf8_strlen(str);
|
654
|
|
- write_str(str, LCD_WIDTH);
|
655
|
|
- for (; slen < LCD_WIDTH; ++slen) write_byte(' ');
|
|
655
|
+ write_str(str, TEXT_MODE_LCD_WIDTH);
|
|
656
|
+ for (; slen < TEXT_MODE_LCD_WIDTH; ++slen) write_byte(' ');
|
656
|
657
|
|
657
|
658
|
#endif
|
658
|
659
|
}
|
|
@@ -760,7 +761,8 @@ bool ST7920_Lite_Status_Screen::position_changed() {
|
760
|
761
|
bool ST7920_Lite_Status_Screen::status_changed() {
|
761
|
762
|
uint8_t checksum = 0;
|
762
|
763
|
for (const char *p = ui.status_message; *p; p++) checksum ^= *p;
|
763
|
|
- static uint8_t last_checksum = 0, changed = last_checksum != checksum;
|
|
764
|
+ static uint8_t last_checksum = 0;
|
|
765
|
+ bool changed = last_checksum != checksum;
|
764
|
766
|
if (changed) last_checksum = checksum;
|
765
|
767
|
return changed;
|
766
|
768
|
}
|
|
@@ -805,7 +807,7 @@ void ST7920_Lite_Status_Screen::update_status_or_position(bool forceUpdate) {
|
805
|
807
|
}
|
806
|
808
|
#if !STATUS_EXPIRE_SECONDS
|
807
|
809
|
#if ENABLED(STATUS_MESSAGE_SCROLLING)
|
808
|
|
- else
|
|
810
|
+ else if (blink_changed())
|
809
|
811
|
draw_status_message();
|
810
|
812
|
#endif
|
811
|
813
|
#else
|