mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-26 13:25:54 +00:00
🧑💻 Refactor PROGMEM strings (#27390)
This commit is contained in:
parent
5c728d1fb1
commit
f234fbf87f
@ -72,13 +72,9 @@ void BLTouch::init(const bool set_voltage/*=false*/) {
|
||||
#else
|
||||
|
||||
#ifdef DEBUG_OUT
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
PGMSTR(mode0, "OD");
|
||||
PGMSTR(mode1, "5V");
|
||||
DEBUG_ECHOPGM("BLTouch Mode: ");
|
||||
DEBUG_ECHOPGM_P(bltouch.od_5v_mode ? mode1 : mode0);
|
||||
DEBUG_ECHOLNPGM(" (Default " TERN(BLTOUCH_SET_5V_MODE, "5V", "OD") ")");
|
||||
}
|
||||
if (DEBUGGING(LEVELING))
|
||||
DEBUG_ECHOLN( F("BLTouch Mode: "), bltouch.od_5v_mode ? F("5V") : F("OD"),
|
||||
F(" (Default " TERN(BLTOUCH_SET_5V_MODE, "5V", "OD") ")"));
|
||||
#endif
|
||||
|
||||
const bool should_set = od_5v_mode != ENABLED(BLTOUCH_SET_5V_MODE);
|
||||
|
@ -34,7 +34,7 @@
|
||||
static lv_obj_t *scr;
|
||||
|
||||
void lv_draw_error_message(FSTR_P const fmsg) {
|
||||
FSTR_P fhalted = F("PRINTER HALTED"), fplease = F("Please Reset");
|
||||
FSTR_P const fhalted = F("PRINTER HALTED"), fplease = F("Please Reset");
|
||||
SPI_TFT.lcdClear(0x0000);
|
||||
if (fmsg) disp_string((TFT_WIDTH - strlen_P(FTOP(fmsg)) * 16) / 2, 100, fmsg, 0xFFFF, 0x0000);
|
||||
disp_string((TFT_WIDTH - strlen_P(FTOP(fhalted)) * 16) / 2, 140, fhalted, 0xFFFF, 0x0000);
|
||||
|
@ -1466,16 +1466,6 @@ void MarlinUI::host_notify(const char * const cstr) {
|
||||
* Reset the status message
|
||||
*/
|
||||
void MarlinUI::reset_status(const bool no_welcome) {
|
||||
#if SERVICE_INTERVAL_1 > 0
|
||||
static PGMSTR(service1, "> " SERVICE_NAME_1 "!");
|
||||
#endif
|
||||
#if SERVICE_INTERVAL_2 > 0
|
||||
static PGMSTR(service2, "> " SERVICE_NAME_2 "!");
|
||||
#endif
|
||||
#if SERVICE_INTERVAL_3 > 0
|
||||
static PGMSTR(service3, "> " SERVICE_NAME_3 "!");
|
||||
#endif
|
||||
|
||||
FSTR_P msg;
|
||||
if (printingIsPaused())
|
||||
msg = GET_TEXT_F(MSG_PRINT_PAUSED);
|
||||
@ -1487,13 +1477,13 @@ void MarlinUI::host_notify(const char * const cstr) {
|
||||
msg = GET_TEXT_F(MSG_PRINTING);
|
||||
|
||||
#if SERVICE_INTERVAL_1 > 0
|
||||
else if (print_job_timer.needsService(1)) msg = FPSTR(service1);
|
||||
else if (print_job_timer.needsService(1)) msg = F("> " SERVICE_NAME_1 "!");
|
||||
#endif
|
||||
#if SERVICE_INTERVAL_2 > 0
|
||||
else if (print_job_timer.needsService(2)) msg = FPSTR(service2);
|
||||
else if (print_job_timer.needsService(2)) msg = F("> " SERVICE_NAME_2 "!");
|
||||
#endif
|
||||
#if SERVICE_INTERVAL_3 > 0
|
||||
else if (print_job_timer.needsService(3)) msg = FPSTR(service3);
|
||||
else if (print_job_timer.needsService(3)) msg = F("> " SERVICE_NAME_3 "!");
|
||||
#endif
|
||||
|
||||
else if (!no_welcome) msg = GET_TEXT_F(WELCOME_MSG);
|
||||
|
@ -237,11 +237,14 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, co
|
||||
// all moves are finished. Go back to calling screen when done.
|
||||
//
|
||||
void MarlinUI::synchronize(FSTR_P const fmsg/*=nullptr*/) {
|
||||
static FSTR_P sync_message = fmsg ?: GET_TEXT_F(MSG_MOVING);
|
||||
push_current_screen();
|
||||
|
||||
// Hijack 'editable' for the string pointer
|
||||
editable.fstr = fmsg ?: GET_TEXT_F(MSG_MOVING);
|
||||
goto_screen([]{
|
||||
if (should_draw()) MenuItem_static::draw(LCD_HEIGHT >= 4, sync_message);
|
||||
if (should_draw()) MenuItem_static::draw(LCD_HEIGHT >= 4, editable.fstr);
|
||||
});
|
||||
|
||||
defer_status_screen();
|
||||
planner.synchronize(); // idle() is called until moves complete
|
||||
goto_previous_screen_no_defer();
|
||||
|
@ -145,6 +145,8 @@ typedef union {
|
||||
uint16_t uint16;
|
||||
uint32_t uint32;
|
||||
celsius_t celsius;
|
||||
void *ptr;
|
||||
FSTR_P fstr;
|
||||
} chimera_t;
|
||||
|
||||
extern chimera_t editable;
|
||||
|
Loading…
Reference in New Issue
Block a user