0
0
Fork 0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2025-03-22 22:26:18 +00:00

🧑‍💻 Refactor PROGMEM strings (#27390)

This commit is contained in:
Scott Lahteine 2024-09-02 04:28:50 -05:00 committed by GitHub
parent 5c728d1fb1
commit f234fbf87f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 14 additions and 23 deletions

View file

@ -72,13 +72,9 @@ void BLTouch::init(const bool set_voltage/*=false*/) {
#else #else
#ifdef DEBUG_OUT #ifdef DEBUG_OUT
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING))
PGMSTR(mode0, "OD"); DEBUG_ECHOLN( F("BLTouch Mode: "), bltouch.od_5v_mode ? F("5V") : F("OD"),
PGMSTR(mode1, "5V"); F(" (Default " TERN(BLTOUCH_SET_5V_MODE, "5V", "OD") ")"));
DEBUG_ECHOPGM("BLTouch Mode: ");
DEBUG_ECHOPGM_P(bltouch.od_5v_mode ? mode1 : mode0);
DEBUG_ECHOLNPGM(" (Default " TERN(BLTOUCH_SET_5V_MODE, "5V", "OD") ")");
}
#endif #endif
const bool should_set = od_5v_mode != ENABLED(BLTOUCH_SET_5V_MODE); const bool should_set = od_5v_mode != ENABLED(BLTOUCH_SET_5V_MODE);

View file

@ -34,7 +34,7 @@
static lv_obj_t *scr; static lv_obj_t *scr;
void lv_draw_error_message(FSTR_P const fmsg) { 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); SPI_TFT.lcdClear(0x0000);
if (fmsg) disp_string((TFT_WIDTH - strlen_P(FTOP(fmsg)) * 16) / 2, 100, fmsg, 0xFFFF, 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); disp_string((TFT_WIDTH - strlen_P(FTOP(fhalted)) * 16) / 2, 140, fhalted, 0xFFFF, 0x0000);

View file

@ -1466,16 +1466,6 @@ void MarlinUI::host_notify(const char * const cstr) {
* Reset the status message * Reset the status message
*/ */
void MarlinUI::reset_status(const bool no_welcome) { 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; FSTR_P msg;
if (printingIsPaused()) if (printingIsPaused())
msg = GET_TEXT_F(MSG_PRINT_PAUSED); 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); msg = GET_TEXT_F(MSG_PRINTING);
#if SERVICE_INTERVAL_1 > 0 #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 #endif
#if SERVICE_INTERVAL_2 > 0 #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 #endif
#if SERVICE_INTERVAL_3 > 0 #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 #endif
else if (!no_welcome) msg = GET_TEXT_F(WELCOME_MSG); else if (!no_welcome) msg = GET_TEXT_F(WELCOME_MSG);

View file

@ -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. // all moves are finished. Go back to calling screen when done.
// //
void MarlinUI::synchronize(FSTR_P const fmsg/*=nullptr*/) { void MarlinUI::synchronize(FSTR_P const fmsg/*=nullptr*/) {
static FSTR_P sync_message = fmsg ?: GET_TEXT_F(MSG_MOVING);
push_current_screen(); push_current_screen();
// Hijack 'editable' for the string pointer
editable.fstr = fmsg ?: GET_TEXT_F(MSG_MOVING);
goto_screen([]{ 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(); defer_status_screen();
planner.synchronize(); // idle() is called until moves complete planner.synchronize(); // idle() is called until moves complete
goto_previous_screen_no_defer(); goto_previous_screen_no_defer();

View file

@ -145,6 +145,8 @@ typedef union {
uint16_t uint16; uint16_t uint16;
uint32_t uint32; uint32_t uint32;
celsius_t celsius; celsius_t celsius;
void *ptr;
FSTR_P fstr;
} chimera_t; } chimera_t;
extern chimera_t editable; extern chimera_t editable;