Pārlūkot izejas kodu

Fix STATUS_MESSAGE_SCROLLING in LIGHTWEIGHT_UI (#14603)

Marcio Teixeira 6 gadus atpakaļ
vecāks
revīzija
a49478cefa
1 mainītis faili ar 12 papildinājumiem un 10 dzēšanām
  1. 12
    10
      Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp

+ 12
- 10
Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp Parādīt failu

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

Notiek ielāde…
Atcelt
Saglabāt