🎨 Apply F() to UTF-8/MMU2 string put
This commit is contained in:
@ -1063,8 +1063,8 @@ int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) {
|
||||
return lcd_put_u8str_max_cb(utf8_str, read_byte_ram, max_length);
|
||||
}
|
||||
|
||||
int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
|
||||
return lcd_put_u8str_max_cb(utf8_str_P, read_byte_rom, max_length);
|
||||
int lcd_put_u8str_max_P(PGM_P utf8_pstr, pixel_len_t max_length) {
|
||||
return lcd_put_u8str_max_cb(utf8_pstr, read_byte_rom, max_length);
|
||||
}
|
||||
|
||||
#if ENABLED(DEBUG_LCDPRINT)
|
||||
|
@ -409,15 +409,15 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
|
||||
}
|
||||
|
||||
// Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line
|
||||
void lcd_scroll(const lcd_uint_t col, const lcd_uint_t line, PGM_P const text, const uint8_t len, const int16_t time) {
|
||||
uint8_t slen = utf8_strlen_P(text);
|
||||
void lcd_scroll(const lcd_uint_t col, const lcd_uint_t line, FSTR_P const ftxt, const uint8_t len, const int16_t time) {
|
||||
uint8_t slen = utf8_strlen_P(FTOP(ftxt));
|
||||
if (slen < len) {
|
||||
lcd_put_u8str_max_P(col, line, text, len);
|
||||
lcd_put_u8str_max(col, line, ftxt, len);
|
||||
for (; slen < len; ++slen) lcd_put_wchar(' ');
|
||||
safe_delay(time);
|
||||
}
|
||||
else {
|
||||
PGM_P p = text;
|
||||
PGM_P p = FTOP(ftxt);
|
||||
int dly = time / _MAX(slen, 1);
|
||||
LOOP_LE_N(i, slen) {
|
||||
|
||||
@ -439,9 +439,9 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
|
||||
|
||||
static void logo_lines(PGM_P const extra) {
|
||||
int16_t indent = (LCD_WIDTH - 8 - utf8_strlen_P(extra)) / 2;
|
||||
lcd_put_wchar(indent, 0, '\x00'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x01');
|
||||
lcd_put_u8str_P(indent, 1, PSTR("|Marlin|")); lcd_put_u8str_P(extra);
|
||||
lcd_put_wchar(indent, 2, '\x02'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x03');
|
||||
lcd_put_wchar(indent, 0, '\x00'); lcd_put_u8str(F( "------" )); lcd_put_wchar('\x01');
|
||||
lcd_put_u8str(indent, 1, F("|Marlin|")); lcd_put_u8str_P(extra);
|
||||
lcd_put_wchar(indent, 2, '\x02'); lcd_put_u8str(F( "------" )); lcd_put_wchar('\x03');
|
||||
}
|
||||
|
||||
void MarlinUI::show_bootscreen() {
|
||||
@ -450,15 +450,16 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
|
||||
|
||||
#define LCD_EXTRA_SPACE (LCD_WIDTH-8)
|
||||
|
||||
#define CENTER_OR_SCROLL(STRING,DELAY) \
|
||||
#define CENTER_OR_SCROLL(STRING,DELAY) { \
|
||||
lcd_erase_line(3); \
|
||||
if (utf8_strlen(STRING) <= LCD_WIDTH) { \
|
||||
lcd_put_u8str_P((LCD_WIDTH - utf8_strlen_P(PSTR(STRING))) / 2, 3, PSTR(STRING)); \
|
||||
const int len = utf8_strlen(STRING); \
|
||||
if (len <= LCD_WIDTH) { \
|
||||
lcd_put_u8str((LCD_WIDTH - len) / 2, 3, F(STRING)); \
|
||||
safe_delay(DELAY); \
|
||||
} \
|
||||
else { \
|
||||
lcd_scroll(0, 3, PSTR(STRING), LCD_WIDTH, DELAY); \
|
||||
}
|
||||
else \
|
||||
lcd_scroll(0, 3, F(STRING), LCD_WIDTH, DELAY); \
|
||||
}
|
||||
|
||||
//
|
||||
// Show the Marlin logo with splash line 1
|
||||
@ -497,9 +498,9 @@ void MarlinUI::draw_kill_screen() {
|
||||
lcd_put_u8str(0, 0, status_message);
|
||||
lcd_uint_t y = 2;
|
||||
#if LCD_HEIGHT >= 4
|
||||
lcd_put_u8str_P(0, y++, GET_TEXT(MSG_HALTED));
|
||||
lcd_put_u8str(0, y++, GET_TEXT_F(MSG_HALTED));
|
||||
#endif
|
||||
lcd_put_u8str_P(0, y, GET_TEXT(MSG_PLEASE_RESET));
|
||||
lcd_put_u8str(0, y, GET_TEXT_F(MSG_PLEASE_RESET));
|
||||
}
|
||||
|
||||
//
|
||||
@ -514,7 +515,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
|
||||
else if (axis_should_home(axis))
|
||||
while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?');
|
||||
else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
|
||||
lcd_put_u8str_P(axis == Z_AXIS ? PSTR(" ") : PSTR(" "));
|
||||
lcd_put_u8str(axis == Z_AXIS ? F(" ") : F(" "));
|
||||
else
|
||||
lcd_put_u8str(value);
|
||||
}
|
||||
@ -613,11 +614,11 @@ FORCE_INLINE void _draw_bed_status(const bool blink) {
|
||||
|
||||
FORCE_INLINE void _draw_print_progress() {
|
||||
const uint8_t progress = ui.get_progress_percent();
|
||||
lcd_put_u8str_P(PSTR(TERN(SDSUPPORT, "SD", "P:")));
|
||||
lcd_put_u8str(F(TERN(SDSUPPORT, "SD", "P:")));
|
||||
if (progress)
|
||||
lcd_put_u8str(ui8tostr3rj(progress));
|
||||
else
|
||||
lcd_put_u8str_P(PSTR("---"));
|
||||
lcd_put_u8str(F("---"));
|
||||
lcd_put_wchar('%');
|
||||
}
|
||||
|
||||
@ -661,9 +662,9 @@ void MarlinUI::draw_status_message(const bool blink) {
|
||||
|
||||
// Alternate Status message and Filament display
|
||||
if (ELAPSED(millis(), next_filament_display)) {
|
||||
lcd_put_u8str_P(PSTR("Dia "));
|
||||
lcd_put_u8str(F("Dia "));
|
||||
lcd_put_u8str(ftostr12ns(filwidth.measured_mm));
|
||||
lcd_put_u8str_P(PSTR(" V"));
|
||||
lcd_put_u8str(F(" V"));
|
||||
lcd_put_u8str(i16tostr3rj(planner.volumetric_percent(parser.volumetric_enabled)));
|
||||
lcd_put_wchar('%');
|
||||
return;
|
||||
@ -1473,7 +1474,7 @@ void MarlinUI::draw_status_screen() {
|
||||
if (!isnan(ubl.z_values[x_plot][y_plot]))
|
||||
lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot]));
|
||||
else
|
||||
lcd_put_u8str_P(PSTR(" -----"));
|
||||
lcd_put_u8str(F(" -----"));
|
||||
|
||||
#else // 16x4 or 20x4 display
|
||||
|
||||
@ -1492,7 +1493,7 @@ void MarlinUI::draw_status_screen() {
|
||||
if (!isnan(ubl.z_values[x_plot][y_plot]))
|
||||
lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot]));
|
||||
else
|
||||
lcd_put_u8str_P(PSTR(" -----"));
|
||||
lcd_put_u8str(F(" -----"));
|
||||
|
||||
#endif // LCD_HEIGHT > 3
|
||||
}
|
||||
|
Reference in New Issue
Block a user