🩹 Remove poison wchar_t macro

This commit is contained in:
Scott Lahteine
2022-07-01 04:49:37 -05:00
parent 814b53750f
commit 80c7abd727
26 changed files with 244 additions and 239 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*/) {
wchar_t wchar;
lchar_t wc;
while (*tpl) {
tpl = get_utf8_value_cb(tpl, read_byte_ram, &wchar);
if (wchar > 255) wchar |= 0x0080;
const uint8_t ch = uint8_t(wchar & 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*/) {
wchar_t wchar;
lchar_t wc;
while (*cstr && max_len) {
cstr = get_utf8_value_cb(cstr, read_byte_ram, &wchar);
if (wchar > 255) wchar |= 0x0080;
const uint8_t ch = uint8_t(wchar & 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--;
}

View File

@ -25,6 +25,8 @@
#include <stdint.h>
#include "../fontutils.h"
extern const uint8_t ISO10646_1_5x7[];
extern const uint8_t font10x20[];
@ -97,7 +99,7 @@ class TFT_String {
* @param character The ASCII character
*/
static void add(const char character) { add_character(character); eol(); }
static void set(wchar_t character) { set(); add(character); }
static void set(const lchar_t &character) { set(); add(character); }
/**
* @brief Append / Set C-string

View File

@ -96,7 +96,7 @@ void lcd_moveto(const lcd_uint_t col, const lcd_uint_t row) {
lcd_gotopixel(int(col) * (TFT_COL_WIDTH), int(row) * MENU_LINE_HEIGHT);
}
int lcd_put_wchar_max(const wchar_t c, const pixel_len_t max_length) {
int lcd_put_lchar_max(const lchar_t &c, const pixel_len_t max_length) {
if (max_length < 1) return 0;
tft_string.set(c);
tft.add_text(MENU_TEXT_X_OFFSET, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);