Selaa lähdekoodia

Merge pull request #6897 from thinkyhead/bf_fix_lcd_scrolling

Fix LCD scrolling character counting
Scott Lahteine 8 vuotta sitten
vanhempi
commit
d33ae33103
4 muutettua tiedostoa jossa 14 lisäystä ja 13 poistoa
  1. 1
    0
      Marlin/macros.h
  2. 3
    3
      Marlin/ultralcd.cpp
  3. 1
    1
      Marlin/ultralcd_impl_DOGM.h
  4. 9
    9
      Marlin/ultralcd_impl_HD44780.h

+ 1
- 0
Marlin/macros.h Näytä tiedosto

@@ -127,6 +127,7 @@
127 127
 #define DECIMAL(a) (NUMERIC(a) || a == '.')
128 128
 #define NUMERIC_SIGNED(a) (NUMERIC(a) || (a) == '-' || (a) == '+')
129 129
 #define DECIMAL_SIGNED(a) (DECIMAL(a) || (a) == '-' || (a) == '+')
130
+#define PRINTABLE(C) (((C) & 0xC0u) != 0x80u)
130 131
 #define COUNT(a) (sizeof(a)/sizeof(*a))
131 132
 #define ZERO(a) memset(a,0,sizeof(a))
132 133
 #define COPY(a,b) memcpy(a,b,min(sizeof(a),sizeof(b)))

+ 3
- 3
Marlin/ultralcd.cpp Näytä tiedosto

@@ -3814,7 +3814,7 @@ int lcd_strlen(const char* s) {
3814 3814
     #if ENABLED(MAPPER_NON)
3815 3815
       j++;
3816 3816
     #else
3817
-      if ((s[i] & 0xC0u) != 0x80u) j++;
3817
+      if (PRINTABLE(s[i])) j++;
3818 3818
     #endif
3819 3819
     i++;
3820 3820
   }
@@ -3827,7 +3827,7 @@ int lcd_strlen_P(const char* s) {
3827 3827
     #if ENABLED(MAPPER_NON)
3828 3828
       j++;
3829 3829
     #else
3830
-      if ((pgm_read_byte(s) & 0xC0u) != 0x80u) j++;
3830
+      if (PRINTABLE(pgm_read_byte(s))) j++;
3831 3831
     #endif
3832 3832
     s++;
3833 3833
   }
@@ -4096,7 +4096,7 @@ void lcd_update() {
4096 4096
       #if ENABLED(MAPPER_NON)
4097 4097
         j++;
4098 4098
       #else
4099
-        if ((s[i] & 0xC0u) != 0x80u) j++;
4099
+        if (PRINTABLE(s[i])) j++;
4100 4100
       #endif
4101 4101
       i++;
4102 4102
     }

+ 1
- 1
Marlin/ultralcd_impl_DOGM.h Näytä tiedosto

@@ -412,7 +412,7 @@ inline void lcd_implementation_status_message() {
412 412
     const uint8_t slen = lcd_strlen(lcd_status_message);
413 413
     if (slen > LCD_WIDTH) {
414 414
       // Skip any non-printing bytes
415
-      while (!charset_mapper(lcd_status_message[status_scroll_pos])) ++status_scroll_pos;
415
+      while (!PRINTABLE(lcd_status_message[status_scroll_pos])) ++status_scroll_pos;
416 416
       if (++status_scroll_pos > slen - LCD_WIDTH) status_scroll_pos = 0;
417 417
     }
418 418
   #else

+ 9
- 9
Marlin/ultralcd_impl_HD44780.h Näytä tiedosto

@@ -582,8 +582,8 @@ FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr,
582 582
 FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, const bool blink) {
583 583
   const bool isBed = heater < 0;
584 584
 
585
-  const float t1 = (isBed ? thermalManager.degBed() : thermalManager.degHotend(heater));
586
-  const float t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater));
585
+  const float t1 = (isBed ? thermalManager.degBed()       : thermalManager.degHotend(heater)),
586
+              t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater));
587 587
 
588 588
   if (prefix >= 0) lcd.print(prefix);
589 589
 
@@ -592,11 +592,11 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, co
592 592
 
593 593
   #if ENABLED(ADVANCED_PAUSE_FEATURE)
594 594
     const bool is_idle = (!isBed ? thermalManager.is_heater_idle(heater) :
595
-    #if HAS_TEMP_BED
596
-      thermalManager.is_bed_idle()
597
-    #else
598
-      false
599
-    #endif
595
+      #if HAS_TEMP_BED
596
+        thermalManager.is_bed_idle()
597
+      #else
598
+        false
599
+      #endif
600 600
     );
601 601
 
602 602
     if (!blink && is_idle) {
@@ -606,7 +606,7 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, co
606 606
     }
607 607
     else
608 608
   #endif
609
-  lcd.print(itostr3left(t2 + 0.5));
609
+      lcd.print(itostr3left(t2 + 0.5));
610 610
 
611 611
   if (prefix >= 0) {
612 612
     lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
@@ -831,7 +831,7 @@ static void lcd_implementation_status_screen() {
831 831
     const uint8_t slen = lcd_strlen(lcd_status_message);
832 832
     if (slen > LCD_WIDTH) {
833 833
       // Skip any non-printing bytes
834
-      while (!charset_mapper(lcd_status_message[status_scroll_pos])) ++status_scroll_pos;
834
+      while (!PRINTABLE(lcd_status_message[status_scroll_pos])) ++status_scroll_pos;
835 835
       if (++status_scroll_pos > slen - LCD_WIDTH) status_scroll_pos = 0;
836 836
     }
837 837
   #else

Loading…
Peruuta
Tallenna