🩹 Followup for lchar_t

This commit is contained in:
Scott Lahteine
2022-07-03 23:44:06 -05:00
parent e94fa7d5dc
commit f39e2bc1e4
11 changed files with 80 additions and 74 deletions

View File

@@ -94,12 +94,12 @@ void TFT_String::set() {
* @ displays an axis name such as XYZUVW, or E for an extruder
*/
void TFT_String::add(const char *tpl, const int8_t index, const char *cstr/*=nullptr*/, FSTR_P const fstr/*=nullptr*/) {
lchar_t ch;
lchar_t wc;
while (*tpl) {
tpl = get_utf8_value_cb(tpl, read_byte_ram, ch);
if (ch > 255) ch |= 0x0080;
const uint8_t ch = uint8_t(ch & 0x00FF);
tpl = get_utf8_value_cb(tpl, read_byte_ram, wc);
if (wc > 255) wc |= 0x0080;
const uint8_t ch = uint8_t(wc & 0x00FF);
if (ch == '=' || ch == '~' || ch == '*') {
if (index >= 0) {
@@ -124,11 +124,11 @@ void TFT_String::add(const char *tpl, const int8_t index, const char *cstr/*=nul
}
void TFT_String::add(const char *cstr, uint8_t max_len/*=MAX_STRING_LENGTH*/) {
lchar_t ch;
lchar_t wc;
while (*cstr && max_len) {
cstr = get_utf8_value_cb(cstr, read_byte_ram, ch);
if (ch > 255) ch |= 0x0080;
const uint8_t ch = uint8_t(ch & 0x00FF);
cstr = get_utf8_value_cb(cstr, read_byte_ram, wc);
if (wc > 255) wc |= 0x0080;
const uint8_t ch = uint8_t(wc & 0x00FF);
add_character(ch);
max_len--;
}