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

This commit is contained in:
Scott Lahteine
2022-05-22 19:56:46 -05:00
committed by GitHub
parent e88fabafc8
commit a5e1d4c50a
44 changed files with 631 additions and 618 deletions

View File

@@ -69,11 +69,11 @@ menuPosition screen_history[6];
uint8_t screen_history_depth = 0;
int8_t MenuItemBase::itemIndex; // Index number for draw and action
PGM_P MenuItemBase::itemString; // A PSTR for substitution
FSTR_P MenuItemBase::itemString; // A string for substitution
chimera_t editable; // Value Editing
// Menu Edit Items
PGM_P MenuEditItemBase::editLabel;
FSTR_P MenuEditItemBase::editLabel;
void* MenuEditItemBase::editValue;
int32_t MenuEditItemBase::minEditValue,
MenuEditItemBase::maxEditValue;
@@ -134,7 +134,7 @@ void MenuEditItemBase::edit_screen(strfunc_t strfunc, loadfunc_t loadfunc) {
// Going to an edit screen sets up some persistent values first
void MenuEditItemBase::goto_edit_screen(
PGM_P const el, // Edit label
FSTR_P const el, // Edit label
void * const ev, // Edit value pointer
const int32_t minv, // Encoder minimum
const int32_t maxv, // Encoder maximum
@@ -232,8 +232,8 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, co
// Display a "synchronize" screen with a custom message until
// all moves are finished. Go back to calling screen when done.
//
void MarlinUI::synchronize(PGM_P const msg/*=nullptr*/) {
static PGM_P sync_message = msg ?: GET_TEXT(MSG_MOVING);
void MarlinUI::synchronize(FSTR_P const fmsg/*=nullptr*/) {
static FSTR_P sync_message = fmsg ?: GET_TEXT_F(MSG_MOVING);
push_current_screen();
goto_screen([]{
if (should_draw()) MenuItem_static::draw(LCD_HEIGHT >= 4, sync_message);
@@ -319,12 +319,12 @@ void scroll_screen(const uint8_t limit, const bool is_menu) {
}
if (ui.should_draw()) {
if (do_probe) {
MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_ZPROBE_ZOFFSET), BABYSTEP_TO_STR(probe.offset.z));
MenuEditItemBase::draw_edit_screen(GET_TEXT_F(MSG_ZPROBE_ZOFFSET), BABYSTEP_TO_STR(probe.offset.z));
TERN_(BABYSTEP_ZPROBE_GFX_OVERLAY, ui.zoffset_overlay(probe.offset.z));
}
else {
#if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_HOTEND_OFFSET_Z), ftostr54sign(hotend_offset[active_extruder].z));
MenuEditItemBase::draw_edit_screen(GET_TEXT_F(MSG_HOTEND_OFFSET_Z), ftostr54sign(hotend_offset[active_extruder].z));
#endif
}
}
@@ -335,7 +335,7 @@ void scroll_screen(const uint8_t limit, const bool is_menu) {
void _lcd_draw_homing() {
if (ui.should_draw()) {
constexpr uint8_t line = (LCD_HEIGHT - 1) / 2;
MenuItem_static::draw(line, GET_TEXT(MSG_LEVEL_BED_HOMING));
MenuItem_static::draw(line, GET_TEXT_F(MSG_LEVEL_BED_HOMING));
}
}
@@ -357,9 +357,9 @@ bool MarlinUI::update_selection() {
}
void MenuItem_confirm::select_screen(
PGM_P const yes, PGM_P const no,
FSTR_P const yes, FSTR_P const no,
selectFunc_t yesFunc, selectFunc_t noFunc,
PGM_P const pref, const char * const string/*=nullptr*/, PGM_P const suff/*=nullptr*/
FSTR_P const pref, const char * const string/*=nullptr*/, FSTR_P const suff/*=nullptr*/
) {
ui.defer_status_screen();
const bool ui_selection = !yes ? false : !no || ui.update_selection(),