From 3d102a77ca475c2dc6461152ecc445247b9bfd26 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 28 Sep 2021 20:15:52 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Apply=20F()=20to=20kill=20/=20se?= =?UTF-8?q?ndinfoscreen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/MarlinCore.cpp | 6 +-- Marlin/src/MarlinCore.h | 2 +- Marlin/src/feature/direct_stepping.cpp | 2 +- Marlin/src/feature/encoder_i2c.cpp | 2 +- Marlin/src/feature/mmu/mmu2.cpp | 2 +- Marlin/src/feature/pause.cpp | 2 +- Marlin/src/feature/powerloss.cpp | 2 +- Marlin/src/feature/tmc_util.cpp | 2 +- Marlin/src/gcode/control/M108_M112_M410.cpp | 2 +- Marlin/src/gcode/gcode.cpp | 2 +- Marlin/src/gcode/gcode_d.cpp | 2 +- Marlin/src/gcode/host/M16.cpp | 2 +- Marlin/src/gcode/lcd/M0_M1.cpp | 2 +- Marlin/src/gcode/queue.cpp | 2 +- Marlin/src/lcd/e3v2/enhanced/dwin.cpp | 2 +- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 2 +- .../extui/anycubic_chiron/chiron_extui.cpp | 4 +- .../lcd/extui/anycubic_chiron/chiron_tft.cpp | 2 +- .../lcd/extui/anycubic_chiron/chiron_tft.h | 2 +- .../extui/anycubic_i3mega/anycubic_extui.cpp | 2 +- .../anycubic_i3mega/anycubic_i3mega_lcd.cpp | 2 +- .../src/lcd/extui/dgus/DGUSScreenHandler.cpp | 4 +- Marlin/src/lcd/extui/dgus/dgus_extui.cpp | 6 +-- .../lcd/extui/dgus/fysetc/DGUSScreenHandler.h | 6 +++ .../extui/dgus/hiprecy/DGUSScreenHandler.h | 6 +++ .../lcd/extui/dgus/mks/DGUSScreenHandler.cpp | 4 +- .../lcd/extui/dgus/mks/DGUSScreenHandler.h | 6 +++ .../lcd/extui/dgus/origin/DGUSScreenHandler.h | 6 +++ .../extui/dgus_reloaded/DGUSScreenHandler.cpp | 6 +-- .../extui/dgus_reloaded/DGUSScreenHandler.h | 2 +- .../dgus_reloaded/dgus_reloaded_extui.cpp | 2 +- Marlin/src/lcd/extui/example/example.cpp | 2 +- .../ftdi_eve_touch_ui/ftdi_eve_extui.cpp | 6 +-- Marlin/src/lcd/extui/malyan/malyan.cpp | 41 ++++++++------- Marlin/src/lcd/extui/malyan/malyan.h | 6 +-- Marlin/src/lcd/extui/malyan/malyan_extui.cpp | 24 ++++----- Marlin/src/lcd/extui/mks_ui/wifi_module.cpp | 2 +- .../src/lcd/extui/nextion/nextion_extui.cpp | 2 +- Marlin/src/lcd/extui/nextion/nextion_tft.cpp | 10 ++-- .../src/lcd/extui/nextion/nextion_tft_defs.h | 4 +- Marlin/src/lcd/extui/ui_api.cpp | 3 +- Marlin/src/lcd/extui/ui_api.h | 2 +- Marlin/src/lcd/marlinui.cpp | 4 +- Marlin/src/lcd/marlinui.h | 4 +- Marlin/src/module/endstops.cpp | 2 +- Marlin/src/module/motion.cpp | 2 +- Marlin/src/module/planner.cpp | 2 +- Marlin/src/module/probe.cpp | 2 +- Marlin/src/module/temperature.cpp | 52 +++++++++---------- Marlin/src/module/temperature.h | 2 +- Marlin/src/module/tool_change.cpp | 2 +- Marlin/src/sd/cardreader.cpp | 2 +- 52 files changed, 149 insertions(+), 123 deletions(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 8a15c45f83..346c5f8f2c 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -852,16 +852,16 @@ void idle(bool no_stepper_sleep/*=false*/) { * Kill all activity and lock the machine. * After this the machine will need to be reset. */ -void kill(PGM_P const lcd_error/*=nullptr*/, PGM_P const lcd_component/*=nullptr*/, const bool steppers_off/*=false*/) { +void kill(FSTR_P const lcd_error/*=nullptr*/, FSTR_P const lcd_component/*=nullptr*/, const bool steppers_off/*=false*/) { thermalManager.disable_all_heaters(); TERN_(HAS_CUTTER, cutter.kill()); // Full cutter shutdown including ISR control // Echo the LCD message to serial for extra context - if (lcd_error) { SERIAL_ECHO_START(); SERIAL_ECHOLNPGM_P(lcd_error); } + if (lcd_error) { SERIAL_ECHO_START(); SERIAL_ECHOLNF(lcd_error); } #if EITHER(HAS_DISPLAY, DWIN_CREALITY_LCD_ENHANCED) - ui.kill_screen(lcd_error ?: GET_TEXT(MSG_KILLED), lcd_component ?: NUL_STR); + ui.kill_screen(lcd_error ?: GET_TEXT_F(MSG_KILLED), lcd_component ?: FPSTR(NUL_STR)); #else UNUSED(lcd_error); UNUSED(lcd_component); #endif diff --git a/Marlin/src/MarlinCore.h b/Marlin/src/MarlinCore.h index c3698d616d..7063c7e2de 100644 --- a/Marlin/src/MarlinCore.h +++ b/Marlin/src/MarlinCore.h @@ -38,7 +38,7 @@ inline void idle_no_sleep() { idle(true); } extern bool G38_did_trigger; // Flag from the ISR to indicate the endstop changed #endif -void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false); +void kill(FSTR_P const lcd_error=nullptr, FSTR_P const lcd_component=nullptr, const bool steppers_off=false); void minkill(const bool steppers_off=false); // Global State of the firmware diff --git a/Marlin/src/feature/direct_stepping.cpp b/Marlin/src/feature/direct_stepping.cpp index ce979145a1..b8ef04fcd9 100644 --- a/Marlin/src/feature/direct_stepping.cpp +++ b/Marlin/src/feature/direct_stepping.cpp @@ -174,7 +174,7 @@ namespace DirectStepping { template void SerialPageManager::write_responses() { if (fatal_error) { - kill(GET_TEXT(MSG_BAD_PAGE)); + kill(GET_TEXT_F(MSG_BAD_PAGE)); return; } diff --git a/Marlin/src/feature/encoder_i2c.cpp b/Marlin/src/feature/encoder_i2c.cpp index f843011b5d..87e611f86c 100644 --- a/Marlin/src/feature/encoder_i2c.cpp +++ b/Marlin/src/feature/encoder_i2c.cpp @@ -153,7 +153,7 @@ void I2CPositionEncoder::update() { #ifdef I2CPE_ERR_THRESH_ABORT if (ABS(error) > I2CPE_ERR_THRESH_ABORT * planner.settings.axis_steps_per_mm[encoderAxis]) { - //kill(PSTR("Significant Error")); + //kill(F("Significant Error")); SERIAL_ECHOLNPGM("Axis error over threshold, aborting!", error); safe_delay(5000); } diff --git a/Marlin/src/feature/mmu/mmu2.cpp b/Marlin/src/feature/mmu/mmu2.cpp index b2835dc3ce..56e6e6150b 100644 --- a/Marlin/src/feature/mmu/mmu2.cpp +++ b/Marlin/src/feature/mmu/mmu2.cpp @@ -448,7 +448,7 @@ bool MMU2::rx_ok() { void MMU2::check_version() { if (buildnr < MMU_REQUIRED_FW_BUILDNR) { SERIAL_ERROR_MSG("Invalid MMU2 firmware. Version >= " STRINGIFY(MMU_REQUIRED_FW_BUILDNR) " required."); - kill(GET_TEXT(MSG_KILL_MMU2_FIRMWARE)); + kill(GET_TEXT_F(MSG_KILL_MMU2_FIRMWARE)); } } diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 8a35a87eeb..643c4ef9fc 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -254,7 +254,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE))); TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE), FPSTR(CONTINUE_STR))); - TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_Popup_Confirm(ICON_BLTouch, GET_TEXT(MSG_FILAMENT_CHANGE_PURGE), CONTINUE_STR)); + TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_Popup_Confirm(ICON_BLTouch, GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE), FPSTR(CONTINUE_STR))); wait_for_user = true; // A click or M108 breaks the purge_length loop for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count) unscaled_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE); diff --git a/Marlin/src/feature/powerloss.cpp b/Marlin/src/feature/powerloss.cpp index bc19c9b18e..723ec1903b 100644 --- a/Marlin/src/feature/powerloss.cpp +++ b/Marlin/src/feature/powerloss.cpp @@ -301,7 +301,7 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW retract_and_lift(zraise); #endif - kill(GET_TEXT(MSG_OUTAGE_RECOVERY)); + kill(GET_TEXT_F(MSG_OUTAGE_RECOVERY)); } #endif diff --git a/Marlin/src/feature/tmc_util.cpp b/Marlin/src/feature/tmc_util.cpp index c11d2e5f6d..82c10e6e8e 100644 --- a/Marlin/src/feature/tmc_util.cpp +++ b/Marlin/src/feature/tmc_util.cpp @@ -212,7 +212,7 @@ if (data.is_ot) SERIAL_ECHOLNPGM("overtemperature"); if (data.is_s2g) SERIAL_ECHOLNPGM("coil short circuit"); TERN_(TMC_DEBUG, tmc_report_all()); - kill(PSTR("Driver error")); + kill(F("Driver error")); } #endif diff --git a/Marlin/src/gcode/control/M108_M112_M410.cpp b/Marlin/src/gcode/control/M108_M112_M410.cpp index 309c806c8f..39f9c04e19 100644 --- a/Marlin/src/gcode/control/M108_M112_M410.cpp +++ b/Marlin/src/gcode/control/M108_M112_M410.cpp @@ -40,7 +40,7 @@ void GcodeSuite::M108() { * M112: Full Shutdown */ void GcodeSuite::M112() { - kill(M112_KILL_STR, nullptr, true); + kill(FPSTR(M112_KILL_STR), nullptr, true); } /** diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 79f53a8e77..40c21a19f3 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -262,7 +262,7 @@ void GcodeSuite::dwell(millis_t time) { #ifdef ACTION_ON_CANCEL host_action_cancel(); #endif - kill(GET_TEXT(MSG_LCD_PROBING_FAILED)); + kill(GET_TEXT_F(MSG_LCD_PROBING_FAILED)); #endif } diff --git a/Marlin/src/gcode/gcode_d.cpp b/Marlin/src/gcode/gcode_d.cpp index 83646ef67c..204455e65e 100644 --- a/Marlin/src/gcode/gcode_d.cpp +++ b/Marlin/src/gcode/gcode_d.cpp @@ -58,7 +58,7 @@ void GcodeSuite::D(const int16_t dcode) { break; case 10: - kill(PSTR("D10"), PSTR("KILL TEST"), parser.seen_test('P')); + kill(F("D10"), F("KILL TEST"), parser.seen_test('P')); break; case 1: { diff --git a/Marlin/src/gcode/host/M16.cpp b/Marlin/src/gcode/host/M16.cpp index 1ac8580396..03e734daaa 100644 --- a/Marlin/src/gcode/host/M16.cpp +++ b/Marlin/src/gcode/host/M16.cpp @@ -33,7 +33,7 @@ void GcodeSuite::M16() { if (strcmp_P(parser.string_arg, PSTR(MACHINE_NAME))) - kill(GET_TEXT(MSG_KILL_EXPECTED_PRINTER)); + kill(GET_TEXT_F(MSG_KILL_EXPECTED_PRINTER)); } diff --git a/Marlin/src/gcode/lcd/M0_M1.cpp b/Marlin/src/gcode/lcd/M0_M1.cpp index 17481f0198..239366fec8 100644 --- a/Marlin/src/gcode/lcd/M0_M1.cpp +++ b/Marlin/src/gcode/lcd/M0_M1.cpp @@ -67,7 +67,7 @@ void GcodeSuite::M0_M1() { #elif ENABLED(EXTENSIBLE_UI) if (parser.string_arg) - ExtUI::onUserConfirmRequired(parser.string_arg); // Can this take an SRAM string?? + ExtUI::onUserConfirmRequired(parser.string_arg); // String in an SRAM buffer else ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_USERWAIT)); #elif ENABLED(DWIN_CREALITY_LCD_ENHANCED) diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp index ee4f5b9d3b..b36205d622 100644 --- a/Marlin/src/gcode/queue.cpp +++ b/Marlin/src/gcode/queue.cpp @@ -523,7 +523,7 @@ void GCodeQueue::get_serial_commands() { // Process critical commands early if (command[0] == 'M') switch (command[3]) { case '8': if (command[2] == '0' && command[1] == '1') { wait_for_heatup = false; TERN_(HAS_LCD_MENU, wait_for_user = false); } break; - case '2': if (command[2] == '1' && command[1] == '1') kill(M112_KILL_STR, nullptr, true); break; + case '2': if (command[2] == '1' && command[1] == '1') kill(FPSTR(M112_KILL_STR), nullptr, true); break; case '0': if (command[1] == '4' && command[2] == '1') quickstop_stepper(); break; } #endif diff --git a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp index 064ebbd47d..b13a5abfda 100644 --- a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp +++ b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp @@ -1852,7 +1852,7 @@ void DWIN_LoadSettings(const char *buff) { feedrate_percentage = 100; } -void MarlinUI::kill_screen(PGM_P lcd_error, PGM_P lcd_component) { +void MarlinUI::kill_screen(FSTR_P const lcd_error, FSTR_P const lcd_component) { DWIN_Draw_Popup(ICON_BLTouch, lcd_error, lcd_component); DWIN_UpdateLCD(); } diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index ddf7b6dcd4..754f8bafaf 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -949,7 +949,7 @@ void CrealityDWINClass::Draw_Popup(FSTR_P const line1, FSTR_P const line2, FSTR_ } } -void MarlinUI::kill_screen(PGM_P const error, PGM_P const component) { +void MarlinUI::kill_screen(FSTR_P const error, FSTR_P const) { CrealityDWIN.Draw_Popup(F("Printer Kill Reason:"), error, F("Restart Required"), Wait, ICON_BLTouch); } diff --git a/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp b/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp index 5cd0922800..7a58963c11 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp @@ -41,8 +41,8 @@ namespace ExtUI { void onIdle() { Chiron.IdleLoop(); } - void onPrinterKilled(PGM_P const error, PGM_P const component) { - Chiron.PrinterKilled(error,component); + void onPrinterKilled(FSTR_P const error, FSTR_P const component) { + Chiron.PrinterKilled(error, component); } void onMediaInserted() { Chiron.MediaEvent(AC_media_inserted); } diff --git a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp index 483da200e8..c3fc6aa96e 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp +++ b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp @@ -126,7 +126,7 @@ void ChironTFT::IdleLoop() { CheckHeaters(); } -void ChironTFT::PrinterKilled(PGM_P error,PGM_P component) { +void ChironTFT::PrinterKilled(FSTR_P const error, FSTR_P const component) { SendtoTFTLN(AC_msg_kill_lcd); #if ACDEBUG(AC_MARLIN) SERIAL_ECHOLNPGM("PrinterKilled()\nerror: ", error , "\ncomponent: ", component); diff --git a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.h b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.h index a80763e372..44ba02dc5d 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.h +++ b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.h @@ -59,7 +59,7 @@ class ChironTFT { public: static void Startup(); static void IdleLoop(); - static void PrinterKilled(PGM_P, PGM_P); + static void PrinterKilled(FSTR_P, FSTR_P); static void MediaEvent(media_event_t); static void TimerEvent(timer_event_t); static void FilamentRunout(); diff --git a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp index 33e7e84a81..c0e1b44578 100644 --- a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp @@ -37,7 +37,7 @@ namespace ExtUI { void onStartup() { AnycubicTFT.OnSetup(); } void onIdle() { AnycubicTFT.OnCommandScan(); } - void onPrinterKilled(PGM_P const error, PGM_P const component) { AnycubicTFT.OnKillTFT(); } + void onPrinterKilled(FSTR_P const error, FSTR_P const component) { AnycubicTFT.OnKillTFT(); } void onMediaInserted() { AnycubicTFT.OnSDCardStateChange(true); } void onMediaError() { AnycubicTFT.OnSDCardError(); } void onMediaRemoved() { AnycubicTFT.OnSDCardStateChange(false); } diff --git a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp index 5bbcfd0b5e..98534ba65f 100644 --- a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp +++ b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp @@ -654,7 +654,7 @@ void AnycubicTFTClass::GetCommandFromTFT() { break; case 12: // A12 kill - kill(PSTR(STR_ERR_KILLED)); + kill(F(STR_ERR_KILLED)); break; case 13: // A13 SELECTION FILE diff --git a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp index 06b350ff77..c9e7268f04 100644 --- a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp @@ -340,7 +340,7 @@ void DGUSScreenHandler::DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var) void DGUSScreenHandler::SDCardError() { DGUSScreenHandler::SDCardRemoved(); - sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("SD card error"), nullptr, true, true, true, true); + sendinfoscreen(F("NOTICE"), nullptr, F("SD card error"), nullptr, true, true, true, true); SetupConfirmAction(nullptr); GotoScreen(DGUSLCD_SCREEN_POPUP); } @@ -567,7 +567,7 @@ void DGUSScreenHandler::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, vo if (buf[0]) queue.enqueue_one_now(buf); #if ENABLED(DGUS_UI_WAITING) - sendinfoscreen(PSTR("PID is autotuning"), PSTR("please wait"), NUL_STR, NUL_STR, true, true, true, true); + sendinfoscreen(F("PID is autotuning"), F("please wait"), NUL_STR, NUL_STR, true, true, true, true); GotoScreen(DGUSLCD_SCREEN_WAITING); #endif } diff --git a/Marlin/src/lcd/extui/dgus/dgus_extui.cpp b/Marlin/src/lcd/extui/dgus/dgus_extui.cpp index 4f15827a49..04ba6b95c2 100644 --- a/Marlin/src/lcd/extui/dgus/dgus_extui.cpp +++ b/Marlin/src/lcd/extui/dgus/dgus_extui.cpp @@ -42,8 +42,8 @@ namespace ExtUI { void onIdle() { ScreenHandler.loop(); } - void onPrinterKilled(PGM_P const error, PGM_P const component) { - ScreenHandler.sendinfoscreen(GET_TEXT(MSG_HALTED), error, NUL_STR, GET_TEXT(MSG_PLEASE_RESET), true, true, true, true); + void onPrinterKilled(FSTR_P const error, FSTR_P const) { + ScreenHandler.sendinfoscreen(GET_TEXT_F(MSG_HALTED), error, FPSTR(NUL_STR), GET_TEXT_F(MSG_PLEASE_RESET), true, true, true, true); ScreenHandler.GotoScreen(DGUSLCD_SCREEN_KILL); while (!ScreenHandler.loop()); // Wait while anything is left to be sent } @@ -60,7 +60,7 @@ namespace ExtUI { void onUserConfirmRequired(const char * const msg) { if (msg) { - ScreenHandler.sendinfoscreen(PSTR("Please confirm."), nullptr, msg, nullptr, true, true, false, true); + ScreenHandler.sendinfoscreen(F("Please confirm."), nullptr, msg, nullptr, true, true, false, true); ScreenHandler.SetupConfirmAction(setUserConfirmed); ScreenHandler.GotoScreen(DGUSLCD_SCREEN_POPUP); } diff --git a/Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.h b/Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.h index ee0af013a8..bb0bd2bd3b 100644 --- a/Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.h +++ b/Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.h @@ -38,6 +38,12 @@ public: // Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen // The bools specifying whether the strings are in RAM or FLASH. static void sendinfoscreen(const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash); + static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) { + sendinfoscreen(FTOP(line1), FTOP(line2), line3, line4, l1inflash, l2inflash, l3inflash, liinflash); + } + static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, FSTR_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) { + sendinfoscreen(FTOP(line1), FTOP(line2), FTOP(line3), FTOP(line4), l1inflash, l2inflash, l3inflash, liinflash); + } static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash); diff --git a/Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.h b/Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.h index ee0af013a8..bb0bd2bd3b 100644 --- a/Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.h +++ b/Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.h @@ -38,6 +38,12 @@ public: // Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen // The bools specifying whether the strings are in RAM or FLASH. static void sendinfoscreen(const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash); + static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) { + sendinfoscreen(FTOP(line1), FTOP(line2), line3, line4, l1inflash, l2inflash, l3inflash, liinflash); + } + static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, FSTR_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) { + sendinfoscreen(FTOP(line1), FTOP(line2), FTOP(line3), FTOP(line4), l1inflash, l2inflash, l3inflash, liinflash); + } static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash); diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp index 0dc1e2245e..0e2a971fd1 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp @@ -1233,7 +1233,7 @@ void DGUSScreenHandler::MKS_FilamentLoadUnload(DGUS_VP_Variable &var, void *val_ #if BOTH(HAS_HOTEND, PREVENT_COLD_EXTRUSION) if (hotend_too_cold) { if (thermalManager.targetTooColdToExtrude(hotend_too_cold - 1)) thermalManager.setTargetHotend(thermalManager.extrude_min_temp, hotend_too_cold - 1); - sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true); + sendinfoscreen(F("NOTICE"), nullptr, F("Please wait."), F("Nozzle heating!"), true, true, true, true); SetupConfirmAction(nullptr); GotoScreen(DGUSLCD_SCREEN_POPUP); } @@ -1489,7 +1489,7 @@ void DGUSScreenHandler::DGUS_Runout_Idle(void) { queue.inject(F("M25")); GotoScreen(MKSLCD_SCREEN_PAUSE); - sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please change filament!"), nullptr, true, true, true, true); + sendinfoscreen(F("NOTICE"), nullptr, F("Please change filament!"), nullptr, true, true, true, true); //SetupConfirmAction(nullptr); GotoScreen(DGUSLCD_SCREEN_POPUP); break; diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.h b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.h index 8d5d9066f4..0c80cd260e 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.h +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.h @@ -38,6 +38,12 @@ public: // Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen // The bools specifying whether the strings are in RAM or FLASH. static void sendinfoscreen(const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash); + static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) { + sendinfoscreen(FTOP(line1), FTOP(line2), line3, line4, l1inflash, l2inflash, l3inflash, liinflash); + } + static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, FSTR_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) { + sendinfoscreen(FTOP(line1), FTOP(line2), FTOP(line3), FTOP(line4), l1inflash, l2inflash, l3inflash, liinflash); + } static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash); diff --git a/Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.h b/Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.h index ee0af013a8..bb0bd2bd3b 100644 --- a/Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.h +++ b/Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.h @@ -38,6 +38,12 @@ public: // Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen // The bools specifying whether the strings are in RAM or FLASH. static void sendinfoscreen(const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash); + static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) { + sendinfoscreen(FTOP(line1), FTOP(line2), line3, line4, l1inflash, l2inflash, l3inflash, liinflash); + } + static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, FSTR_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) { + sendinfoscreen(FTOP(line1), FTOP(line2), FTOP(line3), FTOP(line4), l1inflash, l2inflash, l3inflash, liinflash); + } static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash); diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp index 1489ed4bbe..9bae2b95d3 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp @@ -159,9 +159,9 @@ void DGUSScreenHandler::Loop() { dgus_display.Loop(); } -void DGUSScreenHandler::PrinterKilled(PGM_P error, PGM_P component) { - SetMessageLinePGM(error, 1); - SetMessageLinePGM(component, 2); +void DGUSScreenHandler::PrinterKilled(FSTR_P const error, FSTR_P const component) { + SetMessageLinePGM(FTOP(error), 1); + SetMessageLinePGM(FTOP(component), 2); SetMessageLinePGM(NUL_STR, 3); SetMessageLinePGM(GET_TEXT(MSG_PLEASE_RESET), 4); diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h index 0cc885eb7f..509d599200 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h @@ -37,7 +37,7 @@ public: static void Ready(); static void Loop(); - static void PrinterKilled(PGM_P error, PGM_P component); + static void PrinterKilled(FSTR_P const error, FSTR_P const component); static void UserConfirmRequired(const char * const msg); static void SettingsReset(); static void StoreSettings(char *buff); diff --git a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp index 26f2dcbde9..61b072a3f7 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp @@ -46,7 +46,7 @@ namespace ExtUI { } } - void onPrinterKilled(PGM_P error, PGM_P component) { + void onPrinterKilled(FSTR_P const error, FSTR_P const component) { dgus_screen_handler.PrinterKilled(error, component); } diff --git a/Marlin/src/lcd/extui/example/example.cpp b/Marlin/src/lcd/extui/example/example.cpp index f74cbee91c..8f38d2aba6 100644 --- a/Marlin/src/lcd/extui/example/example.cpp +++ b/Marlin/src/lcd/extui/example/example.cpp @@ -46,7 +46,7 @@ namespace ExtUI { */ } void onIdle() {} - void onPrinterKilled(PGM_P const error, PGM_P const component) {} + void onPrinterKilled(FSTR_P const error, FSTR_P const component) {} void onMediaInserted() {} void onMediaError() {} void onMediaRemoved() {} diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp index 59833b06a0..109814abf2 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp @@ -38,9 +38,9 @@ namespace ExtUI { void onIdle() { EventLoop::loop(); } - void onPrinterKilled(PGM_P const error, PGM_P const component) { - char str[strlen_P(error) + strlen_P(component) + 3]; - sprintf_P(str, PSTR(S_FMT ": " S_FMT), error, component); + void onPrinterKilled(FSTR_P const error, FSTR_P const component) { + char str[strlen_P(FTOP(error)) + strlen_P(FTOP(component)) + 3]; + sprintf_P(str, PSTR(S_FMT ": " S_FMT), FTOP(error), FTOP(component)); KillScreen::show(str); } diff --git a/Marlin/src/lcd/extui/malyan/malyan.cpp b/Marlin/src/lcd/extui/malyan/malyan.cpp index 8c9bfc32e5..df7f305df2 100644 --- a/Marlin/src/lcd/extui/malyan/malyan.cpp +++ b/Marlin/src/lcd/extui/malyan/malyan.cpp @@ -74,35 +74,36 @@ uint16_t inbound_count; bool last_printing_status = false; // Everything written needs the high bit set. -void write_to_lcd_P(PGM_P const message) { +void write_to_lcd(FSTR_P const fmsg) { + PGM_P pmsg = FTOP(fmsg); char encoded_message[MAX_CURLY_COMMAND]; - uint8_t message_length = _MIN(strlen_P(message), sizeof(encoded_message)); + uint8_t message_length = _MIN(strlen_P(pmsg), sizeof(encoded_message)); LOOP_L_N(i, message_length) - encoded_message[i] = pgm_read_byte(&message[i]) | 0x80; + encoded_message[i] = pgm_read_byte(&pmsg[i]) | 0x80; LCD_SERIAL.Print::write(encoded_message, message_length); } -void write_to_lcd(const char * const message) { +void write_to_lcd(const char * const cmsg) { char encoded_message[MAX_CURLY_COMMAND]; - const uint8_t message_length = _MIN(strlen(message), sizeof(encoded_message)); + const uint8_t message_length = _MIN(strlen(cmsg), sizeof(encoded_message)); LOOP_L_N(i, message_length) - encoded_message[i] = message[i] | 0x80; + encoded_message[i] = cmsg[i] | 0x80; LCD_SERIAL.Print::write(encoded_message, message_length); } // {E:} is for error states. -void set_lcd_error_P(PGM_P const error, PGM_P const component/*=nullptr*/) { - write_to_lcd_P(PSTR("{E:")); - write_to_lcd_P(error); +void set_lcd_error(FSTR_P const error, FSTR_P const component/*=nullptr*/) { + write_to_lcd(F("{E:")); + write_to_lcd(error); if (component) { - write_to_lcd_P(PSTR(" ")); - write_to_lcd_P(component); + write_to_lcd(F(" ")); + write_to_lcd(component); } - write_to_lcd_P(PSTR("}")); + write_to_lcd(F("}")); } @@ -243,16 +244,16 @@ void process_lcd_p_command(const char *command) { switch (command[0]) { case 'P': ExtUI::pausePrint(); - write_to_lcd_P(PSTR("{SYS:PAUSED}")); + write_to_lcd(F("{SYS:PAUSED}")); break; case 'R': ExtUI::resumePrint(); - write_to_lcd_P(PSTR("{SYS:RESUMED}")); + write_to_lcd(F("{SYS:RESUMED}")); break; case 'X': - write_to_lcd_P(PSTR("{SYS:CANCELING}")); + write_to_lcd(F("{SYS:CANCELING}")); ExtUI::stopPrint(); - write_to_lcd_P(PSTR("{SYS:STARTED}")); + write_to_lcd(F("{SYS:STARTED}")); break; case 'H': queue.enqueue_now_P(G28_STR); break; // Home all axes default: { @@ -271,13 +272,13 @@ void process_lcd_p_command(const char *command) { // but the V2 LCD switches to "print" mode on {SYS:DIR} response. if (card.flag.filenameIsDir) { card.cd(card.filename); - write_to_lcd_P(PSTR("{SYS:DIR}")); + write_to_lcd(F("{SYS:DIR}")); } else { char message_buffer[MAX_CURLY_COMMAND]; sprintf_P(message_buffer, PSTR("{PRINTFILE:%s}"), card.longest_filename()); write_to_lcd(message_buffer); - write_to_lcd_P(PSTR("{SYS:BUILD}")); + write_to_lcd(F("{SYS:BUILD}")); card.openAndPrintFile(card.filename); } #endif @@ -332,7 +333,7 @@ void process_lcd_s_command(const char *command) { write_to_lcd(message_buffer); } - write_to_lcd_P(PSTR("{SYS:OK}")); + write_to_lcd(F("{SYS:OK}")); #endif } break; @@ -413,7 +414,7 @@ void update_usb_status(const bool forceUpdate) { // This is more logical. if (last_usb_connected_status != MYSERIAL1.connected() || forceUpdate) { last_usb_connected_status = MYSERIAL1.connected(); - write_to_lcd_P(last_usb_connected_status ? PSTR("{R:UC}\r\n") : PSTR("{R:UD}\r\n")); + write_to_lcd(last_usb_connected_status ? F("{R:UC}\r\n") : F("{R:UD}\r\n")); } } diff --git a/Marlin/src/lcd/extui/malyan/malyan.h b/Marlin/src/lcd/extui/malyan/malyan.h index e8afbd4a59..1d0e911ccd 100644 --- a/Marlin/src/lcd/extui/malyan/malyan.h +++ b/Marlin/src/lcd/extui/malyan/malyan.h @@ -33,10 +33,10 @@ extern uint16_t inbound_count; // For sending print completion messages extern bool last_printing_status; -void write_to_lcd_P(PGM_P const message); -void write_to_lcd(const char * const message); +void write_to_lcd(FSTR_P const fmsg); +void write_to_lcd(const char * const cmsg); -void set_lcd_error_P(PGM_P const error, PGM_P const component=nullptr); +void set_lcd_error(FSTR_P const error, FSTR_P const component=nullptr); void process_lcd_c_command(const char *command); void process_lcd_eb_command(const char *command); diff --git a/Marlin/src/lcd/extui/malyan/malyan_extui.cpp b/Marlin/src/lcd/extui/malyan/malyan_extui.cpp index cae534de3b..f323728e27 100644 --- a/Marlin/src/lcd/extui/malyan/malyan_extui.cpp +++ b/Marlin/src/lcd/extui/malyan/malyan_extui.cpp @@ -55,13 +55,13 @@ namespace ExtUI { LCD_SERIAL.begin(LCD_BAUDRATE); // Signal init - write_to_lcd_P(PSTR("{SYS:STARTED}\r\n")); + write_to_lcd(F("{SYS:STARTED}\r\n")); // send a version that says "unsupported" - write_to_lcd_P(PSTR("{VER:99}\r\n")); + write_to_lcd(F("{VER:99}\r\n")); // No idea why it does this twice. - write_to_lcd_P(PSTR("{SYS:STARTED}\r\n")); + write_to_lcd(F("{SYS:STARTED}\r\n")); update_usb_status(true); } @@ -98,8 +98,8 @@ namespace ExtUI { #endif } - void onPrinterKilled(PGM_P const error, PGM_P const component) { - set_lcd_error_P(error, component); + void onPrinterKilled(FSTR_P const error, FSTR_P const component) { + set_lcd_error(error, component); } #if HAS_PID_HEATING @@ -109,28 +109,28 @@ namespace ExtUI { //SERIAL_ECHOLNPGM("OnPidTuning:", rst); switch (rst) { case PID_STARTED: - set_lcd_error_P(GET_TEXT(MSG_PID_AUTOTUNE)); + set_lcd_error(GET_TEXT_F(MSG_PID_AUTOTUNE)); break; case PID_BAD_EXTRUDER_NUM: - set_lcd_error_P(GET_TEXT(MSG_PID_BAD_EXTRUDER_NUM)); + set_lcd_error(GET_TEXT_F(MSG_PID_BAD_EXTRUDER_NUM)); break; case PID_TEMP_TOO_HIGH: - set_lcd_error_P(GET_TEXT(MSG_PID_TEMP_TOO_HIGH)); + set_lcd_error(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH)); break; case PID_TUNING_TIMEOUT: - set_lcd_error_P(GET_TEXT(MSG_PID_TIMEOUT)); + set_lcd_error(GET_TEXT_F(MSG_PID_TIMEOUT)); break; case PID_DONE: - set_lcd_error_P(GET_TEXT(MSG_PID_AUTOTUNE_DONE)); + set_lcd_error(GET_TEXT_F(MSG_PID_AUTOTUNE_DONE)); break; } } #endif - void onPrintTimerStarted() { write_to_lcd_P(PSTR("{SYS:BUILD}")); } + void onPrintTimerStarted() { write_to_lcd(F("{SYS:BUILD}")); } void onPrintTimerPaused() {} - void onPrintTimerStopped() { write_to_lcd_P(PSTR("{TQ:100}")); } + void onPrintTimerStopped() { write_to_lcd(F("{TQ:100}")); } // Not needed for Malyan LCD void onStatusChanged(const char * const) {} diff --git a/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp b/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp index 96b0f2a086..20d4720d00 100644 --- a/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp +++ b/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp @@ -2030,7 +2030,7 @@ void get_wifi_commands() { wait_for_heatup = false; TERN_(HAS_LCD_MENU, wait_for_user = false); } - if (strcmp(command, "M112") == 0) kill(M112_KILL_STR, nullptr, true); + if (strcmp(command, "M112") == 0) kill(FPSTR(M112_KILL_STR), nullptr, true); if (strcmp(command, "M410") == 0) quickstop_stepper(); #endif diff --git a/Marlin/src/lcd/extui/nextion/nextion_extui.cpp b/Marlin/src/lcd/extui/nextion/nextion_extui.cpp index a825bd502f..c19d3aee46 100644 --- a/Marlin/src/lcd/extui/nextion/nextion_extui.cpp +++ b/Marlin/src/lcd/extui/nextion/nextion_extui.cpp @@ -37,7 +37,7 @@ namespace ExtUI { void onStartup() { nextion.Startup(); } void onIdle() { nextion.IdleLoop(); } - void onPrinterKilled(PGM_P const error, PGM_P const component) { nextion.PrinterKilled(error,component); } + void onPrinterKilled(FSTR_P const error, FSTR_P const component) { nextion.PrinterKilled(error, component); } void onMediaInserted() {} void onMediaError() {} void onMediaRemoved() {} diff --git a/Marlin/src/lcd/extui/nextion/nextion_tft.cpp b/Marlin/src/lcd/extui/nextion/nextion_tft.cpp index 64e909779d..810848469c 100644 --- a/Marlin/src/lcd/extui/nextion/nextion_tft.cpp +++ b/Marlin/src/lcd/extui/nextion/nextion_tft.cpp @@ -84,12 +84,12 @@ void NextionTFT::IdleLoop() { UpdateOnChange(); } -void NextionTFT::PrinterKilled(PGM_P error, PGM_P component) { +void NextionTFT::PrinterKilled(FSTR_P const error, FSTR_P const component) { SEND_TXT_END("page error"); - SEND_TXT("t3", "Error"); - SEND_TXT_P("t4", component); - SEND_TXT_P("t5", error); - SEND_TXT("t6", "Need reset"); + SEND_TXT_F("t3", F("Error")); + SEND_TXT_F("t4", component); + SEND_TXT_F("t5", error); + SEND_TXT_F("t6", F("Need reset")); } void NextionTFT::PrintFinished() { diff --git a/Marlin/src/lcd/extui/nextion/nextion_tft_defs.h b/Marlin/src/lcd/extui/nextion/nextion_tft_defs.h index 4570e9bba4..cdd91bf2a3 100644 --- a/Marlin/src/lcd/extui/nextion/nextion_tft_defs.h +++ b/Marlin/src/lcd/extui/nextion/nextion_tft_defs.h @@ -56,8 +56,8 @@ #define SEND_TEMP(x,y,t,z) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".txt=\"")), LCD_SERIAL.print(y), nextion.SendtoTFT(F(t)), LCD_SERIAL.print(z), nextion.SendtoTFT(F("\"\xFF\xFF\xFF"))) #define SEND_VAL(x,y) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".val=")), LCD_SERIAL.print(y), nextion.SendtoTFT(F("\xFF\xFF\xFF"))) -#define SEND_TXT(x,y) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".txt=\"")), nextion.SendtoTFT(F(y)), nextion.SendtoTFT(F("\"\xFF\xFF\xFF"))) -#define SEND_TXT_P(x,y) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".txt=\"")), nextion.SendtoTFT(y), nextion.SendtoTFT(F("\"\xFF\xFF\xFF"))) +#define SEND_TXT(x,y) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".txt=\"")), nextion.SendtoTFT(F(y)), nextion.SendtoTFT(F("\"\xFF\xFF\xFF"))) +#define SEND_TXT_F(x,y) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".txt=\"")), nextion.SendtoTFT(y), nextion.SendtoTFT(F("\"\xFF\xFF\xFF"))) #define SEND_VALasTXT(x,y) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".txt=\"")), LCD_SERIAL.print(y), nextion.SendtoTFT(F("\"\xFF\xFF\xFF"))) #define SEND_TXT_END(x) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F("\xFF\xFF\xFF"))) #define SEND_PCO2(x,y,z) (nextion.SendtoTFT(F(x)), LCD_SERIAL.print(y), nextion.SendtoTFT(F(".pco=")), nextion.SendtoTFT(F(z)), nextion.SendtoTFT(F("\xFF\xFF\xFF"))) diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index afd762a470..8e588ef8c2 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -1077,6 +1077,7 @@ namespace ExtUI { void resumePrint() { ui.resume_print(); } void stopPrint() { ui.abort_print(); } + // Simplest approach is to make an SRAM copy void onUserConfirmRequired(FSTR_P const fstr) { char msg[strlen_P(FTOP(fstr)) + 1]; strcpy_P(msg, FTOP(fstr)); @@ -1153,7 +1154,7 @@ void MarlinUI::init() { ExtUI::onStartup(); } void MarlinUI::update() { ExtUI::onIdle(); } -void MarlinUI::kill_screen(PGM_P const error, PGM_P const component) { +void MarlinUI::kill_screen(FSTR_P const error, FSTR_P const component) { using namespace ExtUI; if (!flags.printer_killed) { flags.printer_killed = true; diff --git a/Marlin/src/lcd/extui/ui_api.h b/Marlin/src/lcd/extui/ui_api.h index 4866c5b9d7..7e899221ad 100644 --- a/Marlin/src/lcd/extui/ui_api.h +++ b/Marlin/src/lcd/extui/ui_api.h @@ -394,7 +394,7 @@ namespace ExtUI { void onMediaError(); void onMediaRemoved(); void onPlayTone(const uint16_t frequency, const uint16_t duration); - void onPrinterKilled(PGM_P const error, PGM_P const component); + void onPrinterKilled(FSTR_P const error, FSTR_P const component); void onPrintTimerStarted(); void onPrintTimerPaused(); void onPrintTimerStopped(); diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 5b77e53947..aff7bb085f 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -663,9 +663,9 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; draw_status_screen(); } - void MarlinUI::kill_screen(PGM_P lcd_error, PGM_P lcd_component) { + void MarlinUI::kill_screen(FSTR_P const lcd_error, FSTR_P const lcd_component) { init(); - status_printf(1, F(S_FMT ": " S_FMT), lcd_error, lcd_component); + status_printf(1, F(S_FMT ": " S_FMT), FTOP(lcd_error), FTOP(lcd_component)); TERN_(HAS_LCD_MENU, return_to_status()); // RED ALERT. RED ALERT. diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index bc8442c576..883850d6e0 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -356,9 +356,9 @@ public: static void status_printf(const uint8_t level, FSTR_P const fmt, ...); #if EITHER(HAS_DISPLAY, DWIN_CREALITY_LCD_ENHANCED) - static void kill_screen(PGM_P const lcd_error, PGM_P const lcd_component); + static void kill_screen(FSTR_P const lcd_error, FSTR_P const lcd_component); #else - static inline void kill_screen(PGM_P const, PGM_P const) {} + static inline void kill_screen(FSTR_P const, FSTR_P const) {} #endif #if HAS_DISPLAY diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index 80e20a0778..da5a0073cf 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -384,7 +384,7 @@ void Endstops::not_homing() { // If the last move failed to trigger an endstop, call kill void Endstops::validate_homing_move() { if (trigger_state()) hit_on_purpose(); - else kill(GET_TEXT(MSG_KILL_HOMING_FAILED)); + else kill(GET_TEXT_F(MSG_KILL_HOMING_FAILED)); } #endif diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index c820ce3599..f5dd5d34c9 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -1832,7 +1832,7 @@ void prepare_line_to_destination() { } if (TEST(endstops.state(), es)) { SERIAL_ECHO_MSG("Bad ", AS_CHAR(AXIS_CHAR(axis)), " Endstop?"); - kill(GET_TEXT(MSG_KILL_HOMING_FAILED)); + kill(GET_TEXT_F(MSG_KILL_HOMING_FAILED)); } #endif diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index c6edfb835e..e62a9ab5ee 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -3036,7 +3036,7 @@ bool Planner::buffer_line(const xyze_pos_t &cart, const_feedRate_t fr_mm_s, cons void Planner::buffer_page(const page_idx_t page_idx, const uint8_t extruder, const uint16_t num_steps) { if (!last_page_step_rate) { - kill(GET_TEXT(MSG_BAD_PAGE_SPEED)); + kill(GET_TEXT_F(MSG_BAD_PAGE_SPEED)); return; } diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index f37d2aa03f..4078effe76 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -297,7 +297,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) { TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, F("Stow Probe"), FPSTR(CONTINUE_STR))); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("Stow Probe"))); - TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_Popup_Confirm(ICON_BLTouch, PSTR("Stow Probe"), CONTINUE_STR)); + TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_Popup_Confirm(ICON_BLTouch, F("Stow Probe"), FPSTR(CONTINUE_STR))); TERN_(HAS_RESUME_CONTINUE, wait_for_user_response()); ui.reset_status(); diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index a3ada25118..47941dffda 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -187,8 +187,8 @@ Temperature thermalManager; -const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY, - str_t_heating_failed[] PROGMEM = STR_T_HEATING_FAILED; +PGMSTR(str_t_thermal_runaway, STR_T_THERMAL_RUNAWAY); +PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED); /** * Macros to include the heater id in temp errors. The compiler's dead-code @@ -196,22 +196,22 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY, */ #if HAS_HEATED_BED - #define _BED_PSTR(h) (h) == H_BED ? GET_TEXT(MSG_BED) : + #define _BED_FSTR(h) (h) == H_BED ? GET_TEXT_F(MSG_BED) : #else - #define _BED_PSTR(h) + #define _BED_FSTR(h) #endif #if HAS_HEATED_CHAMBER - #define _CHAMBER_PSTR(h) (h) == H_CHAMBER ? GET_TEXT(MSG_CHAMBER) : + #define _CHAMBER_FSTR(h) (h) == H_CHAMBER ? GET_TEXT_F(MSG_CHAMBER) : #else - #define _CHAMBER_PSTR(h) + #define _CHAMBER_FSTR(h) #endif #if HAS_COOLER - #define _COOLER_PSTR(h) (h) == H_COOLER ? GET_TEXT(MSG_COOLER) : + #define _COOLER_FSTR(h) (h) == H_COOLER ? GET_TEXT_F(MSG_COOLER) : #else - #define _COOLER_PSTR(h) + #define _COOLER_FSTR(h) #endif -#define _E_PSTR(h,N) ((HOTENDS) > N && (h) == N) ? PSTR(LCD_STR_E##N) : -#define HEATER_PSTR(h) _BED_PSTR(h) _CHAMBER_PSTR(h) _COOLER_PSTR(h) _E_PSTR(h,1) _E_PSTR(h,2) _E_PSTR(h,3) _E_PSTR(h,4) _E_PSTR(h,5) PSTR(LCD_STR_E0) +#define _E_FSTR(h,N) ((HOTENDS) > N && (h) == N) ? F(LCD_STR_E##N) : +#define HEATER_FSTR(h) _BED_FSTR(h) _CHAMBER_FSTR(h) _COOLER_FSTR(h) _E_FSTR(h,1) _E_FSTR(h,2) _E_FSTR(h,3) _E_FSTR(h,4) _E_FSTR(h,5) F(LCD_STR_E0) // // Initialize MAX TC objects/SPI @@ -731,10 +731,10 @@ volatile bool Temperature::raw_temps_ready = false; if (current_temp > watch_temp_target) heated = true; // - Flag if target temperature reached } else if (ELAPSED(ms, temp_change_ms)) // Watch timer expired - _temp_error(heater_id, str_t_heating_failed, GET_TEXT(MSG_HEATING_FAILED_LCD)); + _temp_error(heater_id, FPSTR(str_t_heating_failed), GET_TEXT_F(MSG_HEATING_FAILED_LCD)); } else if (current_temp < target - (MAX_OVERSHOOT_PID_AUTOTUNE)) // Heated, then temperature fell too far? - _temp_error(heater_id, str_t_thermal_runaway, GET_TEXT(MSG_THERMAL_RUNAWAY)); + _temp_error(heater_id, FPSTR(str_t_thermal_runaway), GET_TEXT_F(MSG_THERMAL_RUNAWAY)); } #endif } // every 2 seconds @@ -951,7 +951,7 @@ int16_t Temperature::getHeaterPower(const heater_id_t heater_id) { // Temperature Error Handlers // -inline void loud_kill(PGM_P const lcd_msg, const heater_id_t heater_id) { +inline void loud_kill(FSTR_P const lcd_msg, const heater_id_t heater_id) { marlin_state = MF_KILLED; thermalManager.disable_all_heaters(); #if USE_BEEPER @@ -967,16 +967,16 @@ inline void loud_kill(PGM_P const lcd_msg, const heater_id_t heater_id) { } WRITE(BEEPER_PIN, HIGH); #endif - kill(lcd_msg, HEATER_PSTR(heater_id)); + kill(lcd_msg, HEATER_FSTR(heater_id)); } -void Temperature::_temp_error(const heater_id_t heater_id, PGM_P const serial_msg, PGM_P const lcd_msg) { +void Temperature::_temp_error(const heater_id_t heater_id, FSTR_P const serial_msg, FSTR_P const lcd_msg) { static uint8_t killed = 0; if (IsRunning() && TERN1(BOGUS_TEMPERATURE_GRACE_PERIOD, killed == 2)) { SERIAL_ERROR_START(); - SERIAL_ECHOPGM_P(serial_msg); + SERIAL_ECHOF(serial_msg); SERIAL_ECHOPGM(STR_STOPPED_HEATER); heater_id_t real_heater_id = heater_id; @@ -1031,14 +1031,14 @@ void Temperature::max_temp_error(const heater_id_t heater_id) { #if HAS_DWIN_E3V2_BASIC && (HAS_HOTEND || HAS_HEATED_BED) DWIN_Popup_Temperature(1); #endif - _temp_error(heater_id, PSTR(STR_T_MAXTEMP), GET_TEXT(MSG_ERR_MAXTEMP)); + _temp_error(heater_id, F(STR_T_MAXTEMP), GET_TEXT_F(MSG_ERR_MAXTEMP)); } void Temperature::min_temp_error(const heater_id_t heater_id) { #if HAS_DWIN_E3V2_BASIC && (HAS_HOTEND || HAS_HEATED_BED) DWIN_Popup_Temperature(0); #endif - _temp_error(heater_id, PSTR(STR_T_MINTEMP), GET_TEXT(MSG_ERR_MINTEMP)); + _temp_error(heater_id, F(STR_T_MINTEMP), GET_TEXT_F(MSG_ERR_MINTEMP)); } #if ANY(PID_DEBUG, PID_BED_DEBUG, PID_CHAMBER_DEBUG) @@ -1294,7 +1294,7 @@ void Temperature::manage_heater() { REMEMBER(mh, no_reentry, true); #if ENABLED(EMERGENCY_PARSER) - if (emergency_parser.killed_by_M112) kill(M112_KILL_STR, nullptr, true); + if (emergency_parser.killed_by_M112) kill(FPSTR(M112_KILL_STR), nullptr, true); if (emergency_parser.quickstop_by_M410) { emergency_parser.quickstop_by_M410 = false; // quickstop_stepper may call idle so clear this now! @@ -1344,7 +1344,7 @@ void Temperature::manage_heater() { start_watching_hotend(e); // If temp reached, turn off elapsed check else { TERN_(HAS_DWIN_E3V2_BASIC, DWIN_Popup_Temperature(0)); - _temp_error((heater_id_t)e, str_t_heating_failed, GET_TEXT(MSG_HEATING_FAILED_LCD)); + _temp_error((heater_id_t)e, FPSTR(str_t_heating_failed), GET_TEXT_F(MSG_HEATING_FAILED_LCD)); } } #endif @@ -1356,7 +1356,7 @@ void Temperature::manage_heater() { #if HAS_TEMP_REDUNDANT // Make sure measured temperatures are close together if (ABS(degRedundantTarget() - degRedundant()) > TEMP_SENSOR_REDUNDANT_MAX_DIFF) - _temp_error((heater_id_t)HEATER_ID(TEMP_SENSOR_REDUNDANT_TARGET), PSTR(STR_REDUNDANCY), GET_TEXT(MSG_ERR_REDUNDANT_TEMP)); + _temp_error((heater_id_t)HEATER_ID(TEMP_SENSOR_REDUNDANT_TARGET), F(STR_REDUNDANCY), GET_TEXT_F(MSG_ERR_REDUNDANT_TEMP)); #endif #if HAS_AUTO_FAN @@ -1387,7 +1387,7 @@ void Temperature::manage_heater() { start_watching_bed(); // If temp reached, turn off elapsed check else { TERN_(HAS_DWIN_E3V2_BASIC, DWIN_Popup_Temperature(0)); - _temp_error(H_BED, str_t_heating_failed, GET_TEXT(MSG_HEATING_FAILED_LCD)); + _temp_error(H_BED, FPSTR(str_t_heating_failed), GET_TEXT_F(MSG_HEATING_FAILED_LCD)); } } #endif // WATCH_BED @@ -1467,7 +1467,7 @@ void Temperature::manage_heater() { if (watch_chamber.check(degChamber())) // Increased enough? Error below. start_watching_chamber(); // If temp reached, turn off elapsed check. else - _temp_error(H_CHAMBER, str_t_heating_failed, GET_TEXT(MSG_HEATING_FAILED_LCD)); + _temp_error(H_CHAMBER, FPSTR(str_t_heating_failed), GET_TEXT_F(MSG_HEATING_FAILED_LCD)); } #endif @@ -1589,7 +1589,7 @@ void Temperature::manage_heater() { // Make sure temperature is decreasing if (watch_cooler.elapsed(ms)) { // Time to check the cooler? if (degCooler() > watch_cooler.target) // Failed to decrease enough? - _temp_error(H_COOLER, GET_TEXT(MSG_COOLING_FAILED), GET_TEXT(MSG_COOLING_FAILED)); + _temp_error(H_COOLER, GET_TEXT_F(MSG_COOLING_FAILED), GET_TEXT_F(MSG_COOLING_FAILED)); else start_watching_cooler(); // Start again if the target is still far off } @@ -2597,7 +2597,7 @@ void Temperature::init() { case TRRunaway: TERN_(HAS_DWIN_E3V2_BASIC, DWIN_Popup_Temperature(0)); - _temp_error(heater_id, str_t_thermal_runaway, GET_TEXT(MSG_THERMAL_RUNAWAY)); + _temp_error(heater_id, FPSTR(str_t_thermal_runaway), GET_TEXT_F(MSG_THERMAL_RUNAWAY)); } } @@ -3896,7 +3896,7 @@ void Temperature::isr() { const bool wants_to_cool = isProbeAboveTemp(target_temp), will_wait = !(wants_to_cool && no_wait_for_cooling); if (will_wait) - SERIAL_ECHOLNPGM("Waiting for probe to ", (wants_to_cool ? PSTR("cool down") : PSTR("heat up")), " to ", target_temp, " degrees."); + SERIAL_ECHOLNPGM("Waiting for probe to ", wants_to_cool ? F("cool down") : F("heat up"), " to ", target_temp, " degrees."); #if DISABLED(BUSY_WHILE_HEATING) && ENABLED(HOST_KEEPALIVE_FEATURE) KEEPALIVE_STATE(NOT_BUSY); diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 1675507f86..5579f71172 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -961,7 +961,7 @@ class Temperature { static float get_pid_output_chamber(); #endif - static void _temp_error(const heater_id_t e, PGM_P const serial_msg, PGM_P const lcd_msg); + static void _temp_error(const heater_id_t e, FSTR_P const serial_msg, FSTR_P const lcd_msg); static void min_temp_error(const heater_id_t e); static void max_temp_error(const heater_id_t e); diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index 2f387abad4..285b4cba84 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -432,7 +432,7 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0. } else if (kill_on_error && (!tool_sensor_disabled || disable)) { sensor_tries++; - if (sensor_tries > 10) kill(PSTR("Tool Sensor error")); + if (sensor_tries > 10) kill(F("Tool Sensor error")); safe_delay(5); } else { diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 6b8d2338c1..1ab6dcc7c6 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -646,7 +646,7 @@ void CardReader::openFileRead(const char * const path, const uint8_t subcall_typ // Too deep? The firmware has to bail. if (file_subcall_ctr > SD_PROCEDURE_DEPTH - 1) { SERIAL_ERROR_MSG("Exceeded max SUBROUTINE depth:", SD_PROCEDURE_DEPTH); - kill(GET_TEXT(MSG_KILL_SUBCALL_OVERFLOW)); + kill(GET_TEXT_F(MSG_KILL_SUBCALL_OVERFLOW)); return; }