♻️ Apply F() to more LCD code (#24228)

This commit is contained in:
Scott Lahteine
2022-05-22 19:56:46 -05:00
committed by Scott Lahteine
parent 9a74bcd4cf
commit 28f8646aa6
44 changed files with 622 additions and 609 deletions

View File

@ -347,14 +347,14 @@ void MarlinUI::draw_status_screen() {
}
// Low-level draw_edit_screen can be used to draw an edit screen from anyplace
void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char * const value/*=nullptr*/) {
void MenuEditItemBase::draw_edit_screen(FSTR_P const fstr, const char * const value/*=nullptr*/) {
ui.encoder_direction_normal();
TERN_(TOUCH_SCREEN, touch.clear());
uint16_t line = 1;
menu_line(line++);
tft_string.set(pstr, itemIndex, itemString);
tft_string.set(FTOP(fstr), itemIndex, FTOP(itemString));
tft_string.trim();
tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
@ -416,7 +416,7 @@ void TFT::draw_edit_screen_buttons() {
}
// The Select Screen presents a prompt and two "buttons"
void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string/*=nullptr*/, PGM_P const suff/*=nullptr*/) {
void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, const bool yesno, FSTR_P const pref, const char * const string/*=nullptr*/, FSTR_P const suff/*=nullptr*/) {
uint16_t line = 1;
if (!string) line++;
@ -621,7 +621,7 @@ static void drawCurESelection() {
tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection));
}
static void drawMessage(const char *msg) {
static void drawMessage(PGM_P const msg) {
tft.canvas(X_MARGIN, TFT_HEIGHT - Y_MARGIN - 29, (TFT_WIDTH / 2) - (BTN_WIDTH / 2) - X_MARGIN, 20);
tft.set_background(COLOR_BACKGROUND);
tft.add_text(0, 0, COLOR_YELLOW, msg);
@ -652,7 +652,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) {
#if ENABLED(PREVENT_COLD_EXTRUSION)
if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) {
drawMessage("Too cold");
drawMessage(PSTR("Too cold"));
return;
}
#endif
@ -675,7 +675,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) {
probe.offset.z = new_offs;
else
TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP);
drawMessage(""); // clear the error
drawMessage(NUL_STR); // clear the error
drawAxisValue(axis);
}
else {
@ -693,7 +693,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) {
drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS));
}
else {
drawMessage(""); // clear the error
drawMessage(NUL_STR); // clear the error
}
drawAxisValue(axis);
#endif