From 360311f2320d6e5a94d17c6ff830146675be732e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 25 Sep 2021 17:05:11 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Apply=20F()=20to=20status=20mess?= =?UTF-8?q?age?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/MarlinCore.cpp | 10 +-- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 38 +++++------ Marlin/src/feature/cancel_object.cpp | 2 +- Marlin/src/feature/hotend_idle.cpp | 2 +- Marlin/src/feature/mmu/mmu2.cpp | 24 +++---- Marlin/src/feature/pause.cpp | 4 +- Marlin/src/feature/stepper_driver_safety.cpp | 2 +- Marlin/src/feature/tmc_util.cpp | 2 +- Marlin/src/gcode/bedlevel/G26.cpp | 14 ++-- Marlin/src/gcode/bedlevel/abl/G29.cpp | 4 +- Marlin/src/gcode/bedlevel/mbl/G29.cpp | 4 +- Marlin/src/gcode/calibrate/G28.cpp | 2 +- Marlin/src/gcode/calibrate/G33.cpp | 6 +- Marlin/src/gcode/calibrate/G34_M422.cpp | 8 +-- Marlin/src/gcode/calibrate/G76_M192_M871.cpp | 2 +- Marlin/src/gcode/calibrate/M48.cpp | 6 +- Marlin/src/gcode/control/M17_M18_M84.cpp | 2 +- Marlin/src/gcode/control/M80_M81.cpp | 4 +- Marlin/src/gcode/geometry/M206_M428.cpp | 4 +- Marlin/src/gcode/lcd/M0_M1.cpp | 2 +- Marlin/src/gcode/motion/G4.cpp | 2 +- Marlin/src/gcode/queue.cpp | 2 +- Marlin/src/gcode/temp/M140_M190.cpp | 2 +- Marlin/src/gcode/temp/M141_M191.cpp | 2 +- Marlin/src/gcode/temp/M143_M193.cpp | 2 +- Marlin/src/gcode/temp/M303.cpp | 2 +- Marlin/src/lcd/e3v2/creality/dwin.cpp | 12 ++-- Marlin/src/lcd/e3v2/creality/dwin.h | 4 +- Marlin/src/lcd/e3v2/enhanced/dwin.cpp | 58 ++++++++--------- Marlin/src/lcd/e3v2/enhanced/dwin.h | 6 +- Marlin/src/lcd/e3v2/enhanced/meshviewer.cpp | 2 +- Marlin/src/lcd/extui/mks_ui/wifi_module.cpp | 2 +- Marlin/src/lcd/marlinui.cpp | 65 ++++++++++--------- Marlin/src/lcd/marlinui.h | 23 +++---- Marlin/src/lcd/menu/menu_advanced.cpp | 2 +- Marlin/src/lcd/menu/menu_mixer.cpp | 2 +- Marlin/src/lcd/menu/menu_mmu2.cpp | 8 +-- Marlin/src/module/endstops.cpp | 4 +- Marlin/src/module/probe.cpp | 12 ++-- Marlin/src/module/settings.cpp | 6 +- Marlin/src/module/temperature.cpp | 14 ++-- Marlin/src/module/tool_change.cpp | 4 +- Marlin/src/sd/cardreader.cpp | 2 +- .../sd/usb_flashdrive/Sd2Card_FlashDrive.cpp | 10 +-- 44 files changed, 194 insertions(+), 196 deletions(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 6309f9f0d5..8a15c45f83 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -474,7 +474,7 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) { if (!IS_SD_PRINTING() && !READ(HOME_PIN)) { // HOME_PIN goes LOW when pressed if (ELAPSED(ms, next_home_key_ms)) { next_home_key_ms = ms + HOME_DEBOUNCE_DELAY; - LCD_MESSAGEPGM(MSG_AUTO_HOME); + LCD_MESSAGE(MSG_AUTO_HOME); queue.inject_P(G28_STR); } } @@ -499,8 +499,8 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) { } \ }while(0) - #define CHECK_CUSTOM_USER_BUTTON(N) _CHECK_CUSTOM_USER_BUTTON(N, NOOP) - #define CHECK_BETTER_USER_BUTTON(N) _CHECK_CUSTOM_USER_BUTTON(N, if (strlen(BUTTON##N##_DESC)) LCD_MESSAGEPGM_P(PSTR(BUTTON##N##_DESC))) + #define CHECK_CUSTOM_USER_BUTTON(N) _CHECK_CUSTOM_USER_BUTTON(N, NOOP) + #define CHECK_BETTER_USER_BUTTON(N) _CHECK_CUSTOM_USER_BUTTON(N, if (strlen(BUTTON##N##_DESC)) LCD_MESSAGE_F(BUTTON##N##_DESC)) #if HAS_BETTER_USER_BUTTON(1) CHECK_BETTER_USER_BUTTON(1); @@ -935,7 +935,7 @@ void stop() { if (!IsStopped()) { SERIAL_ERROR_MSG(STR_ERR_STOPPED); - LCD_MESSAGEPGM(MSG_STOPPED); + LCD_MESSAGE(MSG_STOPPED); safe_delay(350); // allow enough time for messages to get out before stopping marlin_state = MF_STOPPED; } @@ -1551,7 +1551,7 @@ void setup() { HMI_Init(); HMI_SetLanguageCache(); HMI_StartFrame(true); - DWIN_StatusChanged_P(GET_TEXT(WELCOME_MSG)); + DWIN_StatusChanged(GET_TEXT_F(WELCOME_MSG)); #endif #if HAS_SERVICE_INTERVALS && !HAS_DWIN_E3V2_BASIC diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index 9b85b5b972..051cb6a4d6 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -736,7 +736,7 @@ void unified_bed_leveling::shift_mesh_height() { const uint8_t point_num = (GRID_MAX_POINTS - count) + 1; SERIAL_ECHOLNPGM("Probing mesh point ", point_num, "/", GRID_MAX_POINTS, "."); - TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_POINT), point_num, int(GRID_MAX_POINTS))); + TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_POINT), point_num, int(GRID_MAX_POINTS))); #if HAS_LCD_MENU if (ui.button_pressed()) { @@ -789,12 +789,12 @@ void unified_bed_leveling::shift_mesh_height() { #endif // HAS_BED_PROBE -void set_message_with_feedback(PGM_P const msg_P) { +void set_message_with_feedback(FSTR_P const fstr) { #if HAS_LCD_MENU - ui.set_status_P(msg_P); + ui.set_status(fstr); ui.quick_feedback(); #else - UNUSED(msg_P); + UNUSED(fstr); #endif } @@ -850,7 +850,7 @@ void set_message_with_feedback(PGM_P const msg_P) { planner.synchronize(); SERIAL_ECHOPGM("Place shim under nozzle"); - LCD_MESSAGEPGM(MSG_UBL_BC_INSERT); + LCD_MESSAGE(MSG_UBL_BC_INSERT); ui.return_to_status(); echo_and_take_a_measurement(); @@ -859,7 +859,7 @@ void set_message_with_feedback(PGM_P const msg_P) { planner.synchronize(); SERIAL_ECHOPGM("Remove shim"); - LCD_MESSAGEPGM(MSG_UBL_BC_REMOVE); + LCD_MESSAGE(MSG_UBL_BC_REMOVE); echo_and_take_a_measurement(); const float z2 = measure_point_with_encoder(); @@ -905,7 +905,7 @@ void set_message_with_feedback(PGM_P const msg_P) { if (!position_is_reachable(ppos)) break; // SHOULD NOT OCCUR (find_closest_mesh_point only returns reachable points) - LCD_MESSAGEPGM(MSG_UBL_MOVING_TO_NEXT); + LCD_MESSAGE(MSG_UBL_MOVING_TO_NEXT); do_blocking_move_to(ppos); do_z_clearance(z_clearance); @@ -917,11 +917,11 @@ void set_message_with_feedback(PGM_P const msg_P) { if (parser.seen_test('B')) { SERIAL_ECHOPGM("Place Shim & Measure"); - LCD_MESSAGEPGM(MSG_UBL_BC_INSERT); + LCD_MESSAGE(MSG_UBL_BC_INSERT); } else { SERIAL_ECHOPGM("Measure"); - LCD_MESSAGEPGM(MSG_UBL_BC_INSERT2); + LCD_MESSAGE(MSG_UBL_BC_INSERT2); } const float z_step = 0.01f; // 0.01mm per encoder tick, occasionally step @@ -974,7 +974,7 @@ void set_message_with_feedback(PGM_P const msg_P) { save_ubl_active_state_and_disable(); - LCD_MESSAGEPGM(MSG_UBL_FINE_TUNE_MESH); + LCD_MESSAGE(MSG_UBL_FINE_TUNE_MESH); ui.capture(); // Take over control of the LCD encoder do_blocking_move_to_xy_z(pos, Z_CLEARANCE_BETWEEN_PROBES); // Move to the given XY with probe clearance @@ -1039,7 +1039,7 @@ void set_message_with_feedback(PGM_P const msg_P) { if (_click_and_hold([]{ ui.return_to_status(); do_z_clearance(Z_CLEARANCE_BETWEEN_PROBES); - set_message_with_feedback(GET_TEXT(MSG_EDITING_STOPPED)); + set_message_with_feedback(GET_TEXT_F(MSG_EDITING_STOPPED)); })) break; // TODO: Disable leveling here so the Z value becomes the 'native' Z value. @@ -1060,7 +1060,7 @@ void set_message_with_feedback(PGM_P const msg_P) { do_blocking_move_to_xy_z(pos, Z_CLEARANCE_BETWEEN_PROBES); - LCD_MESSAGEPGM(MSG_UBL_DONE_EDITING_MESH); + LCD_MESSAGE(MSG_UBL_DONE_EDITING_MESH); SERIAL_ECHOLNPGM("Done Editing Mesh"); if (lcd_map_control) @@ -1077,7 +1077,7 @@ void set_message_with_feedback(PGM_P const msg_P) { bool unified_bed_leveling::G29_parse_parameters() { bool err_flag = false; - set_message_with_feedback(GET_TEXT(MSG_UBL_DOING_G29)); + set_message_with_feedback(GET_TEXT_F(MSG_UBL_DOING_G29)); param.C_constant = 0; param.R_repetition = 0; @@ -1200,7 +1200,7 @@ void unified_bed_leveling::save_ubl_active_state_and_disable() { ubl_state_recursion_chk++; if (ubl_state_recursion_chk != 1) { SERIAL_ECHOLNPGM("save_ubl_active_state_and_disabled() called multiple times in a row."); - set_message_with_feedback(GET_TEXT(MSG_UBL_SAVE_ERROR)); + set_message_with_feedback(GET_TEXT_F(MSG_UBL_SAVE_ERROR)); return; } #endif @@ -1213,7 +1213,7 @@ void unified_bed_leveling::restore_ubl_active_state_and_leave() { #if ENABLED(UBL_DEVEL_DEBUGGING) if (--ubl_state_recursion_chk) { SERIAL_ECHOLNPGM("restore_ubl_active_state_and_leave() called too many times."); - set_message_with_feedback(GET_TEXT(MSG_UBL_RESTORE_ERROR)); + set_message_with_feedback(GET_TEXT_F(MSG_UBL_RESTORE_ERROR)); return; } #endif @@ -1438,7 +1438,7 @@ void unified_bed_leveling::smart_fill_mesh() { if (do_3_pt_leveling) { SERIAL_ECHOLNPGM("Tilting mesh (1/3)"); - TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " 1/3"), GET_TEXT(MSG_LCD_TILTING_MESH))); + TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " 1/3"), GET_TEXT(MSG_LCD_TILTING_MESH))); measured_z = probe.probe_at_point(points[0], PROBE_PT_RAISE, param.V_verbosity); if (isnan(measured_z)) @@ -1457,7 +1457,7 @@ void unified_bed_leveling::smart_fill_mesh() { if (!abort_flag) { SERIAL_ECHOLNPGM("Tilting mesh (2/3)"); - TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " 2/3"), GET_TEXT(MSG_LCD_TILTING_MESH))); + TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " 2/3"), GET_TEXT(MSG_LCD_TILTING_MESH))); measured_z = probe.probe_at_point(points[1], PROBE_PT_RAISE, param.V_verbosity); #ifdef VALIDATE_MESH_TILT @@ -1477,7 +1477,7 @@ void unified_bed_leveling::smart_fill_mesh() { if (!abort_flag) { SERIAL_ECHOLNPGM("Tilting mesh (3/3)"); - TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " 3/3"), GET_TEXT(MSG_LCD_TILTING_MESH))); + TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " 3/3"), GET_TEXT(MSG_LCD_TILTING_MESH))); measured_z = probe.probe_at_point(points[2], PROBE_PT_LAST_STOW, param.V_verbosity); #ifdef VALIDATE_MESH_TILT @@ -1518,7 +1518,7 @@ void unified_bed_leveling::smart_fill_mesh() { if (!abort_flag) { SERIAL_ECHOLNPGM("Tilting mesh point ", point_num, "/", total_points, "\n"); - TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_LCD_TILTING_MESH), point_num, total_points)); + TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " %i/%i"), GET_TEXT(MSG_LCD_TILTING_MESH), point_num, total_points)); measured_z = probe.probe_at_point(rpos, parser.seen_test('E') ? PROBE_PT_STOW : PROBE_PT_RAISE, param.V_verbosity); // TODO: Needs error handling diff --git a/Marlin/src/feature/cancel_object.cpp b/Marlin/src/feature/cancel_object.cpp index 9d50bfc0d4..bffd2bb720 100644 --- a/Marlin/src/feature/cancel_object.cpp +++ b/Marlin/src/feature/cancel_object.cpp @@ -46,7 +46,7 @@ void CancelObject::set_active_object(const int8_t obj) { #if BOTH(HAS_STATUS_MESSAGE, CANCEL_OBJECTS_REPORTING) if (active_object >= 0) - ui.status_printf_P(0, PSTR(S_FMT " %i"), GET_TEXT(MSG_PRINTING_OBJECT), int(active_object)); + ui.status_printf(0, F(S_FMT " %i"), GET_TEXT(MSG_PRINTING_OBJECT), int(active_object)); else ui.reset_status(); #endif diff --git a/Marlin/src/feature/hotend_idle.cpp b/Marlin/src/feature/hotend_idle.cpp index b962743ed0..4b137f42da 100644 --- a/Marlin/src/feature/hotend_idle.cpp +++ b/Marlin/src/feature/hotend_idle.cpp @@ -77,7 +77,7 @@ void HotendIdleProtection::check() { void HotendIdleProtection::timed_out() { next_protect_ms = 0; SERIAL_ECHOLNPGM("Hotend Idle Timeout"); - LCD_MESSAGEPGM(MSG_HOTEND_IDLE_TIMEOUT); + LCD_MESSAGE(MSG_HOTEND_IDLE_TIMEOUT); HOTEND_LOOP() { if ((HOTEND_IDLE_NOZZLE_TARGET) < thermalManager.degTargetHotend(e)) thermalManager.setTargetHotend(HOTEND_IDLE_NOZZLE_TARGET, e); diff --git a/Marlin/src/feature/mmu/mmu2.cpp b/Marlin/src/feature/mmu/mmu2.cpp index d9a4c07d57..7362530e35 100644 --- a/Marlin/src/feature/mmu/mmu2.cpp +++ b/Marlin/src/feature/mmu/mmu2.cpp @@ -451,7 +451,7 @@ void MMU2::check_version() { } static void mmu2_not_responding() { - LCD_MESSAGEPGM(MSG_MMU2_NOT_RESPONDING); + LCD_MESSAGE(MSG_MMU2_NOT_RESPONDING); BUZZ(100, 659); BUZZ(200, 698); BUZZ(100, 659); @@ -487,7 +487,7 @@ static void mmu2_not_responding() { if (index != extruder) { stepper.disable_extruder(); - ui.status_printf_P(0, GET_TEXT(MSG_MMU2_LOADING_FILAMENT), int(index + 1)); + ui.status_printf(0, GET_TEXT_F(MSG_MMU2_LOADING_FILAMENT), int(index + 1)); command(MMU_CMD_T0 + index); manage_response(true, true); @@ -573,7 +573,7 @@ static void mmu2_not_responding() { command(MMU_CMD_U0); manage_response(true, true); } - ui.status_printf_P(0, GET_TEXT(MSG_MMU2_LOADING_FILAMENT), int(index + 1)); + ui.status_printf(0, GET_TEXT_F(MSG_MMU2_LOADING_FILAMENT), int(index + 1)); mmu_loading_flag = true; command(MMU_CMD_T0 + index); manage_response(true, true); @@ -671,7 +671,7 @@ static void mmu2_not_responding() { if (index != extruder) { stepper.disable_extruder(); - ui.status_printf_P(0, GET_TEXT(MSG_MMU2_LOADING_FILAMENT), int(index + 1)); + ui.status_printf(0, GET_TEXT_F(MSG_MMU2_LOADING_FILAMENT), int(index + 1)); command(MMU_CMD_T0 + index); manage_response(true, true); command(MMU_CMD_C0); @@ -808,14 +808,14 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) { if (turn_off_nozzle && resume_hotend_temp) { thermalManager.setTargetHotend(resume_hotend_temp, active_extruder); - LCD_MESSAGEPGM(MSG_HEATING); + LCD_MESSAGE(MSG_HEATING); BUZZ(200, 40); while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(1000); } if (move_axes && all_axes_homed()) { - LCD_MESSAGEPGM(MSG_MMU2_RESUMING); + LCD_MESSAGE(MSG_MMU2_RESUMING); BUZZ(198, 404); BUZZ(4, 0); BUZZ(198, 404); // Move XY to starting position, then Z @@ -826,7 +826,7 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) { } else { BUZZ(198, 404); BUZZ(4, 0); BUZZ(198, 404); - LCD_MESSAGEPGM(MSG_MMU2_RESUMING); + LCD_MESSAGE(MSG_MMU2_RESUMING); } } } @@ -908,7 +908,7 @@ bool MMU2::load_filament_to_nozzle(const uint8_t index) { if (thermalManager.tooColdToExtrude(active_extruder)) { BUZZ(200, 404); - LCD_ALERTMESSAGEPGM(MSG_HOTEND_TOO_COLD); + LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD); return false; } @@ -944,11 +944,11 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) { if (thermalManager.tooColdToExtrude(active_extruder)) { BUZZ(200, 404); - LCD_ALERTMESSAGEPGM(MSG_HOTEND_TOO_COLD); + LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD); return false; } - LCD_MESSAGEPGM(MSG_MMU2_EJECTING_FILAMENT); + LCD_MESSAGE(MSG_MMU2_EJECTING_FILAMENT); stepper.enable_extruder(); current_position.e -= MMU2_FILAMENTCHANGE_EJECT_FEED; @@ -958,7 +958,7 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) { manage_response(false, false); if (recover) { - LCD_MESSAGEPGM(MSG_MMU2_EJECT_RECOVER); + LCD_MESSAGE(MSG_MMU2_EJECT_RECOVER); BUZZ(200, 404); TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("MMU2 Eject Recover"), CONTINUE_STR)); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("MMU2 Eject Recover"))); @@ -993,7 +993,7 @@ bool MMU2::unload() { if (thermalManager.tooColdToExtrude(active_extruder)) { BUZZ(200, 404); - LCD_ALERTMESSAGEPGM(MSG_HOTEND_TOO_COLD); + LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD); return false; } diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 28f5caa3cb..75255d87ac 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -538,7 +538,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged_P(GET_TEXT(MSG_REHEATING))); - TERN_(DWIN_CREALITY_LCD_ENHANCED, ui.set_status_P(GET_TEXT(MSG_REHEATING))); + TERN_(DWIN_CREALITY_LCD_ENHANCED, LCD_MESSAGE(MSG_REHEATING)); // Re-enable the heaters if they timed out HOTEND_LOOP() thermalManager.reset_hotend_idle_timer(e); @@ -556,7 +556,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_REHEATDONE), CONTINUE_STR)); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_REHEATDONE))); - TERN_(DWIN_CREALITY_LCD_ENHANCED, ui.set_status_P(GET_TEXT(MSG_REHEATDONE))); + TERN_(DWIN_CREALITY_LCD_ENHANCED, LCD_MESSAGE(MSG_REHEATDONE)); IF_DISABLED(PAUSE_REHEAT_FAST_RESUME, wait_for_user = true); diff --git a/Marlin/src/feature/stepper_driver_safety.cpp b/Marlin/src/feature/stepper_driver_safety.cpp index c7da5d2ff7..8ba0968cd2 100644 --- a/Marlin/src/feature/stepper_driver_safety.cpp +++ b/Marlin/src/feature/stepper_driver_safety.cpp @@ -32,7 +32,7 @@ void stepper_driver_backward_error(PGM_P str) { SERIAL_ERROR_START(); SERIAL_ECHOPGM_P(str); SERIAL_ECHOLNPGM(" driver is backward!"); - ui.status_printf_P(2, PSTR(S_FMT S_FMT), str, GET_TEXT(MSG_DRIVER_BACKWARD)); + ui.status_printf(2, F(S_FMT S_FMT), str, GET_TEXT(MSG_DRIVER_BACKWARD)); } void stepper_driver_backward_check() { diff --git a/Marlin/src/feature/tmc_util.cpp b/Marlin/src/feature/tmc_util.cpp index 6848d81003..c11d2e5f6d 100644 --- a/Marlin/src/feature/tmc_util.cpp +++ b/Marlin/src/feature/tmc_util.cpp @@ -1341,7 +1341,7 @@ void test_tmc_connection(LOGICAL_AXIS_ARGS(const bool)) { #endif } - if (axis_connection) LCD_MESSAGEPGM(MSG_ERROR_TMC); + if (axis_connection) LCD_MESSAGE(MSG_ERROR_TMC); } #endif // HAS_TRINAMIC_CONFIG diff --git a/Marlin/src/gcode/bedlevel/G26.cpp b/Marlin/src/gcode/bedlevel/G26.cpp index ba14e6f0b4..e111bcd8aa 100644 --- a/Marlin/src/gcode/bedlevel/G26.cpp +++ b/Marlin/src/gcode/bedlevel/G26.cpp @@ -163,7 +163,7 @@ float g26_random_deviation = 0.0; */ bool user_canceled() { if (!ui.button_pressed()) return false; // Return if the button isn't pressed - ui.set_status_P(GET_TEXT(MSG_G26_CANCELED), 99); + ui.set_status(GET_TEXT_F(MSG_G26_CANCELED), 99); TERN_(HAS_LCD_MENU, ui.quick_feedback()); ui.wait_for_release(); return true; @@ -323,7 +323,7 @@ typedef struct { if (bed_temp > 25) { #if HAS_WIRED_LCD - ui.set_status_P(GET_TEXT(MSG_G26_HEATING_BED), 99); + ui.set_status(GET_TEXT_F(MSG_G26_HEATING_BED), 99); ui.quick_feedback(); TERN_(HAS_LCD_MENU, ui.capture()); #endif @@ -342,7 +342,7 @@ typedef struct { // Start heating the active nozzle #if HAS_WIRED_LCD - ui.set_status_P(GET_TEXT(MSG_G26_HEATING_NOZZLE), 99); + ui.set_status(GET_TEXT_F(MSG_G26_HEATING_NOZZLE), 99); ui.quick_feedback(); #endif thermalManager.setTargetHotend(hotend_temp, active_extruder); @@ -372,7 +372,7 @@ typedef struct { if (prime_flag == -1) { // The user wants to control how much filament gets purged ui.capture(); - ui.set_status_P(GET_TEXT(MSG_G26_MANUAL_PRIME), 99); + ui.set_status(GET_TEXT_F(MSG_G26_MANUAL_PRIME), 99); ui.chirp(); destination = current_position; @@ -399,7 +399,7 @@ typedef struct { ui.wait_for_release(); - ui.set_status_P(GET_TEXT(MSG_G26_PRIME_DONE), 99); + ui.set_status(GET_TEXT_F(MSG_G26_PRIME_DONE), 99); ui.quick_feedback(); ui.release(); } @@ -407,7 +407,7 @@ typedef struct { #endif { #if HAS_WIRED_LCD - ui.set_status_P(GET_TEXT(MSG_G26_FIXED_LENGTH), 99); + ui.set_status(GET_TEXT_F(MSG_G26_FIXED_LENGTH), 99); ui.quick_feedback(); #endif destination = current_position; @@ -854,7 +854,7 @@ void GcodeSuite::G26() { } while (--g26_repeats && location.valid()); LEAVE: - ui.set_status_P(GET_TEXT(MSG_G26_LEAVING), -1); + ui.set_status(GET_TEXT_F(MSG_G26_LEAVING), -1); TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(location, ExtUI::G26_FINISH)); g26.retract_filament(destination); diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 03b0450c6b..07aefe8aed 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -636,7 +636,7 @@ G29_TYPE GcodeSuite::G29() { if (TERN0(IS_KINEMATIC, !probe.can_reach(abl.probePos))) continue; if (abl.verbose_level) SERIAL_ECHOLNPGM("Probing mesh point ", pt_index, "/", abl.abl_points, "."); - TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_POINT), int(pt_index), int(abl.abl_points))); + TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_POINT), int(pt_index), int(abl.abl_points))); abl.measured_z = faux ? 0.001f * random(-100, 101) : probe.probe_at_point(abl.probePos, raise_after, abl.verbose_level); @@ -681,7 +681,7 @@ G29_TYPE GcodeSuite::G29() { LOOP_L_N(i, 3) { if (abl.verbose_level) SERIAL_ECHOLNPGM("Probing point ", i + 1, "/3."); - TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " %i/3"), GET_TEXT(MSG_PROBING_POINT), int(i + 1))); + TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " %i/3"), GET_TEXT(MSG_PROBING_POINT), int(i + 1))); // Retain the last probe position abl.probePos = xy_pos_t(points[i]); diff --git a/Marlin/src/gcode/bedlevel/mbl/G29.cpp b/Marlin/src/gcode/bedlevel/mbl/G29.cpp index 930953ea14..eec89f73ac 100644 --- a/Marlin/src/gcode/bedlevel/mbl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/mbl/G29.cpp @@ -152,7 +152,7 @@ void GcodeSuite::G29() { // After recording the last point, activate home and activate mbl_probe_index = -1; SERIAL_ECHOLNPGM("Mesh probing done."); - TERN_(HAS_STATUS_MESSAGE, ui.set_status(GET_TEXT(MSG_MESH_DONE))); + TERN_(HAS_STATUS_MESSAGE, LCD_MESSAGE(MSG_MESH_DONE)); BUZZ(100, 659); BUZZ(100, 698); @@ -214,7 +214,7 @@ void GcodeSuite::G29() { if (state == MeshNext) { SERIAL_ECHOLNPGM("MBL G29 point ", _MIN(mbl_probe_index, GRID_MAX_POINTS), " of ", GRID_MAX_POINTS); - if (mbl_probe_index > 0) TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_POINT), _MIN(mbl_probe_index, GRID_MAX_POINTS), int(GRID_MAX_POINTS))); + if (mbl_probe_index > 0) TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_POINT), _MIN(mbl_probe_index, GRID_MAX_POINTS), int(GRID_MAX_POINTS))); } report_current_position(); diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index 01c6050155..1c7e839f45 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -156,7 +156,7 @@ homeaxis(Z_AXIS); } else { - LCD_MESSAGEPGM(MSG_ZPROBE_OUT); + LCD_MESSAGE(MSG_ZPROBE_OUT); SERIAL_ECHO_MSG(STR_ZPROBE_OUT_SER); } } diff --git a/Marlin/src/gcode/calibrate/G33.cpp b/Marlin/src/gcode/calibrate/G33.cpp index 24a985299f..4ac25c2cf1 100644 --- a/Marlin/src/gcode/calibrate/G33.cpp +++ b/Marlin/src/gcode/calibrate/G33.cpp @@ -477,11 +477,11 @@ void GcodeSuite::G33() { SERIAL_ECHOLNPGM("G33 Auto Calibrate"); // Report settings - PGM_P const checkingac = PSTR("Checking... AC"); - SERIAL_ECHOPGM_P(checkingac); + FSTR_P const checkingac = F("Checking... AC"); + SERIAL_ECHOF(checkingac); if (verbose_level == 0) SERIAL_ECHOPGM(" (DRY-RUN)"); SERIAL_EOL(); - ui.set_status_P(checkingac); + ui.set_status(checkingac); print_calibration_settings(_endstop_results, _angle_results); diff --git a/Marlin/src/gcode/calibrate/G34_M422.cpp b/Marlin/src/gcode/calibrate/G34_M422.cpp index 63d839c847..25855e6a4e 100644 --- a/Marlin/src/gcode/calibrate/G34_M422.cpp +++ b/Marlin/src/gcode/calibrate/G34_M422.cpp @@ -31,7 +31,7 @@ #include "../../module/stepper.h" #include "../../module/planner.h" #include "../../module/probe.h" -#include "../../lcd/marlinui.h" // for LCD_MESSAGEPGM +#include "../../lcd/marlinui.h" // for LCD_MESSAGE #if HAS_LEVELING #include "../../feature/bedlevel/bedlevel.h" @@ -229,7 +229,7 @@ void GcodeSuite::G34() { const float z_probed_height = probe.probe_at_point(z_stepper_align.xy[iprobe], raise_after, 0, true, false); if (isnan(z_probed_height)) { SERIAL_ECHOLNPGM("Probing failed"); - LCD_MESSAGEPGM(MSG_LCD_PROBING_FAILED); + LCD_MESSAGE(MSG_LCD_PROBING_FAILED); err_break = true; break; } @@ -328,7 +328,7 @@ void GcodeSuite::G34() { auto decreasing_accuracy = [](const_float_t v1, const_float_t v2) { if (v1 < v2 * 0.7f) { SERIAL_ECHOLNPGM("Decreasing Accuracy Detected."); - LCD_MESSAGEPGM(MSG_DECREASING_ACCURACY); + LCD_MESSAGE(MSG_DECREASING_ACCURACY); return true; } return false; @@ -411,7 +411,7 @@ void GcodeSuite::G34() { if (success_break) { SERIAL_ECHOLNPGM("Target accuracy achieved."); - LCD_MESSAGEPGM(MSG_ACCURACY_ACHIEVED); + LCD_MESSAGE(MSG_ACCURACY_ACHIEVED); break; } diff --git a/Marlin/src/gcode/calibrate/G76_M192_M871.cpp b/Marlin/src/gcode/calibrate/G76_M192_M871.cpp index 0fcd686a06..0fc41ed929 100644 --- a/Marlin/src/gcode/calibrate/G76_M192_M871.cpp +++ b/Marlin/src/gcode/calibrate/G76_M192_M871.cpp @@ -351,7 +351,7 @@ void GcodeSuite::M192() { } const celsius_t target_temp = parser.value_celsius(); - ui.set_status_P(thermalManager.isProbeBelowTemp(target_temp) ? GET_TEXT(MSG_PROBE_HEATING) : GET_TEXT(MSG_PROBE_COOLING)); + ui.set_status(thermalManager.isProbeBelowTemp(target_temp) ? GET_TEXT_F(MSG_PROBE_HEATING) : GET_TEXT_F(MSG_PROBE_COOLING)); thermalManager.wait_for_probe(target_temp, no_wait_for_cooling); } diff --git a/Marlin/src/gcode/calibrate/M48.cpp b/Marlin/src/gcode/calibrate/M48.cpp index 9db90c76ac..913ffe30d4 100644 --- a/Marlin/src/gcode/calibrate/M48.cpp +++ b/Marlin/src/gcode/calibrate/M48.cpp @@ -79,7 +79,7 @@ void GcodeSuite::M48() { }; if (!probe.can_reach(test_position)) { - ui.set_status_P(GET_TEXT(MSG_M48_OUT_OF_BOUNDS), 99); + ui.set_status(GET_TEXT_F(MSG_M48_OUT_OF_BOUNDS), 99); SERIAL_ECHOLNPGM("? (X,Y) out of bounds."); return; } @@ -144,7 +144,7 @@ void GcodeSuite::M48() { LOOP_L_N(n, n_samples) { #if HAS_STATUS_MESSAGE // Display M48 progress in the status bar - ui.status_printf_P(0, PSTR(S_FMT ": %d/%d"), GET_TEXT(MSG_M48_POINT), int(n + 1), int(n_samples)); + ui.status_printf(0, F(S_FMT ": %d/%d"), GET_TEXT(MSG_M48_POINT), int(n + 1), int(n_samples)); #endif // When there are "legs" of movement move around the point before probing @@ -260,7 +260,7 @@ void GcodeSuite::M48() { #if HAS_STATUS_MESSAGE // Display M48 results in the status bar char sigma_str[8]; - ui.status_printf_P(0, PSTR(S_FMT ": %s"), GET_TEXT(MSG_M48_DEVIATION), dtostrf(sigma, 2, 6, sigma_str)); + ui.status_printf(0, F(S_FMT ": %s"), GET_TEXT(MSG_M48_DEVIATION), dtostrf(sigma, 2, 6, sigma_str)); #endif } diff --git a/Marlin/src/gcode/control/M17_M18_M84.cpp b/Marlin/src/gcode/control/M17_M18_M84.cpp index 82df20ac45..4683786f1f 100644 --- a/Marlin/src/gcode/control/M17_M18_M84.cpp +++ b/Marlin/src/gcode/control/M17_M18_M84.cpp @@ -136,7 +136,7 @@ void GcodeSuite::M17() { } } else { - LCD_MESSAGEPGM(MSG_NO_MOVE); + LCD_MESSAGE(MSG_NO_MOVE); stepper.enable_all_steppers(); } } diff --git a/Marlin/src/gcode/control/M80_M81.cpp b/Marlin/src/gcode/control/M80_M81.cpp index c11acb4380..2a1b3b34b9 100644 --- a/Marlin/src/gcode/control/M80_M81.cpp +++ b/Marlin/src/gcode/control/M80_M81.cpp @@ -25,7 +25,7 @@ #include "../../module/temperature.h" #include "../../module/planner.h" // for planner.finish_and_disable #include "../../module/printcounter.h" // for print_job_timer.stop -#include "../../lcd/marlinui.h" // for LCD_MESSAGEPGM_P +#include "../../lcd/marlinui.h" // for LCD_MESSAGE_F #include "../../inc/MarlinConfig.h" @@ -95,5 +95,5 @@ void GcodeSuite::M81() { powerManager.power_off_soon(); #endif - LCD_MESSAGEPGM_P(PSTR(MACHINE_NAME " " STR_OFF ".")); + LCD_MESSAGE_F(MACHINE_NAME " " STR_OFF "."); } diff --git a/Marlin/src/gcode/geometry/M206_M428.cpp b/Marlin/src/gcode/geometry/M206_M428.cpp index 416b3f7634..8dba238d09 100644 --- a/Marlin/src/gcode/geometry/M206_M428.cpp +++ b/Marlin/src/gcode/geometry/M206_M428.cpp @@ -91,7 +91,7 @@ void GcodeSuite::M428() { diff[i] = -current_position[i]; if (!WITHIN(diff[i], -20, 20)) { SERIAL_ERROR_MSG(STR_ERR_M428_TOO_FAR); - LCD_ALERTMESSAGEPGM_P(PSTR("Err: Too far!")); + LCD_ALERTMESSAGE_F("Err: Too far!"); BUZZ(200, 40); return; } @@ -99,7 +99,7 @@ void GcodeSuite::M428() { LOOP_LINEAR_AXES(i) set_home_offset((AxisEnum)i, diff[i]); report_current_position(); - LCD_MESSAGEPGM(MSG_HOME_OFFSETS_APPLIED); + LCD_MESSAGE(MSG_HOME_OFFSETS_APPLIED); BUZZ(100, 659); BUZZ(100, 698); } diff --git a/Marlin/src/gcode/lcd/M0_M1.cpp b/Marlin/src/gcode/lcd/M0_M1.cpp index 241f11c813..32df8dd9c3 100644 --- a/Marlin/src/gcode/lcd/M0_M1.cpp +++ b/Marlin/src/gcode/lcd/M0_M1.cpp @@ -59,7 +59,7 @@ void GcodeSuite::M0_M1() { if (parser.string_arg) ui.set_status(parser.string_arg, true); else { - LCD_MESSAGEPGM(MSG_USERWAIT); + LCD_MESSAGE(MSG_USERWAIT); #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0 ui.reset_progress_bar_timeout(); #endif diff --git a/Marlin/src/gcode/motion/G4.cpp b/Marlin/src/gcode/motion/G4.cpp index 724ed7f1ca..df3f5b010e 100644 --- a/Marlin/src/gcode/motion/G4.cpp +++ b/Marlin/src/gcode/motion/G4.cpp @@ -38,7 +38,7 @@ void GcodeSuite::G4() { SERIAL_ECHOLNPGM(STR_Z_MOVE_COMP); #endif - if (!ui.has_status()) LCD_MESSAGEPGM(MSG_DWELL); + if (!ui.has_status()) LCD_MESSAGE(MSG_DWELL); dwell(dwell_ms); } diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp index 8b8468bee4..983833c025 100644 --- a/Marlin/src/gcode/queue.cpp +++ b/Marlin/src/gcode/queue.cpp @@ -513,7 +513,7 @@ void GCodeQueue::get_serial_commands() { TERN_(BEZIER_CURVE_SUPPORT, case 5:) PORT_REDIRECT(SERIAL_PORTMASK(p)); // Reply to the serial port that sent the command SERIAL_ECHOLNPGM(STR_ERR_STOPPED); - LCD_MESSAGEPGM(MSG_STOPPED); + LCD_MESSAGE(MSG_STOPPED); break; } } diff --git a/Marlin/src/gcode/temp/M140_M190.cpp b/Marlin/src/gcode/temp/M140_M190.cpp index 857e11dde5..edc15b9cba 100644 --- a/Marlin/src/gcode/temp/M140_M190.cpp +++ b/Marlin/src/gcode/temp/M140_M190.cpp @@ -83,7 +83,7 @@ void GcodeSuite::M140_M190(const bool isM190) { thermalManager.setTargetBed(temp); - ui.set_status_P(thermalManager.isHeatingBed() ? GET_TEXT(MSG_BED_HEATING) : GET_TEXT(MSG_BED_COOLING)); + ui.set_status(thermalManager.isHeatingBed() ? GET_TEXT_F(MSG_BED_HEATING) : GET_TEXT_F(MSG_BED_COOLING)); // with PRINTJOB_TIMER_AUTOSTART, M190 can start the timer, and M140 can stop it TERN_(PRINTJOB_TIMER_AUTOSTART, thermalManager.auto_job_check_timer(isM190, !isM190)); diff --git a/Marlin/src/gcode/temp/M141_M191.cpp b/Marlin/src/gcode/temp/M141_M191.cpp index ed7637c92a..81a078318a 100644 --- a/Marlin/src/gcode/temp/M141_M191.cpp +++ b/Marlin/src/gcode/temp/M141_M191.cpp @@ -69,7 +69,7 @@ void GcodeSuite::M191() { const bool is_heating = thermalManager.isHeatingChamber(); if (is_heating || !no_wait_for_cooling) { - ui.set_status_P(is_heating ? GET_TEXT(MSG_CHAMBER_HEATING) : GET_TEXT(MSG_CHAMBER_COOLING)); + ui.set_status(is_heating ? GET_TEXT_F(MSG_CHAMBER_HEATING) : GET_TEXT_F(MSG_CHAMBER_COOLING)); thermalManager.wait_for_chamber(false); } } diff --git a/Marlin/src/gcode/temp/M143_M193.cpp b/Marlin/src/gcode/temp/M143_M193.cpp index aef4350e60..e4b29bee5f 100644 --- a/Marlin/src/gcode/temp/M143_M193.cpp +++ b/Marlin/src/gcode/temp/M143_M193.cpp @@ -58,7 +58,7 @@ void GcodeSuite::M193() { cooler.enable(); thermalManager.setTargetCooler(parser.value_celsius()); if (thermalManager.isLaserCooling()) { - ui.set_status_P(GET_TEXT(MSG_LASER_COOLING)); + LCD_MESSAGE(MSG_LASER_COOLING); thermalManager.wait_for_cooler(true); } } diff --git a/Marlin/src/gcode/temp/M303.cpp b/Marlin/src/gcode/temp/M303.cpp index 0d0ce478ee..f823aefbed 100644 --- a/Marlin/src/gcode/temp/M303.cpp +++ b/Marlin/src/gcode/temp/M303.cpp @@ -85,7 +85,7 @@ void GcodeSuite::M303() { KEEPALIVE_STATE(NOT_BUSY); #endif - LCD_MESSAGEPGM(MSG_PID_AUTOTUNE); + LCD_MESSAGE(MSG_PID_AUTOTUNE); thermalManager.PID_autotune(temp, hid, c, u); ui.reset_status(); } diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index 5b1d36fdae..d5abe977e5 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -4287,16 +4287,16 @@ void DWIN_CompletedLeveling() { if (checkkey == Leveling) Goto_MainMenu(); } -void DWIN_StatusChanged(const char *text) { +void DWIN_StatusChanged(const char * const cstr/*=nullptr*/) { DWIN_Draw_Rectangle(1, Color_Bg_Blue, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 24); - const int8_t x = _MAX(0U, DWIN_WIDTH - strlen_P(text) * MENU_CHR_W) / 2; - DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Blue, x, STATUS_Y + 3, F(text)); + const int8_t x = _MAX(0U, DWIN_WIDTH - strlen(cstr) * MENU_CHR_W) / 2; + DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Blue, x, STATUS_Y + 3, cstr); DWIN_UpdateLCD(); } -void DWIN_StatusChanged_P(PGM_P const pstr) { - char str[strlen_P((const char*)pstr) + 1]; - strcpy_P(str, (const char*)pstr); +void DWIN_StatusChanged(FSTR_P const fstr) { + char str[strlen_P(FTOP(fstr)) + 1]; + strcpy_P(str, FTOP(fstr)); DWIN_StatusChanged(str); } diff --git a/Marlin/src/lcd/e3v2/creality/dwin.h b/Marlin/src/lcd/e3v2/creality/dwin.h index d4afe46a7d..d9ac0aa5fa 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.h +++ b/Marlin/src/lcd/e3v2/creality/dwin.h @@ -244,8 +244,8 @@ void HMI_Init(); void DWIN_Update(); void EachMomentUpdate(); void DWIN_HandleScreen(); -void DWIN_StatusChanged(const char *text); -void DWIN_StatusChanged_P(PGM_P const pstr); +void DWIN_StatusChanged(const char * const cstr=nullptr); +void DWIN_StatusChanged(FSTR_P const fstr); inline void DWIN_StartHoming() { HMI_flag.home_flag = true; } diff --git a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp index 3768150f8e..064ebbd47d 100644 --- a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp +++ b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp @@ -713,7 +713,7 @@ void Draw_Main_Menu() { void Goto_Main_Menu() { checkkey = MainMenu; - DWIN_StatusChanged(nullptr); + DWIN_StatusChanged(); Draw_Main_Menu(); } @@ -1758,20 +1758,20 @@ void DWIN_Startup() { HMI_SetLanguage(); } -void DWIN_DrawStatusLine(const uint16_t color, const uint16_t bgcolor, const char *text) { +void DWIN_DrawStatusLine(const uint16_t color, const uint16_t bgcolor, const char * const text/*=nullptr*/) { DWIN_Draw_Rectangle(1, bgcolor, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20); if (text) DWINUI::Draw_CenteredString(color, STATUS_Y + 2, text); DWIN_UpdateLCD(); } // Update Status line -void DWIN_StatusChanged(const char *text) { - DWIN_DrawStatusLine(HMI_data.StatusTxt_Color, HMI_data.StatusBg_Color, text); +void DWIN_StatusChanged(const char * const cstr/*=nullptr*/) { + DWIN_DrawStatusLine(HMI_data.StatusTxt_Color, HMI_data.StatusBg_Color, cstr); } -void DWIN_StatusChanged_P(PGM_P const pstr) { - char str[strlen_P((const char*)pstr) + 1]; - strcpy_P(str, (const char*)pstr); +void DWIN_StatusChanged(FSTR_P const fstr) { + char str[strlen_P(FTOP(fstr)) + 1]; + strcpy_P(str, FTOP(fstr)); DWIN_StatusChanged(str); } @@ -1806,7 +1806,7 @@ void DWIN_Progress_Update() { #if HAS_FILAMENT_SENSOR // Filament Runout process - void DWIN_FilamentRunout(const uint8_t extruder) { ui.set_status_P(GET_TEXT(MSG_RUNOUT_SENSOR)); } + void DWIN_FilamentRunout(const uint8_t extruder) { LCD_MESSAGE(MSG_RUNOUT_SENSOR); } #endif void DWIN_SetColorDefaults() { @@ -1891,7 +1891,7 @@ void DWIN_Redraw_screen() { case PAUSE_MESSAGE_OPTION: DWIN_Popup_FilamentPurge(); break; case PAUSE_MESSAGE_RESUME: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_RESUME)); break; case PAUSE_MESSAGE_HEAT: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEAT), ICON_Continue_E); break; - case PAUSE_MESSAGE_HEATING: ui.set_status_P(GET_TEXT(MSG_FILAMENT_CHANGE_HEATING)); break; + case PAUSE_MESSAGE_HEATING: LCD_MESSAGE(MSG_FILAMENT_CHANGE_HEATING); break; case PAUSE_MESSAGE_STATUS: HMI_ReturnScreen(); break; default: break; } @@ -2183,7 +2183,7 @@ void SetMoveZto0() { ); gcode.process_subcommands_now(cmd); planner.synchronize(); - ui.set_status_P(PSTR("Now adjust Z Offset")); + LCD_MESSAGE_F("Now adjust Z Offset"); HMI_AudioFeedback(true); } @@ -2240,7 +2240,7 @@ void Goto_LockScreen() { DWIN_LockScreen(true); } void SetProbeOffsetY() { SetPFloatOnClick(-50, 50, UNITFDIGITS); } void SetProbeOffsetZ() { SetPFloatOnClick(-10, 10, 2); } void ProbeTest() { - ui.set_status_P(GET_TEXT(MSG_M48_TEST)); + LCD_MESSAGE(MSG_M48_TEST); queue.inject(F("G28O\nM48 P10")); } #endif @@ -2297,7 +2297,7 @@ void DWIN_ApplyColor() { DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color); Draw_Status_Area(false); Draw_SelectColors_Menu(); - ui.set_status_P(PSTR("Colors applied")); + LCD_MESSAGE_F("Colors applied"); } void SetSpeed() { SetPIntOnClick(MIN_PRINT_SPEED, MAX_PRINT_SPEED); } @@ -2325,18 +2325,18 @@ void SetSpeed() { SetPIntOnClick(MIN_PRINT_SPEED, MAX_PRINT_SPEED); } } void ParkHead(){ - ui.set_status_P(GET_TEXT(MSG_FILAMENT_PARK_ENABLED)); + LCD_MESSAGE(MSG_FILAMENT_PARK_ENABLED); queue.inject(F("G28O\nG27")); } #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) void UnloadFilament(){ - ui.set_status_P(GET_TEXT(MSG_FILAMENTUNLOAD)); + LCD_MESSAGE(MSG_FILAMENTUNLOAD); queue.inject(F("M702 Z20")); } void LoadFilament(){ - ui.set_status_P(GET_TEXT(MSG_FILAMENTLOAD)); + LCD_MESSAGE(MSG_FILAMENTLOAD); queue.inject(F("M701 Z20")); } #endif @@ -2362,23 +2362,23 @@ void LevBed(uint8_t point) { switch (point) { case 0: - ui.set_status_P(GET_TEXT(MSG_LEVBED_FL)); + LCD_MESSAGE(MSG_LEVBED_FL); xpos = ypos = margin; break; case 1: - ui.set_status_P(GET_TEXT(MSG_LEVBED_FR)); + LCD_MESSAGE(MSG_LEVBED_FR); xpos = X_BED_SIZE - margin; ypos = margin; break; case 2: - ui.set_status_P(GET_TEXT(MSG_LEVBED_BR)); + LCD_MESSAGE(MSG_LEVBED_BR); xpos = X_BED_SIZE - margin; ypos = Y_BED_SIZE - margin; break; case 3: - ui.set_status_P(GET_TEXT(MSG_LEVBED_BL)); + LCD_MESSAGE(MSG_LEVBED_BL); xpos = margin; ypos = Y_BED_SIZE - margin; break; case 4: - ui.set_status_P(GET_TEXT(MSG_LEVBED_C)); + LCD_MESSAGE(MSG_LEVBED_C); xpos = X_BED_SIZE / 2; ypos = Y_BED_SIZE / 2; break; } @@ -2393,7 +2393,7 @@ void LevBed(uint8_t point) { dtostrf(ypos, 1, 1, str_2), dtostrf(zval, 1, 2, str_3) ); - ui.set_status_P(cmd); + ui.set_status(cmd); #else planner.synchronize(); sprintf_P(cmd, PSTR(fmt), xpos, ypos); @@ -2410,7 +2410,7 @@ void LevBedC () { LevBed(4); } #if ENABLED(MESH_BED_LEVELING) void ManualMeshStart(){ - ui.set_status_P(GET_TEXT(MSG_UBL_BUILD_MESH_MENU)); + LCD_MESSAGE(MSG_UBL_BUILD_MESH_MENU); gcode.process_subcommands_now(F("G28 XYO\nG28 Z\nM211 S0\nG29S1")); planner.synchronize(); #ifdef MANUAL_PROBE_START_Z @@ -2435,7 +2435,7 @@ void LevBedC () { LevBed(4); } } void ManualMeshSave(){ - ui.set_status_P(GET_TEXT(MSG_UBL_STORAGE_MESH_MENU)); + LCD_MESSAGE(MSG_UBL_STORAGE_MESH_MENU); queue.inject(F("M211 S1\nM500")); } @@ -3092,11 +3092,11 @@ void HMI_SetPFloat() { // Menu Creation and Drawing functions ====================================================== -void SetMenuTitle(frame_rect_t cn, frame_rect_t en, const __FlashStringHelper* text) { +void SetMenuTitle(frame_rect_t cn, frame_rect_t en, const __FlashStringHelper* fstr) { if (HMI_IsChinese() && (cn.w != 0)) CurrentMenu->MenuTitle.SetFrame(cn.x, cn.y, cn.w, cn.h); else - CurrentMenu->MenuTitle.SetCaption(text); + CurrentMenu->MenuTitle.SetCaption(fstr); } void Draw_Prepare_Menu() { @@ -3234,7 +3234,7 @@ void Draw_Move_Menu() { #endif } CurrentMenu->draw(); - if (!all_axes_trusted()) ui.set_status_P(PSTR("WARNING: position is unknow")); + if (!all_axes_trusted()) LCD_MESSAGE_F("WARNING: position is unknown"); } #if HAS_HOME_OFFSET @@ -3440,11 +3440,11 @@ void Draw_Motion_Menu() { #if HAS_PREHEAT - void Draw_Preheat_Menu(frame_rect_t cn, frame_rect_t en, const __FlashStringHelper* text) { + void Draw_Preheat_Menu(frame_rect_t cn, frame_rect_t en, const __FlashStringHelper* fstr) { checkkey = Menu; if (CurrentMenu != PreheatMenu) { CurrentMenu = PreheatMenu; - SetMenuTitle(cn, en, text); + SetMenuTitle(cn, en, fstr); DWINUI::MenuItemsPrepare(5); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Temperature_Menu); #if HAS_HOTEND @@ -3648,7 +3648,7 @@ void Draw_Steps_Menu() { ADDMENUITEM_P(ICON_Zoffset, GET_TEXT_F(MSG_ZPROBE_ZOFFSET), onDrawPFloat2Menu, SetZOffset, &BABY_Z_VAR); } CurrentMenu->draw(); - if (!axis_is_trusted(Z_AXIS)) ui.set_status_P(PSTR("WARNING: Z position is unknow, move Z to home")); + if (!axis_is_trusted(Z_AXIS)) LCD_MESSAGE_F("WARNING: Z position unknown, move Z to home"); } #endif diff --git a/Marlin/src/lcd/e3v2/enhanced/dwin.h b/Marlin/src/lcd/e3v2/enhanced/dwin.h index f71d54b482..0908417117 100644 --- a/Marlin/src/lcd/e3v2/enhanced/dwin.h +++ b/Marlin/src/lcd/e3v2/enhanced/dwin.h @@ -179,9 +179,9 @@ void EachMomentUpdate(); void update_variable(); void DWIN_HandleScreen(); void DWIN_Update(); -void DWIN_DrawStatusLine(const uint16_t color, const uint16_t bgcolor, const char *text); -void DWIN_StatusChanged(const char * const text); -void DWIN_StatusChanged_P(PGM_P const text); +void DWIN_DrawStatusLine(const uint16_t color, const uint16_t bgcolor, const char *text=nullptr); +void DWIN_StatusChanged(const char * const cstr=nullptr); +void DWIN_StatusChanged(FSTR_P const fstr); void DWIN_StartHoming(); void DWIN_CompletedHoming(); #if HAS_MESH diff --git a/Marlin/src/lcd/e3v2/enhanced/meshviewer.cpp b/Marlin/src/lcd/e3v2/enhanced/meshviewer.cpp index 88ab504a54..8d6b5fa2c0 100644 --- a/Marlin/src/lcd/e3v2/enhanced/meshviewer.cpp +++ b/Marlin/src/lcd/e3v2/enhanced/meshviewer.cpp @@ -66,7 +66,7 @@ void MeshViewerClass::Draw() { } } char str_1[6], str_2[6] = ""; - ui.status_printf_P(0, PSTR("Mesh minZ: %s, maxZ: %s"), + ui.status_printf(0, F("Mesh minZ: %s, maxZ: %s"), dtostrf((float)minz / 100, 1, 2, str_1), dtostrf((float)maxz / 100, 1, 2, str_2) ); diff --git a/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp b/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp index f0d0156151..96b0f2a086 100644 --- a/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp +++ b/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp @@ -2018,7 +2018,7 @@ void get_wifi_commands() { TERN_(ARC_SUPPORT, case 2 ... 3:) TERN_(BEZIER_CURVE_SUPPORT, case 5:) SERIAL_ECHOLNPGM(STR_ERR_STOPPED); - LCD_MESSAGEPGM(MSG_STOPPED); + LCD_MESSAGE(MSG_STOPPED); break; } } diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index e8a86730aa..009931d428 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -665,7 +665,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; void MarlinUI::kill_screen(PGM_P lcd_error, PGM_P lcd_component) { init(); - status_printf_P(1, PSTR(S_FMT ": " S_FMT), lcd_error, lcd_component); + status_printf(1, F(S_FMT ": " S_FMT), lcd_error, lcd_component); TERN_(HAS_LCD_MENU, return_to_status()); // RED ALERT. RED ALERT. @@ -1393,76 +1393,77 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; #if SERVICE_INTERVAL_3 > 0 static PGMSTR(service3, "> " SERVICE_NAME_3 "!"); #endif - PGM_P msg; + FSTR_P msg; if (printingIsPaused()) - msg = GET_TEXT(MSG_PRINT_PAUSED); + msg = GET_TEXT_F(MSG_PRINT_PAUSED); #if ENABLED(SDSUPPORT) else if (IS_SD_PRINTING()) return set_status(card.longest_filename(), true); #endif else if (print_job_timer.isRunning()) - msg = GET_TEXT(MSG_PRINTING); + msg = GET_TEXT_F(MSG_PRINTING); #if SERVICE_INTERVAL_1 > 0 - else if (print_job_timer.needsService(1)) msg = service1; + else if (print_job_timer.needsService(1)) msg = FPSTR(service1); #endif #if SERVICE_INTERVAL_2 > 0 - else if (print_job_timer.needsService(2)) msg = service2; + else if (print_job_timer.needsService(2)) msg = FPSTR(service2); #endif #if SERVICE_INTERVAL_3 > 0 - else if (print_job_timer.needsService(3)) msg = service3; + else if (print_job_timer.needsService(3)) msg = FPSTR(service3); #endif else if (!no_welcome) - msg = GET_TEXT(WELCOME_MSG); + msg = GET_TEXT_F(WELCOME_MSG); else return; - set_status_P(msg, -1); + set_status(msg, -1); } - void MarlinUI::set_status_P(PGM_P const message, int8_t level) { + void MarlinUI::set_status(FSTR_P const fstr, int8_t level) { + PGM_P const pstr = FTOP(fstr); if (level < 0) level = alert_level = 0; if (level < alert_level) return; alert_level = level; - TERN_(HOST_PROMPT_SUPPORT, host_action_notify_P(message)); + TERN_(HOST_PROMPT_SUPPORT, host_action_notify_P(pstr)); // Since the message is encoded in UTF8 it must // only be cut on a character boundary. // Get a pointer to the null terminator - PGM_P pend = message + strlen_P(message); + PGM_P pend = pstr + strlen_P(pstr); // If length of supplied UTF8 string is greater than // the buffer size, start cutting whole UTF8 chars - while ((pend - message) > MAX_MESSAGE_LENGTH) { + while ((pend - pstr) > MAX_MESSAGE_LENGTH) { --pend; while (!START_OF_UTF8_CHAR(pgm_read_byte(pend))) --pend; }; // At this point, we have the proper cut point. Use it - uint8_t maxLen = pend - message; - strncpy_P(status_message, message, maxLen); + uint8_t maxLen = pend - pstr; + strncpy_P(status_message, pstr, maxLen); status_message[maxLen] = '\0'; finish_status(level > 0); } - void MarlinUI::set_alert_status_P(PGM_P const message) { - set_status_P(message, 1); + void MarlinUI::set_alert_status(FSTR_P const fstr) { + set_status(fstr, 1); TERN_(HAS_TOUCH_SLEEP, wakeup_screen()); TERN_(HAS_LCD_MENU, return_to_status()); } #include - void MarlinUI::status_printf_P(const uint8_t level, PGM_P const fmt, ...) { + void MarlinUI::status_printf(const uint8_t level, FSTR_P const fmt, ...) { if (level < alert_level) return; alert_level = level; va_list args; - va_start(args, fmt); - vsnprintf_P(status_message, MAX_MESSAGE_LENGTH, fmt, args); + va_start(args, FTOP(fmt)); + vsnprintf_P(status_message, MAX_MESSAGE_LENGTH, FTOP(fmt), args); va_end(args); finish_status(level > 0); } @@ -1536,7 +1537,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; #endif IF_DISABLED(SDSUPPORT, print_job_timer.stop()); TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, PSTR("UI Aborted"), DISMISS_STR)); - LCD_MESSAGEPGM(MSG_PRINT_ABORTED); + LCD_MESSAGE(MSG_PRINT_ABORTED); TERN_(HAS_LCD_MENU, return_to_status()); } @@ -1548,7 +1549,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; #endif void MarlinUI::flow_fault() { - LCD_ALERTMESSAGEPGM(MSG_FLOWMETER_FAULT); + LCD_ALERTMESSAGE(MSG_FLOWMETER_FAULT); TERN_(HAS_BUZZER, buzz(1000, 440)); TERN_(HAS_LCD_MENU, return_to_status()); } @@ -1566,7 +1567,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; TERN_(HAS_TOUCH_SLEEP, wakeup_screen()); TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("UI Pause"), PSTR("Resume"))); - LCD_MESSAGEPGM(MSG_PRINT_PAUSED); + LCD_MESSAGE(MSG_PRINT_PAUSED); #if ENABLED(PARK_HEAD_ON_PAUSE) pause_show_message(PAUSE_MESSAGE_PARKING, PAUSE_MODE_PAUSE_PRINT); // Show message immediately to let user know about pause in progress @@ -1637,14 +1638,14 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; // // Send the status line as a host notification // - void MarlinUI::set_status(const char * const message, const bool) { - TERN(HOST_PROMPT_SUPPORT, host_action_notify(message), UNUSED(message)); + void MarlinUI::set_status(const char * const cstr, const bool) { + TERN(HOST_PROMPT_SUPPORT, host_action_notify(cstr), UNUSED(cstr)); } - void MarlinUI::set_status_P(PGM_P message, const int8_t) { - TERN(HOST_PROMPT_SUPPORT, host_action_notify_P(message), UNUSED(message)); + void MarlinUI::set_status(FSTR_P const fstr, const int8_t) { + TERN(HOST_PROMPT_SUPPORT, host_action_notify_P(FTOP(fstr)), UNUSED(fstr)); } - void MarlinUI::status_printf_P(const uint8_t, PGM_P const message, ...) { - TERN(HOST_PROMPT_SUPPORT, host_action_notify_P(message), UNUSED(message)); + void MarlinUI::status_printf(const uint8_t, FSTR_P const fstr, ...) { + TERN(HOST_PROMPT_SUPPORT, host_action_notify_P(FPSTR(fstr)), UNUSED(fstr)); } #endif // !HAS_DISPLAY && !HAS_STATUS_MESSAGE @@ -1670,7 +1671,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; quick_feedback(); goto_screen(MEDIA_MENU_GATEWAY); #else - LCD_MESSAGEPGM(MSG_MEDIA_INSERTED); + LCD_MESSAGE(MSG_MEDIA_INSERTED); #endif } } @@ -1679,7 +1680,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; #if ENABLED(EXTENSIBLE_UI) ExtUI::onMediaRemoved(); #elif PIN_EXISTS(SD_DETECT) - LCD_MESSAGEPGM(MSG_MEDIA_REMOVED); + LCD_MESSAGE(MSG_MEDIA_REMOVED); #if HAS_LCD_MENU if (!defer_return_to_status) return_to_status(); #endif @@ -1802,7 +1803,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; ); }); #else - set_status_P(eeprom_err(msgid)); + set_status(FPSTR(eeprom_err(msgid))); #endif } diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index 02d5bf06bd..bc8442c576 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -342,21 +342,19 @@ public: static bool has_status(); static void reset_status(const bool no_welcome=false); - static void set_status(const char * const message, const bool persist=false); - static void set_status_P(PGM_P const message, const int8_t level=0); - static void status_printf_P(const uint8_t level, PGM_P const fmt, ...); - static void set_alert_status_P(PGM_P const message); + static void set_alert_status(FSTR_P const fstr); static inline void reset_alert_level() { alert_level = 0; } #else static constexpr bool has_status() { return false; } static inline void reset_status(const bool=false) {} - static void set_status(const char *message, const bool=false); - static void set_status_P(PGM_P message, const int8_t=0); - static void status_printf_P(const uint8_t, PGM_P message, ...); - static inline void set_alert_status_P(PGM_P const) {} + static inline void set_alert_status(FSTR_P const) {} static inline void reset_alert_level() {} #endif + static void set_status(const char * const cstr, const bool persist=false); + static void set_status(FSTR_P const fstr, const int8_t level=0); + 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); #else @@ -740,8 +738,7 @@ private: extern MarlinUI ui; -#define LCD_MESSAGEPGM_P(x) ui.set_status_P(x) -#define LCD_ALERTMESSAGEPGM_P(x) ui.set_alert_status_P(x) - -#define LCD_MESSAGEPGM(x) LCD_MESSAGEPGM_P(GET_TEXT(x)) -#define LCD_ALERTMESSAGEPGM(x) LCD_ALERTMESSAGEPGM_P(GET_TEXT(x)) +#define LCD_MESSAGE_F(S) ui.set_status(F(S)) +#define LCD_MESSAGE(M) ui.set_status(GET_TEXT_F(M)) +#define LCD_ALERTMESSAGE_F(S) ui.set_alert_status(F(S)) +#define LCD_ALERTMESSAGE(M) ui.set_alert_status(GET_TEXT_F(M)) diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 9d424feb75..8b688ab2ab 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -630,7 +630,7 @@ void menu_advanced_settings() { didset = settings.set_sd_update_status(new_state); ui.completion_feedback(didset); ui.return_to_status(); - if (new_state) LCD_MESSAGEPGM(MSG_RESET_PRINTER); else ui.reset_status(); + if (new_state) LCD_MESSAGE(MSG_RESET_PRINTER); else ui.reset_status(); }); #endif diff --git a/Marlin/src/lcd/menu/menu_mixer.cpp b/Marlin/src/lcd/menu/menu_mixer.cpp index d07b89c7c0..694fd54813 100644 --- a/Marlin/src/lcd/menu/menu_mixer.cpp +++ b/Marlin/src/lcd/menu/menu_mixer.cpp @@ -253,7 +253,7 @@ void menu_mixer() { MSG_BUTTON_RESET, MSG_BUTTON_CANCEL, []{ mixer.reset_vtools(); - LCD_MESSAGEPGM(MSG_VTOOLS_RESET); + LCD_MESSAGE(MSG_VTOOLS_RESET); ui.return_to_status(); }, nullptr, diff --git a/Marlin/src/lcd/menu/menu_mmu2.cpp b/Marlin/src/lcd/menu/menu_mmu2.cpp index 425a8ca751..99e5c06245 100644 --- a/Marlin/src/lcd/menu/menu_mmu2.cpp +++ b/Marlin/src/lcd/menu/menu_mmu2.cpp @@ -36,14 +36,14 @@ inline void action_mmu2_load_filament_to_nozzle(const uint8_t tool) { ui.reset_status(); ui.return_to_status(); - ui.status_printf_P(0, GET_TEXT(MSG_MMU2_LOADING_FILAMENT), int(tool + 1)); + ui.status_printf(0, GET_TEXT_F(MSG_MMU2_LOADING_FILAMENT), int(tool + 1)); if (mmu2.load_filament_to_nozzle(tool)) ui.reset_status(); ui.return_to_status(); } void _mmu2_load_filament(uint8_t index) { ui.return_to_status(); - ui.status_printf_P(0, GET_TEXT(MSG_MMU2_LOADING_FILAMENT), int(index + 1)); + ui.status_printf(0, GET_TEXT_F(MSG_MMU2_LOADING_FILAMENT), int(index + 1)); mmu2.load_filament(index); ui.reset_status(); } @@ -74,14 +74,14 @@ void menu_mmu2_load_to_nozzle() { void _mmu2_eject_filament(uint8_t index) { ui.reset_status(); ui.return_to_status(); - ui.status_printf_P(0, GET_TEXT(MSG_MMU2_EJECTING_FILAMENT), int(index + 1)); + ui.status_printf(0, GET_TEXT_F(MSG_MMU2_EJECTING_FILAMENT), int(index + 1)); if (mmu2.eject_filament(index, true)) ui.reset_status(); } void action_mmu2_unload_filament() { ui.reset_status(); ui.return_to_status(); - LCD_MESSAGEPGM(MSG_MMU2_UNLOADING_FILAMENT); + LCD_MESSAGE(MSG_MMU2_UNLOADING_FILAMENT); idle(); if (mmu2.unload()) ui.reset_status(); } diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index d29fd3ecb3..b5f270ee63 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -460,8 +460,8 @@ void Endstops::event_handler() { SERIAL_EOL(); TERN_(HAS_STATUS_MESSAGE, - ui.status_printf_P(0, - PSTR(S_FMT GANG_N_1(LINEAR_AXES, " %c") " %c"), + ui.status_printf(0, + F(S_FMT GANG_N_1(LINEAR_AXES, " %c") " %c"), GET_TEXT(MSG_LCD_ENDSTOPS), LINEAR_AXIS_LIST(chrX, chrY, chrZ, chrI, chrJ, chrK), chrP ) diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 638bb6be81..5accbc8edd 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -137,7 +137,7 @@ xyz_pos_t Probe::offset; // Initialized by settings.load() #if ENABLED(TOUCH_MI_MANUAL_DEPLOY) const screenFunc_t prev_screen = ui.currentScreen; - LCD_MESSAGEPGM(MSG_MANUAL_DEPLOY_TOUCHMI); + LCD_MESSAGE(MSG_MANUAL_DEPLOY_TOUCHMI); ui.return_to_status(); TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Deploy TouchMI"), CONTINUE_STR)); @@ -290,10 +290,10 @@ FORCE_INLINE void probe_specific_action(const bool deploy) { BUZZ(100, 659); BUZZ(100, 698); - PGM_P const ds_str = deploy ? GET_TEXT(MSG_MANUAL_DEPLOY) : GET_TEXT(MSG_MANUAL_STOW); + FSTR_P const ds_str = deploy ? GET_TEXT_F(MSG_MANUAL_DEPLOY) : GET_TEXT_F(MSG_MANUAL_STOW); ui.return_to_status(); // To display the new status message - ui.set_status_P(ds_str, 99); - SERIAL_ECHOLNPGM_P(ds_str); + ui.set_status(ds_str, 99); + SERIAL_ECHOLNF(ds_str); TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Stow Probe"), CONTINUE_STR)); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Stow Probe"))); @@ -439,7 +439,7 @@ bool Probe::set_deployed(const bool deploy) { if (PROBE_TRIGGERED() == deploy) { // Unchanged after deploy/stow action? if (IsRunning()) { SERIAL_ERROR_MSG("Z-Probe failed"); - LCD_ALERTMESSAGEPGM_P(PSTR("Err: ZPROBE")); + LCD_ALERTMESSAGE_F("Err: ZPROBE"); } stop(); return true; @@ -793,7 +793,7 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai if (isnan(measured_z)) { stow(); - LCD_MESSAGEPGM(MSG_LCD_PROBING_FAILED); + LCD_MESSAGE(MSG_LCD_PROBING_FAILED); #if DISABLED(G29_RETRY_AND_RECOVER) SERIAL_ERROR_MSG(STR_ERR_PROBING_FAILED); #endif diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index a4b8bb19e6..4f15dceba8 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -1471,7 +1471,7 @@ void MarlinSettings::postprocess() { store_mesh(ubl.storage_slot); #endif - if (!eeprom_error) LCD_MESSAGEPGM(MSG_SETTINGS_STORED); + if (!eeprom_error) LCD_MESSAGE(MSG_SETTINGS_STORED); TERN_(EXTENSIBLE_UI, ExtUI::onConfigurationStoreWritten(!eeprom_error)); @@ -1497,7 +1497,7 @@ void MarlinSettings::postprocess() { stored_ver[1] = '\0'; } DEBUG_ECHO_MSG("EEPROM version mismatch (EEPROM=", stored_ver, " Marlin=" EEPROM_VERSION ")"); - TERN_(DWIN_CREALITY_LCD_ENHANCED, ui.set_status(GET_TEXT(MSG_ERR_EEPROM_VERSION))); + TERN_(DWIN_CREALITY_LCD_ENHANCED, LCD_MESSAGE(MSG_ERR_EEPROM_VERSION)); IF_DISABLED(EEPROM_AUTO_INIT, ui.eeprom_alert_version()); eeprom_error = true; @@ -2362,7 +2362,7 @@ void MarlinSettings::postprocess() { else if (working_crc != stored_crc) { eeprom_error = true; DEBUG_ERROR_MSG("EEPROM CRC mismatch - (stored) ", stored_crc, " != ", working_crc, " (calculated)!"); - TERN_(DWIN_CREALITY_LCD_ENHANCED, ui.set_status(GET_TEXT(MSG_ERR_EEPROM_CRC))); + TERN_(DWIN_CREALITY_LCD_ENHANCED, LCD_MESSAGE(MSG_ERR_EEPROM_CRC)); IF_DISABLED(EEPROM_AUTO_INIT, ui.eeprom_alert_crc()); } else if (!validating) { diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index e85f5f4644..aa81ea5d96 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -635,7 +635,7 @@ volatile bool Temperature::raw_temps_ready = false; // PID Tuning loop wait_for_heatup = true; // Can be interrupted with M108 - TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT), "Wait for heat up...")); + TERN_(HAS_STATUS_MESSAGE, ui.set_status(F("Wait for heat up..."))); while (wait_for_heatup) { const millis_t ms = millis(); @@ -696,7 +696,7 @@ volatile bool Temperature::raw_temps_ready = false; } } SHV((bias + d) >> 1); - TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_PID_CYCLE), cycles, ncycles)); + TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " %i/%i"), GET_TEXT(MSG_PID_CYCLE), cycles, ncycles)); cycles++; minT = target; } @@ -3603,11 +3603,11 @@ void Temperature::isr() { #if HAS_HOTEND && HAS_STATUS_MESSAGE void Temperature::set_heating_message(const uint8_t e) { const bool heating = isHeatingHotend(e); - ui.status_printf_P(0, + ui.status_printf(0, #if HAS_MULTI_HOTEND - PSTR("E%c " S_FMT), '1' + e + F("E%c " S_FMT), '1' + e #else - PSTR("E1 " S_FMT) + F("E1 " S_FMT) #endif , heating ? GET_TEXT(MSG_HEATING) : GET_TEXT(MSG_COOLING) ); @@ -3744,7 +3744,7 @@ void Temperature::isr() { void Temperature::wait_for_hotend_heating(const uint8_t target_extruder) { if (isHeatingHotend(target_extruder)) { SERIAL_ECHOLNPGM("Wait for hotend heating..."); - LCD_MESSAGEPGM(MSG_HEATING); + LCD_MESSAGE(MSG_HEATING); wait_for_hotend(target_extruder); ui.reset_status(); } @@ -3874,7 +3874,7 @@ void Temperature::isr() { void Temperature::wait_for_bed_heating() { if (isHeatingBed()) { SERIAL_ECHOLNPGM("Wait for bed heating..."); - LCD_MESSAGEPGM(MSG_BED_HEATING); + LCD_MESSAGE(MSG_BED_HEATING); wait_for_bed(); ui.reset_status(); } diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index e1998cdb2e..2f387abad4 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -490,12 +490,12 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0. #endif if (check_tool_sensor_stats(0)) { - ui.set_status_P("TC error"); + LCD_MESSAGE_F("TC error"); switching_toolhead_lock(false); while (check_tool_sensor_stats(0)) { /* nada */ } switching_toolhead_lock(true); } - ui.set_status_P("TC Success"); + LCD_MESSAGE_F("TC Success"); #endif } diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 26a6d736eb..6b8d2338c1 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -457,7 +457,7 @@ void CardReader::mount() { cdroot(); #if ENABLED(USB_FLASH_DRIVE_SUPPORT) || PIN_EXISTS(SD_DETECT) else if (marlin_state != MF_INITIALIZING) - ui.set_status_P(GET_TEXT(MSG_SD_INIT_FAIL), -1); + ui.set_status(GET_TEXT_F(MSG_SD_INIT_FAIL), -1); #endif ui.refresh(); diff --git a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp index 5991a9fb83..05671167c8 100644 --- a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp +++ b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp @@ -126,7 +126,7 @@ bool DiskIODriver_USBFlash::usbStartup() { SERIAL_ECHOPGM("Starting USB host..."); if (!UHS_START) { SERIAL_ECHOLNPGM(" failed."); - LCD_MESSAGEPGM(MSG_MEDIA_USB_FAILED); + LCD_MESSAGE(MSG_MEDIA_USB_FAILED); return false; } @@ -221,7 +221,7 @@ void DiskIODriver_USBFlash::idle() { #if USB_DEBUG >= 1 SERIAL_ECHOLNPGM("Waiting for media"); #endif - LCD_MESSAGEPGM(MSG_MEDIA_WAITING); + LCD_MESSAGE(MSG_MEDIA_WAITING); GOTO_STATE_AFTER_DELAY(state, 2000); } break; @@ -236,7 +236,7 @@ void DiskIODriver_USBFlash::idle() { SERIAL_ECHOLNPGM("USB device removed"); #endif if (state != MEDIA_READY) - LCD_MESSAGEPGM(MSG_MEDIA_USB_REMOVED); + LCD_MESSAGE(MSG_MEDIA_USB_REMOVED); GOTO_STATE_AFTER_DELAY(WAIT_FOR_DEVICE, 0); } @@ -245,12 +245,12 @@ void DiskIODriver_USBFlash::idle() { #if USB_DEBUG >= 1 SERIAL_ECHOLNPGM("Media removed"); #endif - LCD_MESSAGEPGM(MSG_MEDIA_REMOVED); + LCD_MESSAGE(MSG_MEDIA_REMOVED); GOTO_STATE_AFTER_DELAY(WAIT_FOR_DEVICE, 0); } else if (task_state == UHS_STATE(ERROR)) { - LCD_MESSAGEPGM(MSG_MEDIA_READ_ERROR); + LCD_MESSAGE(MSG_MEDIA_READ_ERROR); GOTO_STATE_AFTER_DELAY(MEDIA_ERROR, 0); } }