Patch lcd_print edge limit code
This commit is contained in:
parent
bad432add7
commit
6b9ca16f36
4 changed files with 6 additions and 5 deletions
|
@ -127,6 +127,7 @@
|
||||||
#define DECIMAL(a) (NUMERIC(a) || a == '.')
|
#define DECIMAL(a) (NUMERIC(a) || a == '.')
|
||||||
#define NUMERIC_SIGNED(a) (NUMERIC(a) || (a) == '-' || (a) == '+')
|
#define NUMERIC_SIGNED(a) (NUMERIC(a) || (a) == '-' || (a) == '+')
|
||||||
#define DECIMAL_SIGNED(a) (DECIMAL(a) || (a) == '-' || (a) == '+')
|
#define DECIMAL_SIGNED(a) (DECIMAL(a) || (a) == '-' || (a) == '+')
|
||||||
|
#define PRINTABLE(C) (((C) & 0xC0u) != 0x80u)
|
||||||
#define COUNT(a) (sizeof(a)/sizeof(*a))
|
#define COUNT(a) (sizeof(a)/sizeof(*a))
|
||||||
#define ZERO(a) memset(a,0,sizeof(a))
|
#define ZERO(a) memset(a,0,sizeof(a))
|
||||||
#define COPY(a,b) memcpy(a,b,min(sizeof(a),sizeof(b)))
|
#define COPY(a,b) memcpy(a,b,min(sizeof(a),sizeof(b)))
|
||||||
|
|
|
@ -3814,7 +3814,7 @@ int lcd_strlen(const char* s) {
|
||||||
#if ENABLED(MAPPER_NON)
|
#if ENABLED(MAPPER_NON)
|
||||||
j++;
|
j++;
|
||||||
#else
|
#else
|
||||||
if ((s[i] & 0xC0u) != 0x80u) j++;
|
if (PRINTABLE(s[i])) j++;
|
||||||
#endif
|
#endif
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -3827,7 +3827,7 @@ int lcd_strlen_P(const char* s) {
|
||||||
#if ENABLED(MAPPER_NON)
|
#if ENABLED(MAPPER_NON)
|
||||||
j++;
|
j++;
|
||||||
#else
|
#else
|
||||||
if ((pgm_read_byte(s) & 0xC0u) != 0x80u) j++;
|
if (PRINTABLE(pgm_read_byte(s))) j++;
|
||||||
#endif
|
#endif
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
|
@ -4096,7 +4096,7 @@ void lcd_update() {
|
||||||
#if ENABLED(MAPPER_NON)
|
#if ENABLED(MAPPER_NON)
|
||||||
j++;
|
j++;
|
||||||
#else
|
#else
|
||||||
if ((s[i] & 0xC0u) != 0x80u) j++;
|
if (PRINTABLE(s[i])) j++;
|
||||||
#endif
|
#endif
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -412,7 +412,7 @@ inline void lcd_implementation_status_message() {
|
||||||
const uint8_t slen = lcd_strlen(lcd_status_message);
|
const uint8_t slen = lcd_strlen(lcd_status_message);
|
||||||
if (slen > LCD_WIDTH) {
|
if (slen > LCD_WIDTH) {
|
||||||
// Skip any non-printing bytes
|
// Skip any non-printing bytes
|
||||||
while (!charset_mapper(lcd_status_message[status_scroll_pos])) ++status_scroll_pos;
|
while (!PRINTABLE(lcd_status_message[status_scroll_pos])) ++status_scroll_pos;
|
||||||
if (++status_scroll_pos > slen - LCD_WIDTH) status_scroll_pos = 0;
|
if (++status_scroll_pos > slen - LCD_WIDTH) status_scroll_pos = 0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -831,7 +831,7 @@ static void lcd_implementation_status_screen() {
|
||||||
const uint8_t slen = lcd_strlen(lcd_status_message);
|
const uint8_t slen = lcd_strlen(lcd_status_message);
|
||||||
if (slen > LCD_WIDTH) {
|
if (slen > LCD_WIDTH) {
|
||||||
// Skip any non-printing bytes
|
// Skip any non-printing bytes
|
||||||
while (!charset_mapper(lcd_status_message[status_scroll_pos])) ++status_scroll_pos;
|
while (!PRINTABLE(lcd_status_message[status_scroll_pos])) ++status_scroll_pos;
|
||||||
if (++status_scroll_pos > slen - LCD_WIDTH) status_scroll_pos = 0;
|
if (++status_scroll_pos > slen - LCD_WIDTH) status_scroll_pos = 0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
Reference in a new issue