Browse Source

Patch lcd_print edge limit code

Scott Lahteine 7 years ago
parent
commit
6b9ca16f36
4 changed files with 6 additions and 5 deletions
  1. 1
    0
      Marlin/macros.h
  2. 3
    3
      Marlin/ultralcd.cpp
  3. 1
    1
      Marlin/ultralcd_impl_DOGM.h
  4. 1
    1
      Marlin/ultralcd_impl_HD44780.h

+ 1
- 0
Marlin/macros.h View File

@@ -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 View File

@@ -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 View File

@@ -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

+ 1
- 1
Marlin/ultralcd_impl_HD44780.h View File

@@ -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…
Cancel
Save