Skip to content

Commit

Permalink
馃┕ Remove poison wchar_t macro
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jul 4, 2022
1 parent 814b537 commit 80c7abd
Show file tree
Hide file tree
Showing 26 changed files with 244 additions and 239 deletions.
6 changes: 3 additions & 3 deletions Marlin/src/feature/power_monitor.cpp
Expand Up @@ -53,23 +53,23 @@ PowerMonitor power_monitor; // Single instance - this calls the constructor
void PowerMonitor::draw_current() {
const float amps = getAmps();
lcd_put_u8str(amps < 100 ? ftostr31ns(amps) : ui16tostr4rj((uint16_t)amps));
lcd_put_wchar('A');
lcd_put_lchar('A');
}
#endif

#if ENABLED(POWER_MONITOR_VOLTAGE)
void PowerMonitor::draw_voltage() {
const float volts = getVolts();
lcd_put_u8str(volts < 100 ? ftostr31ns(volts) : ui16tostr4rj((uint16_t)volts));
lcd_put_wchar('V');
lcd_put_lchar('V');
}
#endif

#if HAS_POWER_MONITOR_WATTS
void PowerMonitor::draw_power() {
const float power = getPower();
lcd_put_u8str(power < 100 ? ftostr31ns(power) : ui16tostr4rj((uint16_t)power));
lcd_put_wchar('W');
lcd_put_lchar('W');
}
#endif

Expand Down
12 changes: 6 additions & 6 deletions Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp
Expand Up @@ -50,7 +50,7 @@ extern LCD_CLASS lcd;
int lcd_glyph_height() { return 1; }

typedef struct _hd44780_charmap_t {
wchar_t uchar; // the unicode char
lchar_t uchar; // the unicode char
uint8_t idx; // the glyph of the char in the ROM
uint8_t idx2; // the char used to be combined with the idx to simulate a single char
} hd44780_charmap_t;
Expand Down Expand Up @@ -992,7 +992,7 @@ void lcd_put_int(const int i) { lcd.print(i); }

// return < 0 on error
// return the advanced cols
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) {

// find the HD44780 internal ROM first
int ret;
Expand Down Expand Up @@ -1051,10 +1051,10 @@ static int lcd_put_u8str_max_cb(const char * utf8_str, read_byte_cb_t cb_read_by
pixel_len_t ret = 0;
const uint8_t *p = (uint8_t *)utf8_str;
while (ret < max_length) {
wchar_t ch = 0;
p = get_utf8_value_cb(p, cb_read_byte, &ch);
if (!ch) break;
ret += lcd_put_wchar_max(ch, max_length - ret);
lchar_t wc;
p = get_utf8_value_cb(p, cb_read_byte, wc);
if (!wc) break;
ret += lcd_put_lchar_max(wc, max_length - ret);
}
return (int)ret;
}
Expand Down

0 comments on commit 80c7abd

Please sign in to comment.