🩹 Remove poison wchar_t macro
This commit is contained in:
parent
86e6f9e38e
commit
b79231cc59
|
@ -53,7 +53,7 @@ PowerMonitor power_monitor; // Single instance - this calls the constructor
|
||||||
void PowerMonitor::draw_current() {
|
void PowerMonitor::draw_current() {
|
||||||
const float amps = getAmps();
|
const float amps = getAmps();
|
||||||
lcd_put_u8str(amps < 100 ? ftostr31ns(amps) : ui16tostr4rj((uint16_t)amps));
|
lcd_put_u8str(amps < 100 ? ftostr31ns(amps) : ui16tostr4rj((uint16_t)amps));
|
||||||
lcd_put_wchar('A');
|
lcd_put_lchar('A');
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ PowerMonitor power_monitor; // Single instance - this calls the constructor
|
||||||
void PowerMonitor::draw_voltage() {
|
void PowerMonitor::draw_voltage() {
|
||||||
const float volts = getVolts();
|
const float volts = getVolts();
|
||||||
lcd_put_u8str(volts < 100 ? ftostr31ns(volts) : ui16tostr4rj((uint16_t)volts));
|
lcd_put_u8str(volts < 100 ? ftostr31ns(volts) : ui16tostr4rj((uint16_t)volts));
|
||||||
lcd_put_wchar('V');
|
lcd_put_lchar('V');
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ PowerMonitor power_monitor; // Single instance - this calls the constructor
|
||||||
void PowerMonitor::draw_power() {
|
void PowerMonitor::draw_power() {
|
||||||
const float power = getPower();
|
const float power = getPower();
|
||||||
lcd_put_u8str(power < 100 ? ftostr31ns(power) : ui16tostr4rj((uint16_t)power));
|
lcd_put_u8str(power < 100 ? ftostr31ns(power) : ui16tostr4rj((uint16_t)power));
|
||||||
lcd_put_wchar('W');
|
lcd_put_lchar('W');
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ extern LCD_CLASS lcd;
|
||||||
int lcd_glyph_height() { return 1; }
|
int lcd_glyph_height() { return 1; }
|
||||||
|
|
||||||
typedef struct _hd44780_charmap_t {
|
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 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
|
uint8_t idx2; // the char used to be combined with the idx to simulate a single char
|
||||||
} hd44780_charmap_t;
|
} hd44780_charmap_t;
|
||||||
|
@ -992,7 +992,7 @@ void lcd_put_int(const int i) { lcd.print(i); }
|
||||||
|
|
||||||
// return < 0 on error
|
// return < 0 on error
|
||||||
// return the advanced cols
|
// 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
|
// find the HD44780 internal ROM first
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -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;
|
pixel_len_t ret = 0;
|
||||||
const uint8_t *p = (uint8_t *)utf8_str;
|
const uint8_t *p = (uint8_t *)utf8_str;
|
||||||
while (ret < max_length) {
|
while (ret < max_length) {
|
||||||
wchar_t ch = 0;
|
lchar_t wc;
|
||||||
p = get_utf8_value_cb(p, cb_read_byte, &ch);
|
p = get_utf8_value_cb(p, cb_read_byte, wc);
|
||||||
if (!ch) break;
|
if (!wc) break;
|
||||||
ret += lcd_put_wchar_max(ch, max_length - ret);
|
ret += lcd_put_lchar_max(wc, max_length - ret);
|
||||||
}
|
}
|
||||||
return (int)ret;
|
return (int)ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -405,7 +405,7 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
|
||||||
void lcd_erase_line(const lcd_uint_t line) {
|
void lcd_erase_line(const lcd_uint_t line) {
|
||||||
lcd_moveto(0, line);
|
lcd_moveto(0, line);
|
||||||
for (uint8_t i = LCD_WIDTH + 1; --i;)
|
for (uint8_t i = LCD_WIDTH + 1; --i;)
|
||||||
lcd_put_wchar(' ');
|
lcd_put_lchar(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line
|
// Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line
|
||||||
|
@ -413,7 +413,7 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
|
||||||
uint8_t slen = utf8_strlen(ftxt);
|
uint8_t slen = utf8_strlen(ftxt);
|
||||||
if (slen < len) {
|
if (slen < len) {
|
||||||
lcd_put_u8str_max(col, line, ftxt, len);
|
lcd_put_u8str_max(col, line, ftxt, len);
|
||||||
for (; slen < len; ++slen) lcd_put_wchar(' ');
|
for (; slen < len; ++slen) lcd_put_lchar(' ');
|
||||||
safe_delay(time);
|
safe_delay(time);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -425,7 +425,7 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
|
||||||
lcd_put_u8str_max_P(col, line, p, len);
|
lcd_put_u8str_max_P(col, line, p, len);
|
||||||
|
|
||||||
// Fill with spaces
|
// Fill with spaces
|
||||||
for (uint8_t ix = slen - i; ix < len; ++ix) lcd_put_wchar(' ');
|
for (uint8_t ix = slen - i; ix < len; ++ix) lcd_put_lchar(' ');
|
||||||
|
|
||||||
// Delay
|
// Delay
|
||||||
safe_delay(dly);
|
safe_delay(dly);
|
||||||
|
@ -439,9 +439,9 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
|
||||||
|
|
||||||
static void logo_lines(FSTR_P const extra) {
|
static void logo_lines(FSTR_P const extra) {
|
||||||
int16_t indent = (LCD_WIDTH - 8 - utf8_strlen(extra)) / 2;
|
int16_t indent = (LCD_WIDTH - 8 - utf8_strlen(extra)) / 2;
|
||||||
lcd_put_wchar(indent, 0, '\x00'); lcd_put_u8str(F( "------" )); lcd_put_wchar('\x01');
|
lcd_put_lchar(indent, 0, '\x00'); lcd_put_u8str(F( "------" )); lcd_put_lchar('\x01');
|
||||||
lcd_put_u8str(indent, 1, F("|Marlin|")); lcd_put_u8str(extra);
|
lcd_put_u8str(indent, 1, F("|Marlin|")); lcd_put_u8str(extra);
|
||||||
lcd_put_wchar(indent, 2, '\x02'); lcd_put_u8str(F( "------" )); lcd_put_wchar('\x03');
|
lcd_put_lchar(indent, 2, '\x02'); lcd_put_u8str(F( "------" )); lcd_put_lchar('\x03');
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarlinUI::show_bootscreen() {
|
void MarlinUI::show_bootscreen() {
|
||||||
|
@ -510,11 +510,11 @@ void MarlinUI::draw_kill_screen() {
|
||||||
// Homed and known, display constantly.
|
// Homed and known, display constantly.
|
||||||
//
|
//
|
||||||
FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink) {
|
FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink) {
|
||||||
lcd_put_wchar('X' + uint8_t(axis));
|
lcd_put_lchar('X' + uint8_t(axis));
|
||||||
if (blink)
|
if (blink)
|
||||||
lcd_put_u8str(value);
|
lcd_put_u8str(value);
|
||||||
else if (axis_should_home(axis))
|
else if (axis_should_home(axis))
|
||||||
while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?');
|
while (const char c = *value++) lcd_put_lchar(c <= '.' ? c : '?');
|
||||||
else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
|
else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
|
||||||
lcd_put_u8str(axis == Z_AXIS ? F(" ") : F(" "));
|
lcd_put_u8str(axis == Z_AXIS ? F(" ") : F(" "));
|
||||||
else
|
else
|
||||||
|
@ -531,27 +531,27 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char pr
|
||||||
const celsius_t t1 = thermalManager.wholeDegHotend(heater_id), t2 = thermalManager.degTargetHotend(heater_id);
|
const celsius_t t1 = thermalManager.wholeDegHotend(heater_id), t2 = thermalManager.degTargetHotend(heater_id);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (prefix >= 0) lcd_put_wchar(prefix);
|
if (prefix >= 0) lcd_put_lchar(prefix);
|
||||||
|
|
||||||
lcd_put_u8str(t1 < 0 ? "err" : i16tostr3rj(t1));
|
lcd_put_u8str(t1 < 0 ? "err" : i16tostr3rj(t1));
|
||||||
lcd_put_wchar('/');
|
lcd_put_lchar('/');
|
||||||
|
|
||||||
#if !HEATER_IDLE_HANDLER
|
#if !HEATER_IDLE_HANDLER
|
||||||
UNUSED(blink);
|
UNUSED(blink);
|
||||||
#else
|
#else
|
||||||
if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) {
|
if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) {
|
||||||
lcd_put_wchar(' ');
|
lcd_put_lchar(' ');
|
||||||
if (t2 >= 10) lcd_put_wchar(' ');
|
if (t2 >= 10) lcd_put_lchar(' ');
|
||||||
if (t2 >= 100) lcd_put_wchar(' ');
|
if (t2 >= 100) lcd_put_lchar(' ');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
lcd_put_u8str(i16tostr3left(t2));
|
lcd_put_u8str(i16tostr3left(t2));
|
||||||
|
|
||||||
if (prefix >= 0) {
|
if (prefix >= 0) {
|
||||||
lcd_put_wchar(LCD_STR_DEGREE[0]);
|
lcd_put_lchar(LCD_STR_DEGREE[0]);
|
||||||
lcd_put_wchar(' ');
|
lcd_put_lchar(' ');
|
||||||
if (t2 < 10) lcd_put_wchar(' ');
|
if (t2 < 10) lcd_put_lchar(' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -559,27 +559,27 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char pr
|
||||||
FORCE_INLINE void _draw_cooler_status(const char prefix, const bool blink) {
|
FORCE_INLINE void _draw_cooler_status(const char prefix, const bool blink) {
|
||||||
const celsius_t t2 = thermalManager.degTargetCooler();
|
const celsius_t t2 = thermalManager.degTargetCooler();
|
||||||
|
|
||||||
if (prefix >= 0) lcd_put_wchar(prefix);
|
if (prefix >= 0) lcd_put_lchar(prefix);
|
||||||
|
|
||||||
lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegCooler()));
|
lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegCooler()));
|
||||||
lcd_put_wchar('/');
|
lcd_put_lchar('/');
|
||||||
|
|
||||||
#if !HEATER_IDLE_HANDLER
|
#if !HEATER_IDLE_HANDLER
|
||||||
UNUSED(blink);
|
UNUSED(blink);
|
||||||
#else
|
#else
|
||||||
if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) {
|
if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) {
|
||||||
lcd_put_wchar(' ');
|
lcd_put_lchar(' ');
|
||||||
if (t2 >= 10) lcd_put_wchar(' ');
|
if (t2 >= 10) lcd_put_lchar(' ');
|
||||||
if (t2 >= 100) lcd_put_wchar(' ');
|
if (t2 >= 100) lcd_put_lchar(' ');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
lcd_put_u8str(i16tostr3left(t2));
|
lcd_put_u8str(i16tostr3left(t2));
|
||||||
|
|
||||||
if (prefix >= 0) {
|
if (prefix >= 0) {
|
||||||
lcd_put_wchar(LCD_STR_DEGREE[0]);
|
lcd_put_lchar(LCD_STR_DEGREE[0]);
|
||||||
lcd_put_wchar(' ');
|
lcd_put_lchar(' ');
|
||||||
if (t2 < 10) lcd_put_wchar(' ');
|
if (t2 < 10) lcd_put_lchar(' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -588,7 +588,7 @@ FORCE_INLINE void _draw_cooler_status(const char prefix, const bool blink) {
|
||||||
FORCE_INLINE void _draw_flowmeter_status() {
|
FORCE_INLINE void _draw_flowmeter_status() {
|
||||||
lcd_put_u8str("~");
|
lcd_put_u8str("~");
|
||||||
lcd_put_u8str(ftostr11ns(cooler.flowrate));
|
lcd_put_u8str(ftostr11ns(cooler.flowrate));
|
||||||
lcd_put_wchar('L');
|
lcd_put_lchar('L');
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -602,7 +602,7 @@ FORCE_INLINE void _draw_cooler_status(const char prefix, const bool blink) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lcd_put_u8str(ftostr12ns(ammeter.current));
|
lcd_put_u8str(ftostr12ns(ammeter.current));
|
||||||
lcd_put_wchar('A');
|
lcd_put_lchar('A');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -620,7 +620,7 @@ FORCE_INLINE void _draw_bed_status(const bool blink) {
|
||||||
lcd_put_u8str(ui8tostr3rj(progress));
|
lcd_put_u8str(ui8tostr3rj(progress));
|
||||||
else
|
else
|
||||||
lcd_put_u8str(F("---"));
|
lcd_put_u8str(F("---"));
|
||||||
lcd_put_wchar('%');
|
lcd_put_lchar('%');
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -667,7 +667,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
||||||
lcd_put_u8str(ftostr12ns(filwidth.measured_mm));
|
lcd_put_u8str(ftostr12ns(filwidth.measured_mm));
|
||||||
lcd_put_u8str(F(" V"));
|
lcd_put_u8str(F(" V"));
|
||||||
lcd_put_u8str(i16tostr3rj(planner.volumetric_percent(parser.volumetric_enabled)));
|
lcd_put_u8str(i16tostr3rj(planner.volumetric_percent(parser.volumetric_enabled)));
|
||||||
lcd_put_wchar('%');
|
lcd_put_lchar('%');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -686,7 +686,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
||||||
lcd_put_u8str(status_message);
|
lcd_put_u8str(status_message);
|
||||||
|
|
||||||
// Fill the rest with spaces
|
// Fill the rest with spaces
|
||||||
while (slen < LCD_WIDTH) { lcd_put_wchar(' '); ++slen; }
|
while (slen < LCD_WIDTH) { lcd_put_lchar(' '); ++slen; }
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// String is larger than the available space in screen.
|
// String is larger than the available space in screen.
|
||||||
|
@ -700,11 +700,11 @@ void MarlinUI::draw_status_message(const bool blink) {
|
||||||
// If the remaining string doesn't completely fill the screen
|
// If the remaining string doesn't completely fill the screen
|
||||||
if (rlen < LCD_WIDTH) {
|
if (rlen < LCD_WIDTH) {
|
||||||
uint8_t chars = LCD_WIDTH - rlen; // Amount of space left in characters
|
uint8_t chars = LCD_WIDTH - rlen; // Amount of space left in characters
|
||||||
lcd_put_wchar(' '); // Always at 1+ spaces left, draw a space
|
lcd_put_lchar(' '); // Always at 1+ spaces left, draw a space
|
||||||
if (--chars) { // Draw a second space if there's room
|
if (--chars) { // Draw a second space if there's room
|
||||||
lcd_put_wchar(' ');
|
lcd_put_lchar(' ');
|
||||||
if (--chars) { // Draw a third space if there's room
|
if (--chars) { // Draw a third space if there's room
|
||||||
lcd_put_wchar(' ');
|
lcd_put_lchar(' ');
|
||||||
if (--chars)
|
if (--chars)
|
||||||
lcd_put_u8str_max(status_message, chars); // Print a second copy of the message
|
lcd_put_u8str_max(status_message, chars); // Print a second copy of the message
|
||||||
}
|
}
|
||||||
|
@ -726,7 +726,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
||||||
|
|
||||||
// Fill the rest with spaces if there are missing spaces
|
// Fill the rest with spaces if there are missing spaces
|
||||||
while (slen < LCD_WIDTH) {
|
while (slen < LCD_WIDTH) {
|
||||||
lcd_put_wchar(' ');
|
lcd_put_lchar(' ');
|
||||||
++slen;
|
++slen;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -778,7 +778,7 @@ inline uint8_t draw_elapsed_or_remaining_time(uint8_t timepos, const bool blink)
|
||||||
duration_t remaining = (progress > 0) ? ((elapsed * 25600 / progress) >> 8) - elapsed : 0;
|
duration_t remaining = (progress > 0) ? ((elapsed * 25600 / progress) >> 8) - elapsed : 0;
|
||||||
#endif
|
#endif
|
||||||
timepos -= remaining.toDigital(buffer);
|
timepos -= remaining.toDigital(buffer);
|
||||||
lcd_put_wchar(timepos, 2, 'R');
|
lcd_put_lchar(timepos, 2, 'R');
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
constexpr bool show_remain = false;
|
constexpr bool show_remain = false;
|
||||||
|
@ -787,7 +787,7 @@ inline uint8_t draw_elapsed_or_remaining_time(uint8_t timepos, const bool blink)
|
||||||
if (!show_remain) {
|
if (!show_remain) {
|
||||||
duration_t elapsed = print_job_timer.duration();
|
duration_t elapsed = print_job_timer.duration();
|
||||||
timepos -= elapsed.toDigital(buffer);
|
timepos -= elapsed.toDigital(buffer);
|
||||||
lcd_put_wchar(timepos, 2, LCD_STR_CLOCK[0]);
|
lcd_put_lchar(timepos, 2, LCD_STR_CLOCK[0]);
|
||||||
}
|
}
|
||||||
lcd_put_u8str(buffer);
|
lcd_put_u8str(buffer);
|
||||||
return timepos;
|
return timepos;
|
||||||
|
@ -912,7 +912,7 @@ void MarlinUI::draw_status_screen() {
|
||||||
else {
|
else {
|
||||||
const xy_pos_t lpos = current_position.asLogical();
|
const xy_pos_t lpos = current_position.asLogical();
|
||||||
_draw_axis_value(X_AXIS, ftostr4sign(lpos.x), blink);
|
_draw_axis_value(X_AXIS, ftostr4sign(lpos.x), blink);
|
||||||
lcd_put_wchar(' ');
|
lcd_put_lchar(' ');
|
||||||
_draw_axis_value(Y_AXIS, ftostr4sign(lpos.y), blink);
|
_draw_axis_value(Y_AXIS, ftostr4sign(lpos.y), blink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -926,7 +926,7 @@ void MarlinUI::draw_status_screen() {
|
||||||
_draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink);
|
_draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink);
|
||||||
|
|
||||||
#if HAS_LEVELING && !HAS_HEATED_BED
|
#if HAS_LEVELING && !HAS_HEATED_BED
|
||||||
lcd_put_wchar(planner.leveling_active || blink ? '_' : ' ');
|
lcd_put_lchar(planner.leveling_active || blink ? '_' : ' ');
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // LCD_HEIGHT > 2
|
#endif // LCD_HEIGHT > 2
|
||||||
|
@ -935,9 +935,9 @@ void MarlinUI::draw_status_screen() {
|
||||||
|
|
||||||
#if LCD_HEIGHT > 3
|
#if LCD_HEIGHT > 3
|
||||||
|
|
||||||
lcd_put_wchar(0, 2, LCD_STR_FEEDRATE[0]);
|
lcd_put_lchar(0, 2, LCD_STR_FEEDRATE[0]);
|
||||||
lcd_put_u8str(i16tostr3rj(feedrate_percentage));
|
lcd_put_u8str(i16tostr3rj(feedrate_percentage));
|
||||||
lcd_put_wchar('%');
|
lcd_put_lchar('%');
|
||||||
|
|
||||||
const uint8_t timepos = draw_elapsed_or_remaining_time(LCD_WIDTH - 1, blink);
|
const uint8_t timepos = draw_elapsed_or_remaining_time(LCD_WIDTH - 1, blink);
|
||||||
|
|
||||||
|
@ -969,9 +969,9 @@ void MarlinUI::draw_status_screen() {
|
||||||
per = planner.flow_percentage[0];
|
per = planner.flow_percentage[0];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
lcd_put_wchar(c);
|
lcd_put_lchar(c);
|
||||||
lcd_put_u8str(i16tostr3rj(per));
|
lcd_put_u8str(i16tostr3rj(per));
|
||||||
lcd_put_wchar('%');
|
lcd_put_lchar('%');
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -993,7 +993,7 @@ void MarlinUI::draw_status_screen() {
|
||||||
_draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink);
|
_draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink);
|
||||||
|
|
||||||
#if HAS_LEVELING && (HAS_MULTI_HOTEND || !HAS_HEATED_BED)
|
#if HAS_LEVELING && (HAS_MULTI_HOTEND || !HAS_HEATED_BED)
|
||||||
lcd_put_wchar(LCD_WIDTH - 1, 0, planner.leveling_active || blink ? '_' : ' ');
|
lcd_put_lchar(LCD_WIDTH - 1, 0, planner.leveling_active || blink ? '_' : ' ');
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ========== Line 2 ==========
|
// ========== Line 2 ==========
|
||||||
|
@ -1008,9 +1008,9 @@ void MarlinUI::draw_status_screen() {
|
||||||
_draw_bed_status(blink);
|
_draw_bed_status(blink);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
lcd_put_wchar(LCD_WIDTH - 9, 1, LCD_STR_FEEDRATE[0]);
|
lcd_put_lchar(LCD_WIDTH - 9, 1, LCD_STR_FEEDRATE[0]);
|
||||||
lcd_put_u8str(i16tostr3rj(feedrate_percentage));
|
lcd_put_u8str(i16tostr3rj(feedrate_percentage));
|
||||||
lcd_put_wchar('%');
|
lcd_put_lchar('%');
|
||||||
|
|
||||||
// ========== Line 3 ==========
|
// ========== Line 3 ==========
|
||||||
|
|
||||||
|
@ -1075,29 +1075,29 @@ void MarlinUI::draw_status_screen() {
|
||||||
vlen = vstr ? utf8_strlen(vstr) : 0;
|
vlen = vstr ? utf8_strlen(vstr) : 0;
|
||||||
if (style & SS_CENTER) {
|
if (style & SS_CENTER) {
|
||||||
int8_t pad = (LCD_WIDTH - plen - vlen) / 2;
|
int8_t pad = (LCD_WIDTH - plen - vlen) / 2;
|
||||||
while (--pad >= 0) { lcd_put_wchar(' '); n--; }
|
while (--pad >= 0) { lcd_put_lchar(' '); n--; }
|
||||||
}
|
}
|
||||||
if (plen) n = lcd_put_u8str(fstr, itemIndex, itemStringC, itemStringF, n);
|
if (plen) n = lcd_put_u8str(fstr, itemIndex, itemStringC, itemStringF, n);
|
||||||
if (vlen) n -= lcd_put_u8str_max(vstr, n);
|
if (vlen) n -= lcd_put_u8str_max(vstr, n);
|
||||||
for (; n > 0; --n) lcd_put_wchar(' ');
|
for (; n > 0; --n) lcd_put_lchar(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a generic menu item with pre_char (if selected) and post_char
|
// Draw a generic menu item with pre_char (if selected) and post_char
|
||||||
void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char pre_char, const char post_char) {
|
void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char pre_char, const char post_char) {
|
||||||
lcd_put_wchar(0, row, sel ? pre_char : ' ');
|
lcd_put_lchar(0, row, sel ? pre_char : ' ');
|
||||||
uint8_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2);
|
uint8_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2);
|
||||||
for (; n; --n) lcd_put_wchar(' ');
|
for (; n; --n) lcd_put_lchar(' ');
|
||||||
lcd_put_wchar(post_char);
|
lcd_put_lchar(post_char);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a menu item with a (potentially) editable value
|
// Draw a menu item with a (potentially) editable value
|
||||||
void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char * const inStr, const bool pgm) {
|
void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char * const inStr, const bool pgm) {
|
||||||
const uint8_t vlen = inStr ? (pgm ? utf8_strlen_P(inStr) : utf8_strlen(inStr)) : 0;
|
const uint8_t vlen = inStr ? (pgm ? utf8_strlen_P(inStr) : utf8_strlen(inStr)) : 0;
|
||||||
lcd_put_wchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
|
lcd_put_lchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
|
||||||
uint8_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2 - vlen);
|
uint8_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2 - vlen);
|
||||||
if (vlen) {
|
if (vlen) {
|
||||||
lcd_put_wchar(':');
|
lcd_put_lchar(':');
|
||||||
for (; n; --n) lcd_put_wchar(' ');
|
for (; n; --n) lcd_put_lchar(' ');
|
||||||
if (pgm) lcd_put_u8str_P(inStr); else lcd_put_u8str(inStr);
|
if (pgm) lcd_put_u8str_P(inStr); else lcd_put_u8str(inStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1107,10 +1107,10 @@ void MarlinUI::draw_status_screen() {
|
||||||
ui.encoder_direction_normal();
|
ui.encoder_direction_normal();
|
||||||
uint8_t n = lcd_put_u8str(0, 1, ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 1);
|
uint8_t n = lcd_put_u8str(0, 1, ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 1);
|
||||||
if (value) {
|
if (value) {
|
||||||
lcd_put_wchar(':'); n--;
|
lcd_put_lchar(':'); n--;
|
||||||
const uint8_t len = utf8_strlen(value) + 1; // Plus one for a leading space
|
const uint8_t len = utf8_strlen(value) + 1; // Plus one for a leading space
|
||||||
const lcd_uint_t valrow = n < len ? 2 : 1; // Value on the next row if it won't fit
|
const lcd_uint_t valrow = n < len ? 2 : 1; // Value on the next row if it won't fit
|
||||||
lcd_put_wchar(LCD_WIDTH - len, valrow, ' '); // Right-justified, padded, leading space
|
lcd_put_lchar(LCD_WIDTH - len, valrow, ' '); // Right-justified, padded, leading space
|
||||||
lcd_put_u8str(value);
|
lcd_put_u8str(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1120,22 +1120,22 @@ void MarlinUI::draw_status_screen() {
|
||||||
ui.draw_select_screen_prompt(pref, string, suff);
|
ui.draw_select_screen_prompt(pref, string, suff);
|
||||||
if (no) {
|
if (no) {
|
||||||
SETCURSOR(0, LCD_HEIGHT - 1);
|
SETCURSOR(0, LCD_HEIGHT - 1);
|
||||||
lcd_put_wchar(yesno ? ' ' : '['); lcd_put_u8str(no); lcd_put_wchar(yesno ? ' ' : ']');
|
lcd_put_lchar(yesno ? ' ' : '['); lcd_put_u8str(no); lcd_put_lchar(yesno ? ' ' : ']');
|
||||||
}
|
}
|
||||||
if (yes) {
|
if (yes) {
|
||||||
SETCURSOR_RJ(utf8_strlen(yes) + 2, LCD_HEIGHT - 1);
|
SETCURSOR_RJ(utf8_strlen(yes) + 2, LCD_HEIGHT - 1);
|
||||||
lcd_put_wchar(yesno ? '[' : ' '); lcd_put_u8str(yes); lcd_put_wchar(yesno ? ']' : ' ');
|
lcd_put_lchar(yesno ? '[' : ' '); lcd_put_u8str(yes); lcd_put_lchar(yesno ? ']' : ' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(SDSUPPORT)
|
#if ENABLED(SDSUPPORT)
|
||||||
|
|
||||||
void MenuItem_sdbase::draw(const bool sel, const uint8_t row, FSTR_P const, CardReader &theCard, const bool isDir) {
|
void MenuItem_sdbase::draw(const bool sel, const uint8_t row, FSTR_P const, CardReader &theCard, const bool isDir) {
|
||||||
lcd_put_wchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
|
lcd_put_lchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
|
||||||
constexpr uint8_t maxlen = LCD_WIDTH - 2;
|
constexpr uint8_t maxlen = LCD_WIDTH - 2;
|
||||||
uint8_t n = maxlen - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), maxlen);
|
uint8_t n = maxlen - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), maxlen);
|
||||||
for (; n; --n) lcd_put_wchar(' ');
|
for (; n; --n) lcd_put_lchar(' ');
|
||||||
lcd_put_wchar(isDir ? LCD_STR_FOLDER[0] : ' ');
|
lcd_put_lchar(isDir ? LCD_STR_FOLDER[0] : ' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1253,7 +1253,7 @@ void MarlinUI::draw_status_screen() {
|
||||||
void prep_and_put_map_char(custom_char &chrdata, const coordinate &ul, const coordinate &lr, const coordinate &brc, const uint8_t cl, const char c, const lcd_uint_t x, const lcd_uint_t y) {
|
void prep_and_put_map_char(custom_char &chrdata, const coordinate &ul, const coordinate &lr, const coordinate &brc, const uint8_t cl, const char c, const lcd_uint_t x, const lcd_uint_t y) {
|
||||||
add_edges_to_custom_char(chrdata, ul, lr, brc, cl);
|
add_edges_to_custom_char(chrdata, ul, lr, brc, cl);
|
||||||
lcd.createChar(c, (uint8_t*)&chrdata);
|
lcd.createChar(c, (uint8_t*)&chrdata);
|
||||||
lcd_put_wchar(x, y, c);
|
lcd_put_lchar(x, y, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarlinUI::ubl_plot(const uint8_t x_plot, const uint8_t y_plot) {
|
void MarlinUI::ubl_plot(const uint8_t x_plot, const uint8_t y_plot) {
|
||||||
|
@ -1270,7 +1270,7 @@ void MarlinUI::draw_status_screen() {
|
||||||
#define _LCD_W_POS 8
|
#define _LCD_W_POS 8
|
||||||
#define _PLOT_X 0
|
#define _PLOT_X 0
|
||||||
#define _MAP_X 1
|
#define _MAP_X 1
|
||||||
#define _LABEL(X,Y,C) lcd_put_wchar(X, Y, C)
|
#define _LABEL(X,Y,C) lcd_put_lchar(X, Y, C)
|
||||||
#define _XLABEL(X,Y) _LABEL('X',X,Y)
|
#define _XLABEL(X,Y) _LABEL('X',X,Y)
|
||||||
#define _YLABEL(X,Y) _LABEL('Y',X,Y)
|
#define _YLABEL(X,Y) _LABEL('Y',X,Y)
|
||||||
#define _ZLABEL(X,Y) _LABEL('Z',X,Y)
|
#define _ZLABEL(X,Y) _LABEL('Z',X,Y)
|
||||||
|
@ -1333,13 +1333,13 @@ void MarlinUI::draw_status_screen() {
|
||||||
n_cols = right_edge / (HD44780_CHAR_WIDTH) + 1;
|
n_cols = right_edge / (HD44780_CHAR_WIDTH) + 1;
|
||||||
|
|
||||||
for (i = 0; i < n_cols; i++) {
|
for (i = 0; i < n_cols; i++) {
|
||||||
lcd_put_wchar(i, 0, CHAR_LINE_TOP); // Box Top line
|
lcd_put_lchar(i, 0, CHAR_LINE_TOP); // Box Top line
|
||||||
lcd_put_wchar(i, n_rows - 1, CHAR_LINE_BOT); // Box Bottom line
|
lcd_put_lchar(i, n_rows - 1, CHAR_LINE_BOT); // Box Bottom line
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j < n_rows; j++) {
|
for (j = 0; j < n_rows; j++) {
|
||||||
lcd_put_wchar(0, j, CHAR_EDGE_L); // Box Left edge
|
lcd_put_lchar(0, j, CHAR_EDGE_L); // Box Left edge
|
||||||
lcd_put_wchar(n_cols - 1, j, CHAR_EDGE_R); // Box Right edge
|
lcd_put_lchar(n_cols - 1, j, CHAR_EDGE_R); // Box Right edge
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1349,8 +1349,8 @@ void MarlinUI::draw_status_screen() {
|
||||||
k = pixels_per_y_mesh_pnt * (GRID_MAX_POINTS_Y) + 2;
|
k = pixels_per_y_mesh_pnt * (GRID_MAX_POINTS_Y) + 2;
|
||||||
l = (HD44780_CHAR_HEIGHT) * n_rows;
|
l = (HD44780_CHAR_HEIGHT) * n_rows;
|
||||||
if (l > k && l - k >= (HD44780_CHAR_HEIGHT) / 2) {
|
if (l > k && l - k >= (HD44780_CHAR_HEIGHT) / 2) {
|
||||||
lcd_put_wchar(0, n_rows - 1, ' '); // Box Left edge
|
lcd_put_lchar(0, n_rows - 1, ' '); // Box Left edge
|
||||||
lcd_put_wchar(n_cols - 1, n_rows - 1, ' '); // Box Right edge
|
lcd_put_lchar(n_cols - 1, n_rows - 1, ' '); // Box Right edge
|
||||||
}
|
}
|
||||||
|
|
||||||
clear_custom_char(&new_char);
|
clear_custom_char(&new_char);
|
||||||
|
@ -1464,11 +1464,11 @@ void MarlinUI::draw_status_screen() {
|
||||||
/**
|
/**
|
||||||
* Print plot position
|
* Print plot position
|
||||||
*/
|
*/
|
||||||
lcd_put_wchar(_LCD_W_POS, 0, '(');
|
lcd_put_lchar(_LCD_W_POS, 0, '(');
|
||||||
lcd_put_u8str(ui8tostr3rj(x_plot));
|
lcd_put_u8str(ui8tostr3rj(x_plot));
|
||||||
lcd_put_wchar(',');
|
lcd_put_lchar(',');
|
||||||
lcd_put_u8str(ui8tostr3rj(y_plot));
|
lcd_put_u8str(ui8tostr3rj(y_plot));
|
||||||
lcd_put_wchar(')');
|
lcd_put_lchar(')');
|
||||||
|
|
||||||
#if LCD_HEIGHT <= 3 // 16x2 or 20x2 display
|
#if LCD_HEIGHT <= 3 // 16x2 or 20x2 display
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
int lcd_glyph_height() { return 1; }
|
int lcd_glyph_height() { return 1; }
|
||||||
|
|
||||||
typedef struct _TFTGLCD_charmap_t {
|
typedef struct _TFTGLCD_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 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
|
uint8_t idx2; // the char used to be combined with the idx to simulate a single char
|
||||||
} TFTGLCD_charmap_t;
|
} TFTGLCD_charmap_t;
|
||||||
|
@ -991,7 +991,7 @@ void lcd_put_int(const int i) {
|
||||||
|
|
||||||
// return < 0 on error
|
// return < 0 on error
|
||||||
// return the advanced cols
|
// 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
|
// find the HD44780 internal ROM first
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -1049,10 +1049,10 @@ static int lcd_put_u8str_max_cb(const char * utf8_str, read_byte_cb_t cb_read_by
|
||||||
pixel_len_t ret = 0;
|
pixel_len_t ret = 0;
|
||||||
const uint8_t *p = (uint8_t *)utf8_str;
|
const uint8_t *p = (uint8_t *)utf8_str;
|
||||||
while (ret < max_length) {
|
while (ret < max_length) {
|
||||||
wchar_t ch = 0;
|
lchar_t wc;
|
||||||
p = get_utf8_value_cb(p, cb_read_byte, &ch);
|
p = get_utf8_value_cb(p, cb_read_byte, wc);
|
||||||
if (!ch) break;
|
if (!wc) break;
|
||||||
ret += lcd_put_wchar_max(ch, max_length - ret);
|
ret += lcd_put_lchar_max(wc, max_length - ret);
|
||||||
}
|
}
|
||||||
return (int)ret;
|
return (int)ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -524,16 +524,16 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
|
||||||
UNUSED(blink);
|
UNUSED(blink);
|
||||||
#else
|
#else
|
||||||
if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) {
|
if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) {
|
||||||
lcd_put_wchar(' ');
|
lcd_put_lchar(' ');
|
||||||
if (t2 >= 10) lcd_put_wchar(' ');
|
if (t2 >= 10) lcd_put_lchar(' ');
|
||||||
if (t2 >= 100) lcd_put_wchar(' ');
|
if (t2 >= 100) lcd_put_lchar(' ');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
lcd_put_u8str(i16tostr3left(t2));
|
lcd_put_u8str(i16tostr3left(t2));
|
||||||
|
|
||||||
lcd_put_wchar(' ');
|
lcd_put_lchar(' ');
|
||||||
if (t2 < 10) lcd_put_wchar(' ');
|
if (t2 < 10) lcd_put_lchar(' ');
|
||||||
|
|
||||||
if (t2) picBits |= ICON_TEMP1;
|
if (t2) picBits |= ICON_TEMP1;
|
||||||
else picBits &= ~ICON_TEMP1;
|
else picBits &= ~ICON_TEMP1;
|
||||||
|
@ -545,7 +545,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
|
||||||
|
|
||||||
FORCE_INLINE void _draw_flowmeter_status() {
|
FORCE_INLINE void _draw_flowmeter_status() {
|
||||||
lcd_moveto(5, 5); lcd_put_u8str(F("FLOW"));
|
lcd_moveto(5, 5); lcd_put_u8str(F("FLOW"));
|
||||||
lcd_moveto(7, 6); lcd_put_wchar('L');
|
lcd_moveto(7, 6); lcd_put_lchar('L');
|
||||||
lcd_moveto(6, 7); lcd_put_u8str(ftostr11ns(cooler.flowrate));
|
lcd_moveto(6, 7); lcd_put_u8str(ftostr11ns(cooler.flowrate));
|
||||||
|
|
||||||
if (cooler.flowrate) picBits |= ICON_FAN;
|
if (cooler.flowrate) picBits |= ICON_FAN;
|
||||||
|
@ -564,7 +564,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
|
||||||
{
|
{
|
||||||
lcd_put_u8str("mA");
|
lcd_put_u8str("mA");
|
||||||
lcd_moveto(10, 7);
|
lcd_moveto(10, 7);
|
||||||
lcd_put_wchar(' '); lcd_put_u8str(ui16tostr3rj(uint16_t(ammeter.current * 1000 + 0.5f)));
|
lcd_put_lchar(' '); lcd_put_u8str(ui16tostr3rj(uint16_t(ammeter.current * 1000 + 0.5f)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lcd_put_u8str(" A");
|
lcd_put_u8str(" A");
|
||||||
|
@ -585,9 +585,9 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
|
||||||
#if CUTTER_UNIT_IS(RPM)
|
#if CUTTER_UNIT_IS(RPM)
|
||||||
lcd_moveto(16, 6); lcd_put_u8str(F("RPM"));
|
lcd_moveto(16, 6); lcd_put_u8str(F("RPM"));
|
||||||
lcd_moveto(15, 7); lcd_put_u8str(ftostr31ns(float(cutter.unitPower) / 1000));
|
lcd_moveto(15, 7); lcd_put_u8str(ftostr31ns(float(cutter.unitPower) / 1000));
|
||||||
lcd_put_wchar('K');
|
lcd_put_lchar('K');
|
||||||
#elif CUTTER_UNIT_IS(PERCENT)
|
#elif CUTTER_UNIT_IS(PERCENT)
|
||||||
lcd_moveto(17, 6); lcd_put_wchar('%');
|
lcd_moveto(17, 6); lcd_put_lchar('%');
|
||||||
lcd_moveto(18, 7); lcd_put_u8str(cutter_power2str(cutter.unitPower));
|
lcd_moveto(18, 7); lcd_put_u8str(cutter_power2str(cutter.unitPower));
|
||||||
#else
|
#else
|
||||||
lcd_moveto(17, 7); lcd_put_u8str(cutter_power2str(cutter.unitPower));
|
lcd_moveto(17, 7); lcd_put_u8str(cutter_power2str(cutter.unitPower));
|
||||||
|
|
|
@ -28,7 +28,7 @@ void lcd_put_int(const int i) { u8g.print(i); }
|
||||||
|
|
||||||
// return < 0 on error
|
// return < 0 on error
|
||||||
// return the advanced pixels
|
// return the advanced pixels
|
||||||
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 (c < 256) {
|
if (c < 256) {
|
||||||
u8g.print((char)c);
|
u8g.print((char)c);
|
||||||
return u8g_GetFontBBXWidth(u8g.getU8g());
|
return u8g_GetFontBBXWidth(u8g.getU8g());
|
||||||
|
|
|
@ -371,11 +371,11 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||||
|
|
||||||
if (!PAGE_CONTAINS(y1 + 1, y2 + 2)) return;
|
if (!PAGE_CONTAINS(y1 + 1, y2 + 2)) return;
|
||||||
|
|
||||||
lcd_put_wchar(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), y2, 'E');
|
lcd_put_lchar(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), y2, 'E');
|
||||||
lcd_put_wchar((char)('1' + extruder));
|
lcd_put_lchar((char)('1' + extruder));
|
||||||
lcd_put_wchar(' ');
|
lcd_put_lchar(' ');
|
||||||
lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegHotend(extruder)));
|
lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegHotend(extruder)));
|
||||||
lcd_put_wchar('/');
|
lcd_put_lchar('/');
|
||||||
|
|
||||||
if (get_blink() || !thermalManager.heater_idle[extruder].timed_out)
|
if (get_blink() || !thermalManager.heater_idle[extruder].timed_out)
|
||||||
lcd_put_u8str(i16tostr3rj(thermalManager.degTargetHotend(extruder)));
|
lcd_put_u8str(i16tostr3rj(thermalManager.degTargetHotend(extruder)));
|
||||||
|
@ -421,12 +421,12 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||||
vlen = vstr ? utf8_strlen(vstr) : 0;
|
vlen = vstr ? utf8_strlen(vstr) : 0;
|
||||||
if (style & SS_CENTER) {
|
if (style & SS_CENTER) {
|
||||||
int pad = (LCD_PIXEL_WIDTH - plen - vlen * MENU_FONT_WIDTH) / MENU_FONT_WIDTH / 2;
|
int pad = (LCD_PIXEL_WIDTH - plen - vlen * MENU_FONT_WIDTH) / MENU_FONT_WIDTH / 2;
|
||||||
while (--pad >= 0) n -= lcd_put_wchar(' ');
|
while (--pad >= 0) n -= lcd_put_lchar(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plen) n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, n / (MENU_FONT_WIDTH)) * (MENU_FONT_WIDTH);
|
if (plen) n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, n / (MENU_FONT_WIDTH)) * (MENU_FONT_WIDTH);
|
||||||
if (vlen) n -= lcd_put_u8str_max(vstr, n);
|
if (vlen) n -= lcd_put_u8str_max(vstr, n);
|
||||||
while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' ');
|
while (n > MENU_FONT_WIDTH) n -= lcd_put_lchar(' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,9 +434,9 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||||
void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char, const char post_char) {
|
void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char, const char post_char) {
|
||||||
if (mark_as_selected(row, sel)) {
|
if (mark_as_selected(row, sel)) {
|
||||||
pixel_len_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 1) * (MENU_FONT_WIDTH);
|
pixel_len_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 1) * (MENU_FONT_WIDTH);
|
||||||
while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' ');
|
while (n > MENU_FONT_WIDTH) n -= lcd_put_lchar(' ');
|
||||||
lcd_put_wchar(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH), row_y2, post_char);
|
lcd_put_lchar(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH), row_y2, post_char);
|
||||||
lcd_put_wchar(' ');
|
lcd_put_lchar(' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,8 +449,8 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||||
|
|
||||||
pixel_len_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2 - vallen * prop) * (MENU_FONT_WIDTH);
|
pixel_len_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2 - vallen * prop) * (MENU_FONT_WIDTH);
|
||||||
if (vallen) {
|
if (vallen) {
|
||||||
lcd_put_wchar(':');
|
lcd_put_lchar(':');
|
||||||
while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' ');
|
while (n > MENU_FONT_WIDTH) n -= lcd_put_lchar(' ');
|
||||||
lcd_moveto(LCD_PIXEL_WIDTH - _MAX((MENU_FONT_WIDTH) * vallen, pixelwidth + 2), row_y2);
|
lcd_moveto(LCD_PIXEL_WIDTH - _MAX((MENU_FONT_WIDTH) * vallen, pixelwidth + 2), row_y2);
|
||||||
if (pgm) lcd_put_u8str_P(inStr); else lcd_put_u8str(inStr);
|
if (pgm) lcd_put_u8str_P(inStr); else lcd_put_u8str(inStr);
|
||||||
}
|
}
|
||||||
|
@ -494,14 +494,14 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||||
|
|
||||||
// If a value is included, print a colon, then print the value right-justified
|
// If a value is included, print a colon, then print the value right-justified
|
||||||
if (value) {
|
if (value) {
|
||||||
lcd_put_wchar(':');
|
lcd_put_lchar(':');
|
||||||
if (extra_row) {
|
if (extra_row) {
|
||||||
// Assume that value is numeric (with no descender)
|
// Assume that value is numeric (with no descender)
|
||||||
baseline += EDIT_FONT_ASCENT + 2;
|
baseline += EDIT_FONT_ASCENT + 2;
|
||||||
onpage = PAGE_CONTAINS(baseline - (EDIT_FONT_ASCENT - 1), baseline);
|
onpage = PAGE_CONTAINS(baseline - (EDIT_FONT_ASCENT - 1), baseline);
|
||||||
}
|
}
|
||||||
if (onpage) {
|
if (onpage) {
|
||||||
lcd_put_wchar(((lcd_chr_fit - 1) - (vallen * prop + 1)) * one_chr_width, baseline, ' '); // Right-justified, padded, add a leading space
|
lcd_put_lchar(((lcd_chr_fit - 1) - (vallen * prop + 1)) * one_chr_width, baseline, ' '); // Right-justified, padded, add a leading space
|
||||||
lcd_put_u8str(value);
|
lcd_put_u8str(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -533,10 +533,10 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||||
void MenuItem_sdbase::draw(const bool sel, const uint8_t row, FSTR_P const, CardReader &theCard, const bool isDir) {
|
void MenuItem_sdbase::draw(const bool sel, const uint8_t row, FSTR_P const, CardReader &theCard, const bool isDir) {
|
||||||
if (mark_as_selected(row, sel)) {
|
if (mark_as_selected(row, sel)) {
|
||||||
const uint8_t maxlen = LCD_WIDTH - isDir;
|
const uint8_t maxlen = LCD_WIDTH - isDir;
|
||||||
if (isDir) lcd_put_wchar(LCD_STR_FOLDER[0]);
|
if (isDir) lcd_put_lchar(LCD_STR_FOLDER[0]);
|
||||||
const pixel_len_t pixw = maxlen * (MENU_FONT_WIDTH);
|
const pixel_len_t pixw = maxlen * (MENU_FONT_WIDTH);
|
||||||
pixel_len_t n = pixw - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), pixw);
|
pixel_len_t n = pixw - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), pixw);
|
||||||
while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' ');
|
while (n > MENU_FONT_WIDTH) n -= lcd_put_lchar(' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -611,11 +611,11 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||||
|
|
||||||
// Print plot position
|
// Print plot position
|
||||||
if (PAGE_CONTAINS(LCD_PIXEL_HEIGHT - (INFO_FONT_HEIGHT - 1), LCD_PIXEL_HEIGHT)) {
|
if (PAGE_CONTAINS(LCD_PIXEL_HEIGHT - (INFO_FONT_HEIGHT - 1), LCD_PIXEL_HEIGHT)) {
|
||||||
lcd_put_wchar(5, LCD_PIXEL_HEIGHT, '(');
|
lcd_put_lchar(5, LCD_PIXEL_HEIGHT, '(');
|
||||||
u8g.print(x_plot);
|
u8g.print(x_plot);
|
||||||
lcd_put_wchar(',');
|
lcd_put_lchar(',');
|
||||||
u8g.print(y_plot);
|
u8g.print(y_plot);
|
||||||
lcd_put_wchar(')');
|
lcd_put_lchar(')');
|
||||||
|
|
||||||
// Show the location value
|
// Show the location value
|
||||||
lcd_put_u8str_P(74, LCD_PIXEL_HEIGHT, Z_LBL);
|
lcd_put_u8str_P(74, LCD_PIXEL_HEIGHT, Z_LBL);
|
||||||
|
|
|
@ -200,7 +200,7 @@ FORCE_INLINE void _draw_centered_temp(const celsius_t temp, const uint8_t tx, co
|
||||||
const char *str = i16tostr3rj(temp);
|
const char *str = i16tostr3rj(temp);
|
||||||
const uint8_t len = str[0] != ' ' ? 3 : str[1] != ' ' ? 2 : 1;
|
const uint8_t len = str[0] != ' ' ? 3 : str[1] != ' ' ? 2 : 1;
|
||||||
lcd_put_u8str(tx - len * (INFO_FONT_WIDTH) / 2 + 1, ty, &str[3-len]);
|
lcd_put_u8str(tx - len * (INFO_FONT_WIDTH) / 2 + 1, ty, &str[3-len]);
|
||||||
lcd_put_wchar(LCD_STR_DEGREE[0]);
|
lcd_put_lchar(LCD_STR_DEGREE[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,13 +432,13 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
|
||||||
const bool is_inch = parser.using_inch_units();
|
const bool is_inch = parser.using_inch_units();
|
||||||
const AxisEnum a = TERN(LCD_SHOW_E_TOTAL, axis == E_AXIS ? X_AXIS : axis, axis);
|
const AxisEnum a = TERN(LCD_SHOW_E_TOTAL, axis == E_AXIS ? X_AXIS : axis, axis);
|
||||||
const uint8_t offs = a * (is_inch ? XYZ_SPACING_IN : XYZ_SPACING);
|
const uint8_t offs = a * (is_inch ? XYZ_SPACING_IN : XYZ_SPACING);
|
||||||
lcd_put_wchar((is_inch ? X_LABEL_POS_IN : X_LABEL_POS) + offs, XYZ_BASELINE, axis_codes[axis]);
|
lcd_put_lchar((is_inch ? X_LABEL_POS_IN : X_LABEL_POS) + offs, XYZ_BASELINE, axis_codes[axis]);
|
||||||
lcd_moveto((is_inch ? X_VALUE_POS_IN : X_VALUE_POS) + offs, XYZ_BASELINE);
|
lcd_moveto((is_inch ? X_VALUE_POS_IN : X_VALUE_POS) + offs, XYZ_BASELINE);
|
||||||
|
|
||||||
if (blink)
|
if (blink)
|
||||||
lcd_put_u8str(value);
|
lcd_put_u8str(value);
|
||||||
else if (axis_should_home(axis))
|
else if (axis_should_home(axis))
|
||||||
while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?');
|
while (const char c = *value++) lcd_put_lchar(c <= '.' ? c : '?');
|
||||||
else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
|
else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
|
||||||
lcd_put_u8str(axis == Z_AXIS ? F(" ") : F(" "));
|
lcd_put_u8str(axis == Z_AXIS ? F(" ") : F(" "));
|
||||||
else
|
else
|
||||||
|
@ -675,7 +675,7 @@ void MarlinUI::draw_status_screen() {
|
||||||
lcd_put_u8str(STATUS_CUTTER_TEXT_X, STATUS_CUTTER_TEXT_Y, cutter_power2str(cutter.unitPower));
|
lcd_put_u8str(STATUS_CUTTER_TEXT_X, STATUS_CUTTER_TEXT_Y, cutter_power2str(cutter.unitPower));
|
||||||
#elif CUTTER_UNIT_IS(RPM)
|
#elif CUTTER_UNIT_IS(RPM)
|
||||||
lcd_put_u8str(STATUS_CUTTER_TEXT_X - 2, STATUS_CUTTER_TEXT_Y, ftostr61rj(float(cutter.unitPower) / 1000));
|
lcd_put_u8str(STATUS_CUTTER_TEXT_X - 2, STATUS_CUTTER_TEXT_Y, ftostr61rj(float(cutter.unitPower) / 1000));
|
||||||
lcd_put_wchar('K');
|
lcd_put_lchar('K');
|
||||||
#else
|
#else
|
||||||
lcd_put_u8str(STATUS_CUTTER_TEXT_X, STATUS_CUTTER_TEXT_Y, cutter_power2str(cutter.unitPower));
|
lcd_put_u8str(STATUS_CUTTER_TEXT_X, STATUS_CUTTER_TEXT_Y, cutter_power2str(cutter.unitPower));
|
||||||
#endif
|
#endif
|
||||||
|
@ -734,7 +734,7 @@ void MarlinUI::draw_status_screen() {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
lcd_put_u8str(STATUS_FAN_TEXT_X, STATUS_FAN_TEXT_Y, i16tostr3rj(thermalManager.pwmToPercent(spd)));
|
lcd_put_u8str(STATUS_FAN_TEXT_X, STATUS_FAN_TEXT_Y, i16tostr3rj(thermalManager.pwmToPercent(spd)));
|
||||||
lcd_put_wchar(c);
|
lcd_put_lchar(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -783,7 +783,7 @@ void MarlinUI::draw_status_screen() {
|
||||||
if (progress_state == 0) {
|
if (progress_state == 0) {
|
||||||
if (progress_string[0]) {
|
if (progress_string[0]) {
|
||||||
lcd_put_u8str(progress_x_pos, EXTRAS_BASELINE, progress_string);
|
lcd_put_u8str(progress_x_pos, EXTRAS_BASELINE, progress_string);
|
||||||
lcd_put_wchar('%');
|
lcd_put_lchar('%');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (progress_state == 2 && estimation_string[0]) {
|
else if (progress_state == 2 && estimation_string[0]) {
|
||||||
|
@ -804,7 +804,7 @@ void MarlinUI::draw_status_screen() {
|
||||||
#if ENABLED(SHOW_SD_PERCENT)
|
#if ENABLED(SHOW_SD_PERCENT)
|
||||||
if (progress_string[0]) {
|
if (progress_string[0]) {
|
||||||
lcd_put_u8str(55, EXTRAS_BASELINE, progress_string); // Percent complete
|
lcd_put_u8str(55, EXTRAS_BASELINE, progress_string); // Percent complete
|
||||||
lcd_put_wchar('%');
|
lcd_put_lchar('%');
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -814,7 +814,7 @@ void MarlinUI::draw_status_screen() {
|
||||||
|
|
||||||
#if ENABLED(SHOW_REMAINING_TIME)
|
#if ENABLED(SHOW_REMAINING_TIME)
|
||||||
if (blink && estimation_string[0]) {
|
if (blink && estimation_string[0]) {
|
||||||
lcd_put_wchar(estimation_x_pos, EXTRAS_BASELINE, 'R');
|
lcd_put_lchar(estimation_x_pos, EXTRAS_BASELINE, 'R');
|
||||||
lcd_put_u8str(estimation_string);
|
lcd_put_u8str(estimation_string);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -912,11 +912,11 @@ void MarlinUI::draw_status_screen() {
|
||||||
|
|
||||||
if (PAGE_CONTAINS(EXTRAS_2_BASELINE - INFO_FONT_ASCENT, EXTRAS_2_BASELINE - 1)) {
|
if (PAGE_CONTAINS(EXTRAS_2_BASELINE - INFO_FONT_ASCENT, EXTRAS_2_BASELINE - 1)) {
|
||||||
set_font(FONT_MENU);
|
set_font(FONT_MENU);
|
||||||
lcd_put_wchar(3, EXTRAS_2_BASELINE, LCD_STR_FEEDRATE[0]);
|
lcd_put_lchar(3, EXTRAS_2_BASELINE, LCD_STR_FEEDRATE[0]);
|
||||||
|
|
||||||
set_font(FONT_STATUSMENU);
|
set_font(FONT_STATUSMENU);
|
||||||
lcd_put_u8str(12, EXTRAS_2_BASELINE, i16tostr3rj(feedrate_percentage));
|
lcd_put_u8str(12, EXTRAS_2_BASELINE, i16tostr3rj(feedrate_percentage));
|
||||||
lcd_put_wchar('%');
|
lcd_put_lchar('%');
|
||||||
|
|
||||||
//
|
//
|
||||||
// Filament sensor display if SD is disabled
|
// Filament sensor display if SD is disabled
|
||||||
|
@ -924,10 +924,10 @@ void MarlinUI::draw_status_screen() {
|
||||||
#if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT)
|
#if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT)
|
||||||
lcd_put_u8str(56, EXTRAS_2_BASELINE, wstring);
|
lcd_put_u8str(56, EXTRAS_2_BASELINE, wstring);
|
||||||
lcd_put_u8str(102, EXTRAS_2_BASELINE, mstring);
|
lcd_put_u8str(102, EXTRAS_2_BASELINE, mstring);
|
||||||
lcd_put_wchar('%');
|
lcd_put_lchar('%');
|
||||||
set_font(FONT_MENU);
|
set_font(FONT_MENU);
|
||||||
lcd_put_wchar(47, EXTRAS_2_BASELINE, LCD_STR_FILAM_DIA[0]); // lcd_put_u8str(F(LCD_STR_FILAM_DIA));
|
lcd_put_lchar(47, EXTRAS_2_BASELINE, LCD_STR_FILAM_DIA[0]); // lcd_put_u8str(F(LCD_STR_FILAM_DIA));
|
||||||
lcd_put_wchar(93, EXTRAS_2_BASELINE, LCD_STR_FILAM_MUL[0]);
|
lcd_put_lchar(93, EXTRAS_2_BASELINE, LCD_STR_FILAM_MUL[0]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -941,12 +941,12 @@ void MarlinUI::draw_status_screen() {
|
||||||
// Alternate Status message and Filament display
|
// Alternate Status message and Filament display
|
||||||
if (ELAPSED(millis(), next_filament_display)) {
|
if (ELAPSED(millis(), next_filament_display)) {
|
||||||
lcd_put_u8str(F(LCD_STR_FILAM_DIA));
|
lcd_put_u8str(F(LCD_STR_FILAM_DIA));
|
||||||
lcd_put_wchar(':');
|
lcd_put_lchar(':');
|
||||||
lcd_put_u8str(wstring);
|
lcd_put_u8str(wstring);
|
||||||
lcd_put_u8str(F(" " LCD_STR_FILAM_MUL));
|
lcd_put_u8str(F(" " LCD_STR_FILAM_MUL));
|
||||||
lcd_put_wchar(':');
|
lcd_put_lchar(':');
|
||||||
lcd_put_u8str(mstring);
|
lcd_put_u8str(mstring);
|
||||||
lcd_put_wchar('%');
|
lcd_put_lchar('%');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -979,7 +979,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
||||||
if (slen <= lcd_width) {
|
if (slen <= lcd_width) {
|
||||||
// The string fits within the line. Print with no scrolling
|
// The string fits within the line. Print with no scrolling
|
||||||
lcd_put_u8str(status_message);
|
lcd_put_u8str(status_message);
|
||||||
while (slen < lcd_width) { lcd_put_wchar(' '); ++slen; }
|
while (slen < lcd_width) { lcd_put_lchar(' '); ++slen; }
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// String is longer than the available space
|
// String is longer than the available space
|
||||||
|
@ -997,14 +997,14 @@ void MarlinUI::draw_status_message(const bool blink) {
|
||||||
// If the remaining string doesn't completely fill the screen
|
// If the remaining string doesn't completely fill the screen
|
||||||
if (rlen < lcd_width) {
|
if (rlen < lcd_width) {
|
||||||
uint8_t chars = lcd_width - rlen; // Amount of space left in characters
|
uint8_t chars = lcd_width - rlen; // Amount of space left in characters
|
||||||
lcd_put_wchar(' '); // Always at 1+ spaces left, draw a space
|
lcd_put_lchar(' '); // Always at 1+ spaces left, draw a space
|
||||||
if (--chars) { // Draw a second space if there's room
|
if (--chars) { // Draw a second space if there's room
|
||||||
lcd_put_wchar(' ');
|
lcd_put_lchar(' ');
|
||||||
if (--chars) { // Draw a third space if there's room
|
if (--chars) { // Draw a third space if there's room
|
||||||
lcd_put_wchar(' ');
|
lcd_put_lchar(' ');
|
||||||
if (--chars) { // Print a second copy of the message
|
if (--chars) { // Print a second copy of the message
|
||||||
lcd_put_u8str_max(status_message, pixel_width - (rlen + 2) * (MENU_FONT_WIDTH));
|
lcd_put_u8str_max(status_message, pixel_width - (rlen + 2) * (MENU_FONT_WIDTH));
|
||||||
lcd_put_wchar(' ');
|
lcd_put_lchar(' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1019,7 +1019,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
||||||
lcd_put_u8str_max(status_message, pixel_width);
|
lcd_put_u8str_max(status_message, pixel_width);
|
||||||
|
|
||||||
// Fill the rest with spaces
|
// Fill the rest with spaces
|
||||||
for (; slen < lcd_width; ++slen) lcd_put_wchar(' ');
|
for (; slen < lcd_width; ++slen) lcd_put_lchar(' ');
|
||||||
|
|
||||||
#endif // !STATUS_MESSAGE_SCROLLING
|
#endif // !STATUS_MESSAGE_SCROLLING
|
||||||
|
|
||||||
|
|
|
@ -60,11 +60,11 @@ static int fontgroup_init(font_group_t * root, const uxg_fontinfo_t * fntinfo, i
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const font_t* fontgroup_find(font_group_t * root, wchar_t val) {
|
static const font_t* fontgroup_find(font_group_t * root, const lchar_t &val) {
|
||||||
uxg_fontinfo_t vcmp = {(uint16_t)(val / 128), (uint8_t)(val % 128 + 128), (uint8_t)(val % 128 + 128), 0, 0};
|
if (val <= 0xFF) return nullptr;
|
||||||
size_t idx = 0;
|
|
||||||
|
|
||||||
if (val < 256) return nullptr;
|
uxg_fontinfo_t vcmp = { uint16_t(val >> 7), uint8_t((val & 0x7F) + 0x80), uint8_t((val & 0x7F) + 0x80), 0, 0 };
|
||||||
|
size_t idx = 0;
|
||||||
|
|
||||||
if (pf_bsearch_r((void*)root->m_fntifo, root->m_fntinfo_num, pf_bsearch_cb_comp_fntifo_pgm, (void*)&vcmp, &idx) < 0)
|
if (pf_bsearch_r((void*)root->m_fntifo, root->m_fntinfo_num, pf_bsearch_cb_comp_fntifo_pgm, (void*)&vcmp, &idx) < 0)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -73,7 +73,7 @@ static const font_t* fontgroup_find(font_group_t * root, wchar_t val) {
|
||||||
return vcmp.fntdata;
|
return vcmp.fntdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fontgroup_drawwchar(font_group_t *group, const font_t *fnt_default, wchar_t val, void * userdata, fontgroup_cb_draw_t cb_draw_ram) {
|
static void fontgroup_drawwchar(font_group_t *group, const font_t *fnt_default, const lchar_t &val, void * userdata, fontgroup_cb_draw_t cb_draw_ram) {
|
||||||
uint8_t buf[2] = {0, 0};
|
uint8_t buf[2] = {0, 0};
|
||||||
const font_t * fntpqm = (font_t*)fontgroup_find(group, val);
|
const font_t * fntpqm = (font_t*)fontgroup_find(group, val);
|
||||||
if (!fntpqm) {
|
if (!fntpqm) {
|
||||||
|
@ -106,10 +106,10 @@ static void fontgroup_drawwchar(font_group_t *group, const font_t *fnt_default,
|
||||||
static void fontgroup_drawstring(font_group_t *group, const font_t *fnt_default, const char *utf8_msg, read_byte_cb_t cb_read_byte, void * userdata, fontgroup_cb_draw_t cb_draw_ram) {
|
static void fontgroup_drawstring(font_group_t *group, const font_t *fnt_default, const char *utf8_msg, read_byte_cb_t cb_read_byte, void * userdata, fontgroup_cb_draw_t cb_draw_ram) {
|
||||||
const uint8_t *p = (uint8_t*)utf8_msg;
|
const uint8_t *p = (uint8_t*)utf8_msg;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
wchar_t val = 0;
|
lchar_t wc;
|
||||||
p = get_utf8_value_cb(p, cb_read_byte, &val);
|
p = get_utf8_value_cb(p, cb_read_byte, wc);
|
||||||
if (!val) break;
|
if (!wc) break;
|
||||||
fontgroup_drawwchar(group, fnt_default, val, userdata, cb_draw_ram);
|
fontgroup_drawwchar(group, fnt_default, wc, userdata, cb_draw_ram);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,19 +149,19 @@ static int fontgroup_cb_draw_u8g(void *userdata, const font_t *fnt_current, cons
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Draw a wchar_t at the specified position
|
* @brief Draw a lchar_t at the specified position
|
||||||
*
|
*
|
||||||
* @param pu8g : U8G pointer
|
* @param pu8g : U8G pointer
|
||||||
* @param x : position x axis
|
* @param x : position x axis
|
||||||
* @param y : position y axis
|
* @param y : position y axis
|
||||||
* @param ch : the wchar_t
|
* @param wc : the lchar_t
|
||||||
* @param max_width : the pixel width of the string allowed
|
* @param max_width : the pixel width of the string allowed
|
||||||
*
|
*
|
||||||
* @return number of pixels advanced
|
* @return number of pixels advanced
|
||||||
*
|
*
|
||||||
* Draw a UTF-8 string at the specified position
|
* Draw a UTF-8 string at the specified position
|
||||||
*/
|
*/
|
||||||
unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t ch, pixel_len_t max_width) {
|
unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, const lchar_t &wc, pixel_len_t max_width) {
|
||||||
struct _uxg_drawu8_data_t data;
|
struct _uxg_drawu8_data_t data;
|
||||||
font_group_t *group = &g_fontgroup_root;
|
font_group_t *group = &g_fontgroup_root;
|
||||||
const font_t *fnt_default = uxg_GetFont(pu8g);
|
const font_t *fnt_default = uxg_GetFont(pu8g);
|
||||||
|
@ -176,7 +176,7 @@ unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t
|
||||||
data.adv = 0;
|
data.adv = 0;
|
||||||
data.max_width = max_width;
|
data.max_width = max_width;
|
||||||
data.fnt_prev = nullptr;
|
data.fnt_prev = nullptr;
|
||||||
fontgroup_drawwchar(group, fnt_default, ch, (void*)&data, fontgroup_cb_draw_u8g);
|
fontgroup_drawwchar(group, fnt_default, wc, (void*)&data, fontgroup_cb_draw_u8g);
|
||||||
u8g_SetFont(pu8g, (const u8g_fntpgm_uint8_t*)fnt_default);
|
u8g_SetFont(pu8g, (const u8g_fntpgm_uint8_t*)fnt_default);
|
||||||
|
|
||||||
return data.adv;
|
return data.adv;
|
||||||
|
|
|
@ -26,7 +26,7 @@ typedef struct _uxg_fontinfo_t {
|
||||||
|
|
||||||
int uxg_SetUtf8Fonts(const uxg_fontinfo_t * fntinfo, int number); // fntinfo is type of PROGMEM
|
int uxg_SetUtf8Fonts(const uxg_fontinfo_t * fntinfo, int number); // fntinfo is type of PROGMEM
|
||||||
|
|
||||||
unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t ch, const pixel_len_t max_length);
|
unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, const lchar_t &ch, const pixel_len_t max_length);
|
||||||
|
|
||||||
unsigned int uxg_DrawUtf8Str(u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, const pixel_len_t max_length);
|
unsigned int uxg_DrawUtf8Str(u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, const pixel_len_t max_length);
|
||||||
unsigned int uxg_DrawUtf8StrP(u8g_t *pu8g, unsigned int x, unsigned int y, PGM_P utf8_msg, const pixel_len_t max_length);
|
unsigned int uxg_DrawUtf8StrP(u8g_t *pu8g, unsigned int x, unsigned int y, PGM_P utf8_msg, const pixel_len_t max_length);
|
||||||
|
|
|
@ -50,12 +50,12 @@ uint8_t read_byte(const uint8_t *byte) { return *byte; }
|
||||||
* @ displays an axis name such as XYZUVW, or E for an extruder
|
* @ displays an axis name such as XYZUVW, or E for an extruder
|
||||||
*/
|
*/
|
||||||
void DWIN_String::add(const char *tpl, const int8_t index, const char *cstr/*=nullptr*/, FSTR_P const fstr/*=nullptr*/) {
|
void DWIN_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) {
|
while (*tpl) {
|
||||||
tpl = get_utf8_value_cb(tpl, read_byte, &wchar);
|
tpl = get_utf8_value_cb(tpl, read_byte, wc);
|
||||||
if (wchar > 255) wchar |= 0x0080;
|
if (wc > 255) wc |= 0x0080;
|
||||||
const uint8_t ch = uint8_t(wchar & 0x00FF);
|
const uint8_t ch = uint8_t(wc & 0x00FF);
|
||||||
|
|
||||||
if (ch == '=' || ch == '~' || ch == '*') {
|
if (ch == '=' || ch == '~' || ch == '*') {
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
|
@ -80,32 +80,32 @@ void DWIN_String::add(const char *tpl, const int8_t index, const char *cstr/*=nu
|
||||||
}
|
}
|
||||||
|
|
||||||
void DWIN_String::add(const char *cstr, uint8_t max_len/*=MAX_STRING_LENGTH*/) {
|
void DWIN_String::add(const char *cstr, uint8_t max_len/*=MAX_STRING_LENGTH*/) {
|
||||||
wchar_t wchar;
|
lchar_t wc;
|
||||||
while (*cstr && max_len) {
|
while (*cstr && max_len) {
|
||||||
cstr = get_utf8_value_cb(cstr, read_byte, &wchar);
|
cstr = get_utf8_value_cb(cstr, read_byte, wc);
|
||||||
/*
|
/*
|
||||||
if (wchar > 255) wchar |= 0x0080;
|
if (wc > 255) wc |= 0x0080;
|
||||||
uint8_t ch = uint8_t(wchar & 0x00FF);
|
const uint8_t ch = uint8_t(wc & 0x00FF);
|
||||||
add_character(ch);
|
add_character(ch);
|
||||||
*/
|
*/
|
||||||
add(wchar);
|
add(wc);
|
||||||
max_len--;
|
max_len--;
|
||||||
}
|
}
|
||||||
eol();
|
eol();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DWIN_String::add(const wchar_t character) {
|
void DWIN_String::add(const lchar_t &wc) {
|
||||||
int ret;
|
int ret;
|
||||||
size_t idx = 0;
|
size_t idx = 0;
|
||||||
dwin_charmap_t pinval;
|
dwin_charmap_t pinval;
|
||||||
dwin_charmap_t *copy_address = nullptr;
|
dwin_charmap_t *copy_address = nullptr;
|
||||||
pinval.uchar = character;
|
pinval.uchar = wc;
|
||||||
pinval.idx = -1;
|
pinval.idx = -1;
|
||||||
|
|
||||||
// For 8-bit ASCII just print the single character
|
// For 8-bit ASCII just print the single character
|
||||||
char str[] = { '?', 0 };
|
char str[] = { '?', 0 };
|
||||||
if (character < 255) {
|
if (wc < 255) {
|
||||||
str[0] = (char)character;
|
str[0] = (char)wc;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
copy_address = nullptr;
|
copy_address = nullptr;
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
typedef struct _dwin_charmap_t {
|
typedef struct _dwin_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 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
|
uint8_t idx2; // the char used to be combined with the idx to simulate a single char
|
||||||
} dwin_charmap_t;
|
} dwin_charmap_t;
|
||||||
|
@ -69,10 +69,10 @@ class DWIN_String {
|
||||||
/**
|
/**
|
||||||
* @brief Append a UTF-8 character
|
* @brief Append a UTF-8 character
|
||||||
*
|
*
|
||||||
* @param character The UTF-8 character
|
* @param wc The UTF-8 character
|
||||||
*/
|
*/
|
||||||
static void add(wchar_t character);
|
static void add(const lchar_t &wc);
|
||||||
static void set(wchar_t character) { set(); add(character); }
|
static void set(const lchar_t &wc) { set(); add(wc); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Append / Set C-string
|
* @brief Append / Set C-string
|
||||||
|
|
|
@ -63,7 +63,7 @@ int lcd_put_dwin_string() {
|
||||||
|
|
||||||
// return < 0 on error
|
// return < 0 on error
|
||||||
// return the advanced cols
|
// 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) {
|
||||||
dwin_string.set(c);
|
dwin_string.set(c);
|
||||||
dwin_string.truncate(max_length);
|
dwin_string.truncate(max_length);
|
||||||
// Draw the char(s) at the cursor and advance the cursor
|
// Draw the char(s) at the cursor and advance the cursor
|
||||||
|
@ -87,10 +87,10 @@ static int lcd_put_u8str_max_cb(const char * utf8_str, read_byte_cb_t cb_read_by
|
||||||
const uint8_t *p = (uint8_t *)utf8_str;
|
const uint8_t *p = (uint8_t *)utf8_str;
|
||||||
dwin_string.set();
|
dwin_string.set();
|
||||||
while (dwin_string.length < max_length) {
|
while (dwin_string.length < max_length) {
|
||||||
wchar_t ch = 0;
|
lchar_t wc;
|
||||||
p = get_utf8_value_cb(p, cb_read_byte, &ch);
|
p = get_utf8_value_cb(p, cb_read_byte, wc);
|
||||||
if (!ch) break;
|
if (!wc) break;
|
||||||
dwin_string.add(ch);
|
dwin_string.add(wc);
|
||||||
}
|
}
|
||||||
DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, dwin_string.string());
|
DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, dwin_string.string());
|
||||||
lcd_advance_cursor(dwin_string.length);
|
lcd_advance_cursor(dwin_string.length);
|
||||||
|
|
|
@ -213,7 +213,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
||||||
lcd_put_u8str(status_message);
|
lcd_put_u8str(status_message);
|
||||||
|
|
||||||
// Fill the rest with spaces
|
// Fill the rest with spaces
|
||||||
while (slen < max_status_chars) { lcd_put_wchar(' '); ++slen; }
|
while (slen < max_status_chars) { lcd_put_lchar(' '); ++slen; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -227,10 +227,10 @@ void MarlinUI::draw_status_message(const bool blink) {
|
||||||
|
|
||||||
// If the string doesn't completely fill the line...
|
// If the string doesn't completely fill the line...
|
||||||
if (rlen < max_status_chars) {
|
if (rlen < max_status_chars) {
|
||||||
lcd_put_wchar('.'); // Always at 1+ spaces left, draw a dot
|
lcd_put_lchar('.'); // Always at 1+ spaces left, draw a dot
|
||||||
uint8_t chars = max_status_chars - rlen; // Amount of space left in characters
|
uint8_t chars = max_status_chars - rlen; // Amount of space left in characters
|
||||||
if (--chars) { // Draw a second dot if there's space
|
if (--chars) { // Draw a second dot if there's space
|
||||||
lcd_put_wchar('.');
|
lcd_put_lchar('.');
|
||||||
if (--chars)
|
if (--chars)
|
||||||
lcd_put_u8str_max(status_message, chars); // Print a second copy of the message
|
lcd_put_u8str_max(status_message, chars); // Print a second copy of the message
|
||||||
}
|
}
|
||||||
|
@ -254,7 +254,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
||||||
lcd_put_u8str_max(status_message, max_status_chars);
|
lcd_put_u8str_max(status_message, max_status_chars);
|
||||||
|
|
||||||
// Fill the rest with spaces if there are missing spaces
|
// Fill the rest with spaces if there are missing spaces
|
||||||
while (slen < max_status_chars) { lcd_put_wchar(' '); ++slen; }
|
while (slen < max_status_chars) { lcd_put_lchar(' '); ++slen; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,8 +31,6 @@
|
||||||
|
|
||||||
#include "../inc/MarlinConfig.h"
|
#include "../inc/MarlinConfig.h"
|
||||||
|
|
||||||
#define MAX_UTF8_CHAR_SIZE 4
|
|
||||||
|
|
||||||
#if HAS_WIRED_LCD
|
#if HAS_WIRED_LCD
|
||||||
#include "marlinui.h"
|
#include "marlinui.h"
|
||||||
#include "../MarlinCore.h"
|
#include "../MarlinCore.h"
|
||||||
|
@ -99,7 +97,7 @@ static inline bool utf8_is_start_byte_of_char(const uint8_t b) {
|
||||||
|
|
||||||
/* This function gets the character at the pstart position, interpreting UTF8 multibyte sequences
|
/* This function gets the character at the pstart position, interpreting UTF8 multibyte sequences
|
||||||
and returns the pointer to the next character */
|
and returns the pointer to the next character */
|
||||||
const uint8_t* get_utf8_value_cb(const uint8_t *pstart, read_byte_cb_t cb_read_byte, wchar_t *pval) {
|
const uint8_t* get_utf8_value_cb(const uint8_t *pstart, read_byte_cb_t cb_read_byte, lchar_t &pval) {
|
||||||
uint32_t val = 0;
|
uint32_t val = 0;
|
||||||
const uint8_t *p = pstart;
|
const uint8_t *p = pstart;
|
||||||
|
|
||||||
|
@ -158,7 +156,7 @@ const uint8_t* get_utf8_value_cb(const uint8_t *pstart, read_byte_cb_t cb_read_b
|
||||||
else
|
else
|
||||||
for (; 0xFC < (0xFE & valcur); ) { p++; valcur = cb_read_byte(p); }
|
for (; 0xFC < (0xFE & valcur); ) { p++; valcur = cb_read_byte(p); }
|
||||||
|
|
||||||
if (pval) *pval = val;
|
pval = val;
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,36 +31,41 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stddef.h> // wchar_t
|
|
||||||
#include <stdint.h> // uint32_t
|
#include <stdint.h> // uint32_t
|
||||||
|
|
||||||
#include "../HAL/shared/Marduino.h"
|
#include "../HAL/shared/Marduino.h"
|
||||||
#include "../core/macros.h"
|
#include "../core/macros.h"
|
||||||
|
|
||||||
|
#define MAX_UTF8_CHAR_SIZE 4
|
||||||
|
|
||||||
|
// Use a longer character type (if needed) because wchar_t is only 16 bits wide
|
||||||
|
#ifdef MAX_UTF8_CHAR_SIZE
|
||||||
|
#if MAX_UTF8_CHAR_SIZE > 2
|
||||||
|
typedef uint32_t lchar_t;
|
||||||
|
#else
|
||||||
|
typedef wchar_t lchar_t;
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define wchar_t uint32_t
|
||||||
|
#endif
|
||||||
|
|
||||||
// read a byte from ROM or RAM
|
// read a byte from ROM or RAM
|
||||||
typedef uint8_t (*read_byte_cb_t)(const uint8_t * str);
|
typedef uint8_t (*read_byte_cb_t)(const uint8_t * str);
|
||||||
|
|
||||||
uint8_t read_byte_ram(const uint8_t *str);
|
uint8_t read_byte_ram(const uint8_t *str);
|
||||||
uint8_t read_byte_rom(const uint8_t *str);
|
uint8_t read_byte_rom(const uint8_t *str);
|
||||||
|
|
||||||
// there's overflow of the wchar_t due to the 2-byte size in Arduino
|
|
||||||
// sizeof(wchar_t)=2; sizeof(size_t)=2; sizeof(uint32_t)=4;
|
|
||||||
// sizeof(int)=2; sizeof(long)=4; sizeof(unsigned)=2;
|
|
||||||
//#undef wchar_t
|
|
||||||
#define wchar_t uint32_t
|
|
||||||
//typedef uint32_t wchar_t;
|
|
||||||
|
|
||||||
typedef uint16_t pixel_len_t;
|
typedef uint16_t pixel_len_t;
|
||||||
#define PIXEL_LEN_NOLIMIT ((pixel_len_t)(-1))
|
#define PIXEL_LEN_NOLIMIT ((pixel_len_t)(-1))
|
||||||
|
|
||||||
/* Perform binary search */
|
/* Perform binary search */
|
||||||
typedef int (* pf_bsearch_cb_comp_t)(void *userdata, size_t idx, void * data_pin); /*"data_list[idx] - *data_pin"*/
|
typedef int (* pf_bsearch_cb_comp_t)(void *userdata, size_t idx, void * data_pin);
|
||||||
int pf_bsearch_r(void *userdata, size_t num_data, pf_bsearch_cb_comp_t cb_comp, void *data_pinpoint, size_t *ret_idx);
|
int pf_bsearch_r(void *userdata, size_t num_data, pf_bsearch_cb_comp_t cb_comp, void *data_pinpoint, size_t *ret_idx);
|
||||||
|
|
||||||
/* Get the character, decoding multibyte UTF8 characters and returning a pointer to the start of the next UTF8 character */
|
/* Get the character, decoding multibyte UTF8 characters and returning a pointer to the start of the next UTF8 character */
|
||||||
const uint8_t* get_utf8_value_cb(const uint8_t *pstart, read_byte_cb_t cb_read_byte, wchar_t *pval);
|
const uint8_t* get_utf8_value_cb(const uint8_t *pstart, read_byte_cb_t cb_read_byte, lchar_t &pval);
|
||||||
|
|
||||||
inline const char* get_utf8_value_cb(const char *pstart, read_byte_cb_t cb_read_byte, wchar_t *pval) {
|
inline const char* get_utf8_value_cb(const char *pstart, read_byte_cb_t cb_read_byte, lchar_t &pval) {
|
||||||
return (const char *)get_utf8_value_cb((const uint8_t *)pstart, cb_read_byte, pval);
|
return (const char *)get_utf8_value_cb((const uint8_t *)pstart, cb_read_byte, pval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,19 +47,19 @@ lcd_uint_t lcd_put_u8str_P(PGM_P const ptpl, const int8_t ind, const char *cstr/
|
||||||
const uint8_t *p = (uint8_t*)ptpl;
|
const uint8_t *p = (uint8_t*)ptpl;
|
||||||
int8_t n = maxlen;
|
int8_t n = maxlen;
|
||||||
while (n > 0) {
|
while (n > 0) {
|
||||||
wchar_t ch;
|
lchar_t wc;
|
||||||
p = get_utf8_value_cb(p, read_byte_rom, &ch);
|
p = get_utf8_value_cb(p, read_byte_rom, wc);
|
||||||
if (!ch) break;
|
if (!wc) break;
|
||||||
if (ch == '=' || ch == '~' || ch == '*') {
|
if (wc == '=' || wc == '~' || wc == '*') {
|
||||||
if (ind >= 0) {
|
if (ind >= 0) {
|
||||||
if (ch == '*') { lcd_put_wchar('E'); n--; }
|
if (wc == '*') { lcd_put_lchar('E'); n--; }
|
||||||
if (n) {
|
if (n) {
|
||||||
int8_t inum = ind + ((ch == '=') ? 0 : LCD_FIRST_TOOL);
|
int8_t inum = ind + ((wc == '=') ? 0 : LCD_FIRST_TOOL);
|
||||||
if (inum >= 10) {
|
if (inum >= 10) {
|
||||||
lcd_put_wchar('0' + (inum / 10)); n--;
|
lcd_put_lchar('0' + (inum / 10)); n--;
|
||||||
inum %= 10;
|
inum %= 10;
|
||||||
}
|
}
|
||||||
if (n) { lcd_put_wchar('0' + inum); n--; }
|
if (n) { lcd_put_lchar('0' + inum); n--; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -71,19 +71,19 @@ lcd_uint_t lcd_put_u8str_P(PGM_P const ptpl, const int8_t ind, const char *cstr/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ch == '$' && fstr) {
|
else if (wc == '$' && fstr) {
|
||||||
n -= lcd_put_u8str_max_P(FTOP(fstr), n * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH);
|
n -= lcd_put_u8str_max_P(FTOP(fstr), n * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH);
|
||||||
}
|
}
|
||||||
else if (ch == '$' && cstr) {
|
else if (wc == '$' && cstr) {
|
||||||
n -= lcd_put_u8str_max(cstr, n * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH);
|
n -= lcd_put_u8str_max(cstr, n * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH);
|
||||||
}
|
}
|
||||||
else if (ch == '@') {
|
else if (wc == '@') {
|
||||||
lcd_put_wchar(axis_codes[ind]);
|
lcd_put_lchar(axis_codes[ind]);
|
||||||
n--;
|
n--;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lcd_put_wchar(ch);
|
lcd_put_lchar(wc);
|
||||||
n -= ch > 255 ? prop : 1;
|
n -= wc > 255 ? prop : 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
|
@ -97,10 +97,10 @@ int calculateWidth(PGM_P const pstr) {
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
wchar_t ch;
|
lchar_t wc;
|
||||||
p = get_utf8_value_cb(p, read_byte_rom, &ch);
|
p = get_utf8_value_cb(p, read_byte_rom, wc);
|
||||||
if (!ch) break;
|
if (!wc) break;
|
||||||
n += (ch > 255) ? prop : 1;
|
n += (wc > 255) ? prop : 1;
|
||||||
} while (1);
|
} while (1);
|
||||||
|
|
||||||
return n * MENU_FONT_WIDTH;
|
return n * MENU_FONT_WIDTH;
|
||||||
|
|
|
@ -138,7 +138,7 @@ int lcd_glyph_height();
|
||||||
*
|
*
|
||||||
* @return the output width (in pixels on GLCD)
|
* @return the output width (in pixels on GLCD)
|
||||||
*/
|
*/
|
||||||
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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Draw a SRAM UTF-8 string
|
* @brief Draw a SRAM UTF-8 string
|
||||||
|
@ -267,17 +267,17 @@ inline int lcd_put_u8str(const lcd_uint_t col, const lcd_uint_t row, const char
|
||||||
/**
|
/**
|
||||||
* @brief Draw a UTF-8 character with no width limit
|
* @brief Draw a UTF-8 character with no width limit
|
||||||
*
|
*
|
||||||
* @param c The wchar to draw
|
* @param c The lchar to draw
|
||||||
* @return the output width (in pixels on GLCD)
|
* @return the output width (in pixels on GLCD)
|
||||||
*/
|
*/
|
||||||
inline int lcd_put_wchar(const wchar_t c) { return lcd_put_wchar_max(c, PIXEL_LEN_NOLIMIT); }
|
inline int lcd_put_lchar(const lchar_t &c) { return lcd_put_lchar_max(c, PIXEL_LEN_NOLIMIT); }
|
||||||
/**
|
/**
|
||||||
* @param col
|
* @param col
|
||||||
* @param row
|
* @param row
|
||||||
*/
|
*/
|
||||||
inline int lcd_put_wchar(const lcd_uint_t col, const lcd_uint_t row, const wchar_t c) {
|
inline int lcd_put_lchar(const lcd_uint_t col, const lcd_uint_t row, const lchar_t &c) {
|
||||||
lcd_moveto(col, row);
|
lcd_moveto(col, row);
|
||||||
return lcd_put_wchar(c);
|
return lcd_put_lchar(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -417,26 +417,26 @@ void MarlinUI::init() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t *p = (uint8_t*)string;
|
const uint8_t *p = (uint8_t*)string;
|
||||||
wchar_t ch;
|
lchar_t wc;
|
||||||
if (wordwrap) {
|
if (wordwrap) {
|
||||||
const uint8_t *wrd = nullptr;
|
const uint8_t *wrd = nullptr;
|
||||||
uint8_t c = 0;
|
uint8_t c = 0;
|
||||||
// find the end of the part
|
// find the end of the part
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (!wrd) wrd = p; // Get word start /before/ advancing
|
if (!wrd) wrd = p; // Get word start /before/ advancing
|
||||||
p = get_utf8_value_cb(p, cb_read_byte, &ch);
|
p = get_utf8_value_cb(p, cb_read_byte, wc);
|
||||||
const bool eol = !ch; // zero ends the string
|
const bool eol = !wc; // zero ends the string
|
||||||
// End or a break between phrases?
|
// End or a break between phrases?
|
||||||
if (eol || ch == ' ' || ch == '-' || ch == '+' || ch == '.') {
|
if (eol || wc == ' ' || wc == '-' || wc == '+' || wc == '.') {
|
||||||
if (!c && ch == ' ') { if (wrd) wrd++; continue; } // collapse extra spaces
|
if (!c && wc == ' ') { if (wrd) wrd++; continue; } // collapse extra spaces
|
||||||
// Past the right and the word is not too long?
|
// Past the right and the word is not too long?
|
||||||
if (col + c > LCD_WIDTH && col >= (LCD_WIDTH) / 4) _newline(); // should it wrap?
|
if (col + c > LCD_WIDTH && col >= (LCD_WIDTH) / 4) _newline(); // should it wrap?
|
||||||
c += !eol; // +1 so the space will be printed
|
c += !eol; // +1 so the space will be printed
|
||||||
col += c; // advance col to new position
|
col += c; // advance col to new position
|
||||||
while (c) { // character countdown
|
while (c) { // character countdown
|
||||||
--c; // count down to zero
|
--c; // count down to zero
|
||||||
wrd = get_utf8_value_cb(wrd, cb_read_byte, &ch); // get characters again
|
wrd = get_utf8_value_cb(wrd, cb_read_byte, wc); // get characters again
|
||||||
lcd_put_wchar(ch); // character to the LCD
|
lcd_put_lchar(wc); // character to the LCD
|
||||||
}
|
}
|
||||||
if (eol) break; // all done!
|
if (eol) break; // all done!
|
||||||
wrd = nullptr; // set up for next word
|
wrd = nullptr; // set up for next word
|
||||||
|
@ -446,9 +446,9 @@ void MarlinUI::init() {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
p = get_utf8_value_cb(p, cb_read_byte, &ch);
|
p = get_utf8_value_cb(p, cb_read_byte, wc);
|
||||||
if (!ch) break;
|
if (!wc) break;
|
||||||
lcd_put_wchar(ch);
|
lcd_put_lchar(wc);
|
||||||
col++;
|
col++;
|
||||||
if (col >= LCD_WIDTH) _newline();
|
if (col >= LCD_WIDTH) _newline();
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,7 +178,7 @@ static void _lcd_level_bed_corners_get_next_position() {
|
||||||
lcd_put_u8str(GET_TEXT_F(MSG_BED_TRAMMING_GOOD_POINTS));
|
lcd_put_u8str(GET_TEXT_F(MSG_BED_TRAMMING_GOOD_POINTS));
|
||||||
IF_ENABLED(TFT_COLOR_UI, lcd_moveto(12, cy));
|
IF_ENABLED(TFT_COLOR_UI, lcd_moveto(12, cy));
|
||||||
lcd_put_u8str(GOOD_POINTS_TO_STR(good_points));
|
lcd_put_u8str(GOOD_POINTS_TO_STR(good_points));
|
||||||
lcd_put_wchar('/');
|
lcd_put_lchar('/');
|
||||||
lcd_put_u8str(GOOD_POINTS_TO_STR(nr_edge_points));
|
lcd_put_u8str(GOOD_POINTS_TO_STR(nr_edge_points));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ void menu_advanced_settings();
|
||||||
LIMIT(bar_percent, 0, 100);
|
LIMIT(bar_percent, 0, 100);
|
||||||
ui.encoderPosition = 0;
|
ui.encoderPosition = 0;
|
||||||
MenuItem_static::draw(0, GET_TEXT_F(MSG_PROGRESS_BAR_TEST), SS_DEFAULT|SS_INVERT);
|
MenuItem_static::draw(0, GET_TEXT_F(MSG_PROGRESS_BAR_TEST), SS_DEFAULT|SS_INVERT);
|
||||||
lcd_put_int((LCD_WIDTH) / 2 - 2, LCD_HEIGHT - 2, bar_percent); lcd_put_wchar('%');
|
lcd_put_int((LCD_WIDTH) / 2 - 2, LCD_HEIGHT - 2, bar_percent); lcd_put_lchar('%');
|
||||||
lcd_moveto(0, LCD_HEIGHT - 1); ui.draw_progress_bar(bar_percent);
|
lcd_moveto(0, LCD_HEIGHT - 1); ui.draw_progress_bar(bar_percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,10 +61,10 @@ void Password::menu_password_entry() {
|
||||||
FSTR_P const label = GET_TEXT_F(MSG_ENTER_DIGIT);
|
FSTR_P const label = GET_TEXT_F(MSG_ENTER_DIGIT);
|
||||||
EDIT_ITEM_F(uint8, label, &editable.uint8, 0, 9, digit_entered);
|
EDIT_ITEM_F(uint8, label, &editable.uint8, 0, 9, digit_entered);
|
||||||
MENU_ITEM_ADDON_START(utf8_strlen(label) + 1);
|
MENU_ITEM_ADDON_START(utf8_strlen(label) + 1);
|
||||||
lcd_put_wchar(' ');
|
lcd_put_lchar(' ');
|
||||||
lcd_put_wchar('1' + digit_no);
|
lcd_put_lchar('1' + digit_no);
|
||||||
SETCURSOR_X(LCD_WIDTH - 2);
|
SETCURSOR_X(LCD_WIDTH - 2);
|
||||||
lcd_put_wchar('>');
|
lcd_put_lchar('>');
|
||||||
MENU_ITEM_ADDON_END();
|
MENU_ITEM_ADDON_END();
|
||||||
|
|
||||||
ACTION_ITEM(MSG_START_OVER, start_over);
|
ACTION_ITEM(MSG_START_OVER, start_over);
|
||||||
|
|
|
@ -76,12 +76,12 @@
|
||||||
#if ENABLED(TFT_COLOR_UI)
|
#if ENABLED(TFT_COLOR_UI)
|
||||||
lcd_moveto(4, 3);
|
lcd_moveto(4, 3);
|
||||||
lcd_put_u8str(GET_TEXT_F(MSG_BABYSTEP_TOTAL));
|
lcd_put_u8str(GET_TEXT_F(MSG_BABYSTEP_TOTAL));
|
||||||
lcd_put_wchar(':');
|
lcd_put_lchar(':');
|
||||||
lcd_moveto(10, 3);
|
lcd_moveto(10, 3);
|
||||||
#else
|
#else
|
||||||
lcd_moveto(0, TERN(HAS_MARLINUI_U8GLIB, LCD_PIXEL_HEIGHT - MENU_FONT_DESCENT, LCD_HEIGHT - 1));
|
lcd_moveto(0, TERN(HAS_MARLINUI_U8GLIB, LCD_PIXEL_HEIGHT - MENU_FONT_DESCENT, LCD_HEIGHT - 1));
|
||||||
lcd_put_u8str(GET_TEXT_F(MSG_BABYSTEP_TOTAL));
|
lcd_put_u8str(GET_TEXT_F(MSG_BABYSTEP_TOTAL));
|
||||||
lcd_put_wchar(':');
|
lcd_put_lchar(':');
|
||||||
#endif
|
#endif
|
||||||
lcd_put_u8str(BABYSTEP_TO_STR(mps * babystep.axis_total[BS_TOTAL_IND(axis)]));
|
lcd_put_u8str(BABYSTEP_TO_STR(mps * babystep.axis_total[BS_TOTAL_IND(axis)]));
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,12 +94,12 @@ void TFT_String::set() {
|
||||||
* @ displays an axis name such as XYZUVW, or E for an extruder
|
* @ 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*/) {
|
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) {
|
while (*tpl) {
|
||||||
tpl = get_utf8_value_cb(tpl, read_byte_ram, &wchar);
|
tpl = get_utf8_value_cb(tpl, read_byte_ram, wc);
|
||||||
if (wchar > 255) wchar |= 0x0080;
|
if (wc > 255) wc |= 0x0080;
|
||||||
const uint8_t ch = uint8_t(wchar & 0x00FF);
|
const uint8_t ch = uint8_t(wc & 0x00FF);
|
||||||
|
|
||||||
if (ch == '=' || ch == '~' || ch == '*') {
|
if (ch == '=' || ch == '~' || ch == '*') {
|
||||||
if (index >= 0) {
|
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*/) {
|
void TFT_String::add(const char *cstr, uint8_t max_len/*=MAX_STRING_LENGTH*/) {
|
||||||
wchar_t wchar;
|
lchar_t wc;
|
||||||
while (*cstr && max_len) {
|
while (*cstr && max_len) {
|
||||||
cstr = get_utf8_value_cb(cstr, read_byte_ram, &wchar);
|
cstr = get_utf8_value_cb(cstr, read_byte_ram, wc);
|
||||||
if (wchar > 255) wchar |= 0x0080;
|
if (wc > 255) wc |= 0x0080;
|
||||||
const uint8_t ch = uint8_t(wchar & 0x00FF);
|
const uint8_t ch = uint8_t(wc & 0x00FF);
|
||||||
add_character(ch);
|
add_character(ch);
|
||||||
max_len--;
|
max_len--;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "../fontutils.h"
|
||||||
|
|
||||||
extern const uint8_t ISO10646_1_5x7[];
|
extern const uint8_t ISO10646_1_5x7[];
|
||||||
extern const uint8_t font10x20[];
|
extern const uint8_t font10x20[];
|
||||||
|
|
||||||
|
@ -97,7 +99,7 @@ class TFT_String {
|
||||||
* @param character The ASCII character
|
* @param character The ASCII character
|
||||||
*/
|
*/
|
||||||
static void add(const char character) { add_character(character); eol(); }
|
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
|
* @brief Append / Set C-string
|
||||||
|
|
|
@ -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);
|
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;
|
if (max_length < 1) return 0;
|
||||||
tft_string.set(c);
|
tft_string.set(c);
|
||||||
tft.add_text(MENU_TEXT_X_OFFSET, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
|
tft.add_text(MENU_TEXT_X_OFFSET, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
|
||||||
|
|
Loading…
Reference in a new issue