♻️ Apply F() to more LCD code (#24228)
This commit is contained in:
@@ -140,12 +140,12 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
|
||||
|
||||
preheat_t MarlinUI::material_preset[PREHEAT_COUNT]; // Initialized by settings.load()
|
||||
|
||||
PGM_P MarlinUI::get_preheat_label(const uint8_t m) {
|
||||
FSTR_P MarlinUI::get_preheat_label(const uint8_t m) {
|
||||
#define _PDEF(N) static PGMSTR(preheat_##N##_label, PREHEAT_##N##_LABEL);
|
||||
#define _PLBL(N) preheat_##N##_label,
|
||||
REPEAT_1(PREHEAT_COUNT, _PDEF);
|
||||
static PGM_P const preheat_labels[PREHEAT_COUNT] PROGMEM = { REPEAT_1(PREHEAT_COUNT, _PLBL) };
|
||||
return (PGM_P)pgm_read_ptr(&preheat_labels[m]);
|
||||
return FPSTR((PGM_P)pgm_read_ptr(&preheat_labels[m]));
|
||||
}
|
||||
|
||||
void MarlinUI::apply_preheat(const uint8_t m, const uint8_t pmask, const uint8_t e/*=active_extruder*/) {
|
||||
@@ -454,20 +454,20 @@ void MarlinUI::init() {
|
||||
}
|
||||
}
|
||||
|
||||
void MarlinUI::draw_select_screen_prompt(PGM_P const pref, const char * const string/*=nullptr*/, PGM_P const suff/*=nullptr*/) {
|
||||
const uint8_t plen = utf8_strlen_P(pref), slen = suff ? utf8_strlen_P(suff) : 0;
|
||||
void MarlinUI::draw_select_screen_prompt(FSTR_P const pref, const char * const string/*=nullptr*/, FSTR_P const suff/*=nullptr*/) {
|
||||
const uint8_t plen = utf8_strlen(pref), slen = suff ? utf8_strlen(suff) : 0;
|
||||
uint8_t col = 0, row = 0;
|
||||
if (!string && plen + slen <= LCD_WIDTH) {
|
||||
col = (LCD_WIDTH - plen - slen) / 2;
|
||||
row = LCD_HEIGHT > 3 ? 1 : 0;
|
||||
}
|
||||
if (LCD_HEIGHT >= 8) row = LCD_HEIGHT / 2 - 2;
|
||||
wrap_string_P(col, row, pref, true);
|
||||
wrap_string_P(col, row, FTOP(pref), true);
|
||||
if (string) {
|
||||
if (col) { col = 0; row++; } // Move to the start of the next line
|
||||
wrap_string(col, row, string);
|
||||
}
|
||||
if (suff) wrap_string_P(col, row, suff);
|
||||
if (suff) wrap_string_P(col, row, FTOP(suff));
|
||||
}
|
||||
|
||||
#endif // !HAS_GRAPHICAL_TFT
|
||||
@@ -484,17 +484,17 @@ void MarlinUI::init() {
|
||||
|
||||
#if HAS_MARLINUI_MENU && !HAS_ADC_BUTTONS
|
||||
|
||||
void lcd_move_x();
|
||||
void lcd_move_y();
|
||||
void lcd_move_z();
|
||||
|
||||
void _reprapworld_keypad_move(const AxisEnum axis, const int16_t dir) {
|
||||
ui.manual_move.menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
|
||||
ui.encoderPosition = dir;
|
||||
switch (axis) {
|
||||
case X_AXIS: lcd_move_x(); break;
|
||||
case Y_AXIS: lcd_move_y(); break;
|
||||
case Z_AXIS: lcd_move_z();
|
||||
case X_AXIS: { void lcd_move_x(); lcd_move_x(); } break;
|
||||
#if HAS_Y_AXIS
|
||||
case Y_AXIS: { void lcd_move_y(); lcd_move_y(); } break;
|
||||
#endif
|
||||
#if HAS_Z_AXIS
|
||||
case Z_AXIS: { void lcd_move_z(); lcd_move_z(); } break;
|
||||
#endif
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
@@ -1651,7 +1651,7 @@ void MarlinUI::init() {
|
||||
|
||||
void MarlinUI::pause_print() {
|
||||
#if HAS_MARLINUI_MENU
|
||||
synchronize(GET_TEXT(MSG_PAUSING));
|
||||
synchronize(GET_TEXT_F(MSG_PAUSING));
|
||||
defer_status_screen();
|
||||
#endif
|
||||
|
||||
@@ -1855,12 +1855,12 @@ void MarlinUI::init() {
|
||||
|
||||
#if DISABLED(EEPROM_AUTO_INIT)
|
||||
|
||||
static inline PGM_P eeprom_err(const uint8_t msgid) {
|
||||
static inline FSTR_P eeprom_err(const uint8_t msgid) {
|
||||
switch (msgid) {
|
||||
default:
|
||||
case 0: return GET_TEXT(MSG_ERR_EEPROM_CRC);
|
||||
case 1: return GET_TEXT(MSG_ERR_EEPROM_INDEX);
|
||||
case 2: return GET_TEXT(MSG_ERR_EEPROM_VERSION);
|
||||
case 0: return GET_TEXT_F(MSG_ERR_EEPROM_CRC);
|
||||
case 1: return GET_TEXT_F(MSG_ERR_EEPROM_INDEX);
|
||||
case 2: return GET_TEXT_F(MSG_ERR_EEPROM_VERSION);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1868,17 +1868,17 @@ void MarlinUI::init() {
|
||||
#if HAS_MARLINUI_MENU
|
||||
editable.uint8 = msgid;
|
||||
goto_screen([]{
|
||||
PGM_P const restore_msg = GET_TEXT(MSG_INIT_EEPROM);
|
||||
char msg[utf8_strlen_P(restore_msg) + 1];
|
||||
strcpy_P(msg, restore_msg);
|
||||
FSTR_P const restore_msg = GET_TEXT_F(MSG_INIT_EEPROM);
|
||||
char msg[utf8_strlen(restore_msg) + 1];
|
||||
strcpy_P(msg, FTOP(restore_msg));
|
||||
MenuItem_confirm::select_screen(
|
||||
GET_TEXT(MSG_BUTTON_RESET), GET_TEXT(MSG_BUTTON_IGNORE),
|
||||
GET_TEXT_F(MSG_BUTTON_RESET), GET_TEXT_F(MSG_BUTTON_IGNORE),
|
||||
init_eeprom, return_to_status,
|
||||
eeprom_err(editable.uint8), msg, PSTR("?")
|
||||
eeprom_err(editable.uint8), msg, F("?")
|
||||
);
|
||||
});
|
||||
#else
|
||||
set_status(FPSTR(eeprom_err(msgid)));
|
||||
set_status(eeprom_err(msgid));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user