From 2b9ae0cc33a1996cb6dd1092743d4a3123c1d4c1 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 25 Sep 2021 18:43:52 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Apply=20F()=20to=20G-code=20subc?= =?UTF-8?q?ommands?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/bedlevel/ubl/ubl.cpp | 14 +- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 2 +- Marlin/src/feature/power.cpp | 4 +- Marlin/src/feature/powerloss.cpp | 12 +- Marlin/src/gcode/bedlevel/G35.cpp | 2 +- Marlin/src/gcode/bedlevel/abl/G29.cpp | 4 +- Marlin/src/gcode/calibrate/G34.cpp | 4 +- Marlin/src/gcode/calibrate/G34_M422.cpp | 2 +- Marlin/src/gcode/calibrate/G425.cpp | 4 +- Marlin/src/gcode/calibrate/G76_M192_M871.cpp | 2 +- Marlin/src/gcode/control/M605.cpp | 2 +- Marlin/src/gcode/feature/L6470/M916-918.cpp | 14 +- Marlin/src/gcode/feature/clean/G12.cpp | 2 +- Marlin/src/gcode/gcode.cpp | 9 +- Marlin/src/gcode/gcode.h | 4 +- Marlin/src/gcode/motion/G2_G3.cpp | 2 +- Marlin/src/gcode/queue.cpp | 8 +- Marlin/src/gcode/sd/M1001.cpp | 6 +- Marlin/src/lcd/e3v2/enhanced/dwin.cpp | 10 +- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 131 +++++++++--------- .../lcd/extui/dgus/mks/DGUSScreenHandler.cpp | 2 +- .../generic/spinner_dialog_box.cpp | 2 +- .../lcd/extui/mks_ui/draw_baby_stepping.cpp | 12 +- .../lcd/extui/mks_ui/draw_filament_change.cpp | 2 +- .../src/lcd/extui/mks_ui/draw_number_key.cpp | 2 +- Marlin/src/lcd/extui/mks_ui/draw_printing.cpp | 2 +- .../lcd/extui/mks_ui/printer_operation.cpp | 4 +- Marlin/src/module/tool_change.cpp | 6 +- 28 files changed, 136 insertions(+), 134 deletions(-) diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.cpp b/Marlin/src/feature/bedlevel/ubl/ubl.cpp index 00cb5ed738..7b2280fcde 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl.cpp @@ -281,10 +281,10 @@ bool unified_bed_leveling::sanity_check() { } #endif - process_subcommands_now_P(G28_STR); // Home - process_subcommands_now_P(PSTR(ALIGN_GCODE "\n" // Align multi z axis if available - PROBE_GCODE "\n" // Build mesh with available hardware - "G29P3\nG29P3")); // Ensure mesh is complete by running smart fill twice + process_subcommands_now(FPSTR(G28_STR)); // Home + process_subcommands_now(F(ALIGN_GCODE "\n" // Align multi z axis if available + PROBE_GCODE "\n" // Build mesh with available hardware + "G29P3\nG29P3")); // Ensure mesh is complete by running smart fill twice if (parser.seenval('S')) { char umw_gcode[32]; @@ -292,9 +292,9 @@ bool unified_bed_leveling::sanity_check() { queue.inject(umw_gcode); } - process_subcommands_now_P(PSTR("G29A\nG29F10\n" // Set UBL Active & Fade 10 - "M140S0\nM104S0\n" // Turn off heaters - "M500")); // Store settings + process_subcommands_now(F("G29A\nG29F10\n" // Set UBL Active & Fade 10 + "M140S0\nM104S0\n" // Turn off heaters + "M500")); // Store settings } #endif // UBL_MESH_WIZARD diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index 750c63f7c6..9b85b5b972 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -656,7 +656,7 @@ void unified_bed_leveling::G29() { if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Z Probe End Script: ", Z_PROBE_END_SCRIPT); if (probe_deployed) { planner.synchronize(); - gcode.process_subcommands_now_P(PSTR(Z_PROBE_END_SCRIPT)); + gcode.process_subcommands_now(F(Z_PROBE_END_SCRIPT)); } #else UNUSED(probe_deployed); diff --git a/Marlin/src/feature/power.cpp b/Marlin/src/feature/power.cpp index 8116bd2e44..fabe35b989 100644 --- a/Marlin/src/feature/power.cpp +++ b/Marlin/src/feature/power.cpp @@ -82,7 +82,7 @@ void Power::power_on() { TERN_(HAS_TRINAMIC_CONFIG, safe_delay(PSU_POWERUP_DELAY)); #ifdef PSU_POWERUP_GCODE - GcodeSuite::process_subcommands_now_P(PSTR(PSU_POWERUP_GCODE)); + gcode.process_subcommands_now(F(PSU_POWERUP_GCODE)); #endif } @@ -95,7 +95,7 @@ void Power::power_off() { if (!psu_on) return; #ifdef PSU_POWEROFF_GCODE - GcodeSuite::process_subcommands_now_P(PSTR(PSU_POWEROFF_GCODE)); + gcode.process_subcommands_now(F(PSU_POWEROFF_GCODE)); #endif #if ENABLED(PS_OFF_SOUND) diff --git a/Marlin/src/feature/powerloss.cpp b/Marlin/src/feature/powerloss.cpp index 8db31daa40..a551ba4c8b 100644 --- a/Marlin/src/feature/powerloss.cpp +++ b/Marlin/src/feature/powerloss.cpp @@ -244,7 +244,7 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW #if POWER_LOSS_RETRACT_LEN // Retract filament now - gcode.process_subcommands_now_P(PSTR("G1 F3000 E-" STRINGIFY(POWER_LOSS_RETRACT_LEN))); + gcode.process_subcommands_now(F("G1 F3000 E-" STRINGIFY(POWER_LOSS_RETRACT_LEN))); #endif #if POWER_LOSS_ZRAISE @@ -337,7 +337,7 @@ void PrintJobRecovery::resume() { #if HAS_LEVELING // Make sure leveling is off before any G92 and G28 - gcode.process_subcommands_now_P(PSTR("M420 S0 Z0")); + gcode.process_subcommands_now(F("M420 S0 Z0")); #endif #if HAS_HEATED_BED @@ -373,7 +373,7 @@ void PrintJobRecovery::resume() { // establish the current position as best we can. // - gcode.process_subcommands_now_P(PSTR("G92.9E0")); // Reset E to 0 + gcode.process_subcommands_now(F("G92.9E0")); // Reset E to 0 #if Z_HOME_TO_MAX @@ -410,7 +410,7 @@ void PrintJobRecovery::resume() { } // Home XY with no Z raise, and also home Z here if Z isn't homing down below. - gcode.process_subcommands_now_P(PSTR("G28R0" TERN_(HOME_XY_ONLY, "XY"))); // No raise during G28 + gcode.process_subcommands_now(F("G28R0" TERN_(HOME_XY_ONLY, "XY"))); // No raise during G28 #endif @@ -513,7 +513,7 @@ void PrintJobRecovery::resume() { // Un-retract if there was a retract at outage #if ENABLED(BACKUP_POWER_SUPPLY) && POWER_LOSS_RETRACT_LEN > 0 - gcode.process_subcommands_now_P(PSTR("G1E" STRINGIFY(POWER_LOSS_RETRACT_LEN) "F3000")); + gcode.process_subcommands_now(F("G1E" STRINGIFY(POWER_LOSS_RETRACT_LEN) "F3000")); #endif // Additional purge on resume if configured @@ -523,7 +523,7 @@ void PrintJobRecovery::resume() { #endif #if ENABLED(NOZZLE_CLEAN_FEATURE) - gcode.process_subcommands_now_P(PSTR("G12")); + gcode.process_subcommands_now(F("G12")); #endif // Move back over to the saved XY diff --git a/Marlin/src/gcode/bedlevel/G35.cpp b/Marlin/src/gcode/bedlevel/G35.cpp index 8d5c057361..cb634d973b 100644 --- a/Marlin/src/gcode/bedlevel/G35.cpp +++ b/Marlin/src/gcode/bedlevel/G35.cpp @@ -92,7 +92,7 @@ void GcodeSuite::G35() { TERN_(HAS_DUPLICATION_MODE, set_duplication_enabled(false)); // Home only Z axis when X and Y is trusted, otherwise all axes, if needed before this procedure - if (!all_axes_trusted()) process_subcommands_now_P(PSTR("G28Z")); + if (!all_axes_trusted()) process_subcommands_now(F("G28Z")); bool err_break = false; diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 0eb13dba96..03b0450c6b 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -244,7 +244,7 @@ G29_TYPE GcodeSuite::G29() { // Send 'N' to force homing before G29 (internal only) if (parser.seen_test('N')) - process_subcommands_now_P(TERN(CAN_SET_LEVELING_AFTER_G28, PSTR("G28L0"), G28_STR)); + process_subcommands_now(TERN(CAN_SET_LEVELING_AFTER_G28, F("G28L0"), FPSTR(G28_STR))); // Don't allow auto-leveling without homing first if (homing_needed_error()) G29_RETURN(false); @@ -882,7 +882,7 @@ G29_TYPE GcodeSuite::G29() { #ifdef Z_PROBE_END_SCRIPT if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Z Probe End Script: ", Z_PROBE_END_SCRIPT); planner.synchronize(); - process_subcommands_now_P(PSTR(Z_PROBE_END_SCRIPT)); + process_subcommands_now(F(Z_PROBE_END_SCRIPT)); #endif TERN_(HAS_DWIN_E3V2_BASIC, DWIN_CompletedLeveling()); diff --git a/Marlin/src/gcode/calibrate/G34.cpp b/Marlin/src/gcode/calibrate/G34.cpp index f335a12311..98a0bdef88 100644 --- a/Marlin/src/gcode/calibrate/G34.cpp +++ b/Marlin/src/gcode/calibrate/G34.cpp @@ -47,7 +47,7 @@ void GcodeSuite::G34() { TemporaryGlobalEndstopsState unlock_z(false); #ifdef GANTRY_CALIBRATION_COMMANDS_PRE - gcode.process_subcommands_now_P(PSTR(GANTRY_CALIBRATION_COMMANDS_PRE)); + process_subcommands_now(F(GANTRY_CALIBRATION_COMMANDS_PRE)); if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Sub Commands Processed"); #endif @@ -148,7 +148,7 @@ void GcodeSuite::G34() { #ifdef GANTRY_CALIBRATION_COMMANDS_POST if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Running Post Commands"); - gcode.process_subcommands_now_P(PSTR(GANTRY_CALIBRATION_COMMANDS_POST)); + process_subcommands_now(F(GANTRY_CALIBRATION_COMMANDS_POST)); #endif SET_SOFT_ENDSTOP_LOOSE(false); diff --git a/Marlin/src/gcode/calibrate/G34_M422.cpp b/Marlin/src/gcode/calibrate/G34_M422.cpp index dd1dd5622a..63d839c847 100644 --- a/Marlin/src/gcode/calibrate/G34_M422.cpp +++ b/Marlin/src/gcode/calibrate/G34_M422.cpp @@ -433,7 +433,7 @@ void GcodeSuite::G34() { // After this operation the z position needs correction set_axis_never_homed(Z_AXIS); // Home Z after the alignment procedure - process_subcommands_now_P(PSTR("G28Z")); + process_subcommands_now(F("G28Z")); #else // Use the probed height from the last iteration to determine the Z height. // z_measured_min is used, because all steppers are aligned to z_measured_min. diff --git a/Marlin/src/gcode/calibrate/G425.cpp b/Marlin/src/gcode/calibrate/G425.cpp index 23a66dd0c5..88c906f493 100644 --- a/Marlin/src/gcode/calibrate/G425.cpp +++ b/Marlin/src/gcode/calibrate/G425.cpp @@ -709,7 +709,7 @@ inline void calibrate_all() { void GcodeSuite::G425() { #ifdef CALIBRATION_SCRIPT_PRE - GcodeSuite::process_subcommands_now_P(PSTR(CALIBRATION_SCRIPT_PRE)); + process_subcommands_now(F(CALIBRATION_SCRIPT_PRE)); #endif if (homing_needed_error()) return; @@ -745,7 +745,7 @@ void GcodeSuite::G425() { SET_SOFT_ENDSTOP_LOOSE(false); #ifdef CALIBRATION_SCRIPT_POST - GcodeSuite::process_subcommands_now_P(PSTR(CALIBRATION_SCRIPT_POST)); + process_subcommands_now(F(CALIBRATION_SCRIPT_POST)); #endif } diff --git a/Marlin/src/gcode/calibrate/G76_M192_M871.cpp b/Marlin/src/gcode/calibrate/G76_M192_M871.cpp index 946701050e..0fcd686a06 100644 --- a/Marlin/src/gcode/calibrate/G76_M192_M871.cpp +++ b/Marlin/src/gcode/calibrate/G76_M192_M871.cpp @@ -158,7 +158,7 @@ void GcodeSuite::G76() { return; } - process_subcommands_now_P(G28_STR); + process_subcommands_now(FPSTR(G28_STR)); } remember_feedrate_scaling_off(); diff --git a/Marlin/src/gcode/control/M605.cpp b/Marlin/src/gcode/control/M605.cpp index 08efaab59d..788659e7e2 100644 --- a/Marlin/src/gcode/control/M605.cpp +++ b/Marlin/src/gcode/control/M605.cpp @@ -110,7 +110,7 @@ set_duplication_enabled(false); #ifdef EVENT_GCODE_IDEX_AFTER_MODECHANGE - gcode.process_subcommands_now_P(PSTR(EVENT_GCODE_IDEX_AFTER_MODECHANGE)); + process_subcommands_now(F(EVENT_GCODE_IDEX_AFTER_MODECHANGE)); #endif } else if (!parser.seen('W')) // if no S or W parameter, the DXC mode gets reset to the user's default diff --git a/Marlin/src/gcode/feature/L6470/M916-918.cpp b/Marlin/src/gcode/feature/L6470/M916-918.cpp index ad0a91111d..8d614603ed 100644 --- a/Marlin/src/gcode/feature/L6470/M916-918.cpp +++ b/Marlin/src/gcode/feature/L6470/M916-918.cpp @@ -138,10 +138,10 @@ void GcodeSuite::M916() { do { // turn the motor(s) both directions sprintf_P(gcode_string, PSTR("G0 %s%03d F%03d"), temp_axis_string, uint16_t(position_min), uint16_t(final_feedrate)); - gcode.process_subcommands_now_P(gcode_string); + process_subcommands_now(gcode_string); sprintf_P(gcode_string, PSTR("G0 %s%03d F%03d"), temp_axis_string, uint16_t(position_max), uint16_t(final_feedrate)); - gcode.process_subcommands_now_P(gcode_string); + process_subcommands_now(gcode_string); // get the status after the motors have stopped planner.synchronize(); @@ -266,10 +266,10 @@ void GcodeSuite::M917() { DEBUG_ECHOLNPGM(" OCD threshold : ", (OCD_TH_val + 1) * 375); sprintf_P(gcode_string, PSTR("G0 %s%03d F%03d"), temp_axis_string, uint16_t(position_min), uint16_t(final_feedrate)); - gcode.process_subcommands_now_P(gcode_string); + process_subcommands_now(gcode_string); sprintf_P(gcode_string, PSTR("G0 %s%03d F%03d"), temp_axis_string, uint16_t(position_max), uint16_t(final_feedrate)); - gcode.process_subcommands_now_P(gcode_string); + process_subcommands_now(gcode_string); planner.synchronize(); @@ -308,7 +308,7 @@ void GcodeSuite::M917() { L64xxManager.set_param(axis_index[j], L6470_KVAL_HOLD, kval_hold); } DEBUG_ECHOLNPGM("."); - gcode.reset_stepper_timeout(); // keep steppers powered + reset_stepper_timeout(); // keep steppers powered watchdog_refresh(); safe_delay(5000); status_composite_temp = 0; @@ -615,10 +615,10 @@ void GcodeSuite::M918() { DEBUG_ECHOLNPGM("...feedrate = ", current_feedrate); sprintf_P(gcode_string, PSTR("G0 %s%03d F%03d"), temp_axis_string, uint16_t(position_min), uint16_t(current_feedrate)); - gcode.process_subcommands_now_P(gcode_string); + process_subcommands_now(gcode_string); sprintf_P(gcode_string, PSTR("G0 %s%03d F%03d"), temp_axis_string, uint16_t(position_max), uint16_t(current_feedrate)); - gcode.process_subcommands_now_P(gcode_string); + process_subcommands_now(gcode_string); planner.synchronize(); diff --git a/Marlin/src/gcode/feature/clean/G12.cpp b/Marlin/src/gcode/feature/clean/G12.cpp index b19932eb98..a0b87b1abc 100644 --- a/Marlin/src/gcode/feature/clean/G12.cpp +++ b/Marlin/src/gcode/feature/clean/G12.cpp @@ -50,7 +50,7 @@ void GcodeSuite::G12() { #ifdef WIPE_SEQUENCE_COMMANDS if (!parser.seen_any()) { - gcode.process_subcommands_now_P(PSTR(WIPE_SEQUENCE_COMMANDS)); + process_subcommands_now(F(WIPE_SEQUENCE_COMMANDS)); return; } #endif diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 126ceadb3b..acc79cb154 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -243,7 +243,7 @@ void GcodeSuite::dwell(millis_t time) { host_action(PSTR(ACTION_ON_G29_RECOVER)); #endif #ifdef G29_RECOVER_COMMANDS - process_subcommands_now_P(PSTR(G29_RECOVER_COMMANDS)); + process_subcommands_now(F(G29_RECOVER_COMMANDS)); #endif } @@ -256,7 +256,7 @@ void GcodeSuite::dwell(millis_t time) { host_action(PSTR(ACTION_ON_G29_FAILURE)); #endif #ifdef G29_FAILURE_COMMANDS - process_subcommands_now_P(PSTR(G29_FAILURE_COMMANDS)); + process_subcommands_now(F(G29_FAILURE_COMMANDS)); #endif #if ENABLED(G29_HALT_ON_FAILURE) #ifdef ACTION_ON_CANCEL @@ -286,7 +286,7 @@ void GcodeSuite::dwell(millis_t time) { TERN_(HOST_PROMPT_SUPPORT, host_action_prompt_end()); #ifdef G29_SUCCESS_COMMANDS - process_subcommands_now_P(PSTR(G29_SUCCESS_COMMANDS)); + process_subcommands_now(F(G29_SUCCESS_COMMANDS)); #endif } @@ -1101,7 +1101,8 @@ void GcodeSuite::process_next_command() { * G-code "macros" to be called from within other G-code handlers. */ -void GcodeSuite::process_subcommands_now_P(PGM_P pgcode) { +void GcodeSuite::process_subcommands_now(FSTR_P fgcode) { + PGM_P pgcode = FTOP(fgcode); char * const saved_cmd = parser.command_ptr; // Save the parser state for (;;) { PGM_P const delim = strchr_P(pgcode, '\n'); // Get address of next newline diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 2173c5cab1..0106f002c2 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -397,11 +397,11 @@ public: static void process_next_command(); // Execute G-code in-place, preserving current G-code parameters - static void process_subcommands_now_P(PGM_P pgcode); + static void process_subcommands_now(FSTR_P fgcode); static void process_subcommands_now(char * gcode); static inline void home_all_axes(const bool keep_leveling=false) { - process_subcommands_now_P(keep_leveling ? G28_STR : TERN(CAN_SET_LEVELING_AFTER_G28, PSTR("G28L0"), G28_STR)); + process_subcommands_now(keep_leveling ? FPSTR(G28_STR) : TERN(CAN_SET_LEVELING_AFTER_G28, F("G28L0"), FPSTR(G28_STR))); } #if EITHER(HAS_AUTO_REPORTING, HOST_KEEPALIVE_FEATURE) diff --git a/Marlin/src/gcode/motion/G2_G3.cpp b/Marlin/src/gcode/motion/G2_G3.cpp index 33167d9dff..0c7bdc7a3a 100644 --- a/Marlin/src/gcode/motion/G2_G3.cpp +++ b/Marlin/src/gcode/motion/G2_G3.cpp @@ -403,7 +403,7 @@ void GcodeSuite::G2_G3(const bool clockwise) { else { #if ENABLED(CNC_WORKSPACE_PLANES) char achar, bchar; - switch (gcode.workspace_plane) { + switch (workspace_plane) { default: case GcodeSuite::PLANE_XY: achar = 'I'; bchar = 'J'; break; case GcodeSuite::PLANE_YZ: achar = 'J'; bchar = 'K'; break; diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp index c638dc17ee..a75d4cd816 100644 --- a/Marlin/src/gcode/queue.cpp +++ b/Marlin/src/gcode/queue.cpp @@ -693,8 +693,8 @@ void GCodeQueue::advance() { void GCodeQueue::report_buffer_statistics() { SERIAL_ECHOLNPGM("D576" - " P:", planner.moves_free(), " ", -queue.planner_buffer_underruns, " (", queue.max_planner_buffer_empty_duration, ")" - " B:", BUFSIZE - ring_buffer.length, " ", -queue.command_buffer_underruns, " (", queue.max_command_buffer_empty_duration, ")" + " P:", planner.moves_free(), " ", -planner_buffer_underruns, " (", max_planner_buffer_empty_duration, ")" + " B:", BUFSIZE - ring_buffer.length, " ", -command_buffer_underruns, " (", max_command_buffer_empty_duration, ")" ); command_buffer_underruns = planner_buffer_underruns = 0; max_command_buffer_empty_duration = max_planner_buffer_empty_duration = 0; @@ -717,8 +717,8 @@ void GCodeQueue::advance() { NOLESS(max_planner_buffer_empty_duration, planner_buffer_empty_duration); // if it's longer than the currently tracked max duration, replace it } - if (queue.auto_buffer_report_interval && ELAPSED(ms, queue.next_buffer_report_ms)) { - queue.next_buffer_report_ms = ms + 1000UL * queue.auto_buffer_report_interval; + if (auto_buffer_report_interval && ELAPSED(ms, next_buffer_report_ms)) { + next_buffer_report_ms = ms + 1000UL * auto_buffer_report_interval; PORT_REDIRECT(SERIAL_BOTH); report_buffer_statistics(); PORT_RESTORE(); diff --git a/Marlin/src/gcode/sd/M1001.cpp b/Marlin/src/gcode/sd/M1001.cpp index 032ec1f198..c5003cabac 100644 --- a/Marlin/src/gcode/sd/M1001.cpp +++ b/Marlin/src/gcode/sd/M1001.cpp @@ -78,10 +78,10 @@ void GcodeSuite::M1001() { // Report total print time const bool long_print = print_job_timer.duration() > 60; - if (long_print) gcode.process_subcommands_now_P(PSTR("M31")); + if (long_print) process_subcommands_now(F("M31")); // Stop the print job timer - gcode.process_subcommands_now_P(PSTR("M77")); + process_subcommands_now(F("M77")); // Set the progress bar "done" state TERN_(LCD_SET_PROGRESS_MANUALLY, ui.set_progress_done()); @@ -105,7 +105,7 @@ void GcodeSuite::M1001() { // Inject SD_FINISHED_RELEASECOMMAND, if any #ifdef SD_FINISHED_RELEASECOMMAND - gcode.process_subcommands_now_P(PSTR(SD_FINISHED_RELEASECOMMAND)); + process_subcommands_now(F(SD_FINISHED_RELEASECOMMAND)); #endif TERN_(EXTENSIBLE_UI, ExtUI::onPrintFinished()); diff --git a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp index 065dce713b..df0fbfcb6e 100644 --- a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp +++ b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp @@ -2181,7 +2181,7 @@ void SetMoveZto0() { dtostrf(Y_CENTER, 1, 1, str_2) #endif ); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); planner.synchronize(); ui.set_status_P(PSTR("Now adjust Z Offset")); HMI_AudioFeedback(true); @@ -2194,7 +2194,7 @@ void SetPID(celsius_t t, heater_id_t h) { dtostrf(X_CENTER, 1, 1, str_1), dtostrf(Y_CENTER, 1, 1, str_2) ); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); planner.synchronize(); thermalManager.PID_autotune(t, h, HMI_data.PidCycles, true); } @@ -2385,7 +2385,7 @@ void LevBed(uint8_t point) { #if HAS_ONESTEP_LEVELING planner.synchronize(); - gcode.process_subcommands_now_P(PSTR("M420S0\nG28O")); + gcode.process_subcommands_now(F("M420S0\nG28O")); planner.synchronize(); zval = probe.probe_at_point(xpos, ypos, PROBE_PT_STOW); sprintf_P(cmd, PSTR(fmt), @@ -2411,7 +2411,7 @@ void LevBedC () { LevBed(4); } void ManualMeshStart(){ ui.set_status_P(GET_TEXT(MSG_UBL_BUILD_MESH_MENU)); - gcode.process_subcommands_now_P(PSTR("G28 XYO\nG28 Z\nM211 S0\nG29S1")); + gcode.process_subcommands_now(F("G28 XYO\nG28 Z\nM211 S0\nG29S1")); planner.synchronize(); #ifdef MANUAL_PROBE_START_Z const uint8_t line = CurrentMenu->line(MMeshMoveZItem->pos); @@ -2429,7 +2429,7 @@ void LevBedC () { LevBed(4); } void SetMMeshMoveZ() { SetPFloatOnClick(-1, 1, 2, planner.synchronize, LiveMeshMoveZ);} void ManualMeshContinue(){ - gcode.process_subcommands_now_P(PSTR("G29S2")); + gcode.process_subcommands_now(F("G29S2")); planner.synchronize(); MMeshMoveZItem->draw(CurrentMenu->line(MMeshMoveZItem->pos)); } diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 9f50b2f287..3edd1e919b 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -207,7 +207,7 @@ CrealityDWINClass CrealityDWIN; void manual_value_update(bool undefined=false) { sprintf_P(cmd, PSTR("M421 I%i J%i Z%s %s"), mesh_x, mesh_y, dtostrf(current_position.z, 1, 3, str_1), undefined ? "N" : ""); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); planner.synchronize(); } @@ -267,7 +267,7 @@ CrealityDWINClass CrealityDWIN; void manual_value_update() { sprintf_P(cmd, PSTR("G29 I%i J%i Z%s"), mesh_x, mesh_y, dtostrf(current_position.z, 1, 3, str_1)); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); planner.synchronize(); } @@ -283,9 +283,9 @@ CrealityDWINClass CrealityDWIN; else { CrealityDWIN.Popup_Handler(MoveWait); sprintf_P(cmd, PSTR("G0 F300 Z%s"), dtostrf(Z_CLEARANCE_BETWEEN_PROBES, 1, 3, str_1)); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); sprintf_P(cmd, PSTR("G42 F4000 I%i J%i"), mesh_x, mesh_y); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); planner.synchronize(); current_position.z = goto_mesh_value ? Z_VALUES_ARR[mesh_x][mesh_y] : Z_CLEARANCE_BETWEEN_PROBES; planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder); @@ -1132,7 +1132,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ } Popup_Handler(FilChange); sprintf_P(cmd, PSTR("M600 B1 R%i"), thermalManager.temp_hotend[0].target); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); } #endif } @@ -1172,7 +1172,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ Draw_Menu_Item(row, ICON_MoveX, F("Home X")); else { Popup_Handler(Home); - gcode.process_subcommands_now_P(PSTR("G28 X")); + gcode.process_subcommands_now(F("G28 X")); planner.synchronize(); Redraw_Menu(); } @@ -1182,7 +1182,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ Draw_Menu_Item(row, ICON_MoveY, F("Home Y")); else { Popup_Handler(Home); - gcode.process_subcommands_now_P(PSTR("G28 Y")); + gcode.process_subcommands_now(F("G28 Y")); planner.synchronize(); Redraw_Menu(); } @@ -1192,7 +1192,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ Draw_Menu_Item(row, ICON_MoveZ, F("Home Z")); else { Popup_Handler(Home); - gcode.process_subcommands_now_P(PSTR("G28 Z")); + gcode.process_subcommands_now(F("G28 Z")); planner.synchronize(); Redraw_Menu(); } @@ -1201,7 +1201,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ if (draw) Draw_Menu_Item(row, ICON_SetHome, F("Set Home Position")); else { - gcode.process_subcommands_now_P(PSTR("G92 X0 Y0 Z0")); + gcode.process_subcommands_now(F("G92 X0 Y0 Z0")); AudioFeedback(); } break; @@ -1366,14 +1366,14 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ if (use_probe) { #if HAS_BED_PROBE sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf(PROBE_X_MIN, 1, 3, str_1), dtostrf(PROBE_Y_MIN, 1, 3, str_2)); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); planner.synchronize(); Popup_Handler(ManualProbing); #endif } else { sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf(corner_pos, 1, 3, str_1), dtostrf(corner_pos, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); planner.synchronize(); Redraw_Menu(); } @@ -1387,14 +1387,14 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ if (use_probe) { #if HAS_BED_PROBE sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf(PROBE_X_MIN, 1, 3, str_1), dtostrf(PROBE_Y_MAX, 1, 3, str_2)); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); planner.synchronize(); Popup_Handler(ManualProbing); #endif } else { sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf(corner_pos, 1, 3, str_1), dtostrf((Y_BED_SIZE + Y_MIN_POS) - corner_pos, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); planner.synchronize(); Redraw_Menu(); } @@ -1408,14 +1408,14 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ if (use_probe) { #if HAS_BED_PROBE sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf(PROBE_X_MAX, 1, 3, str_1), dtostrf(PROBE_Y_MAX, 1, 3, str_2)); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); planner.synchronize(); Popup_Handler(ManualProbing); #endif } else { sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf((X_BED_SIZE + X_MIN_POS) - corner_pos, 1, 3, str_1), dtostrf((Y_BED_SIZE + Y_MIN_POS) - corner_pos, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); planner.synchronize(); Redraw_Menu(); } @@ -1429,14 +1429,14 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ if (use_probe) { #if HAS_BED_PROBE sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf(PROBE_X_MAX, 1, 3, str_1), dtostrf(PROBE_Y_MIN, 1, 3, str_2)); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); planner.synchronize(); Popup_Handler(ManualProbing); #endif } else { sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf((X_BED_SIZE + X_MIN_POS) - corner_pos, 1, 3, str_1), dtostrf(corner_pos, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); planner.synchronize(); Redraw_Menu(); } @@ -1450,14 +1450,14 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ if (use_probe) { #if HAS_BED_PROBE sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf(X_MAX_POS / 2.0f - probe.offset.x, 1, 3, str_1), dtostrf(Y_MAX_POS / 2.0f - probe.offset.y, 1, 3, str_2)); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); planner.synchronize(); Popup_Handler(ManualProbing); #endif } else { sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf((X_BED_SIZE + X_MIN_POS) / 2.0f, 1, 3, str_1), dtostrf((Y_BED_SIZE + Y_MIN_POS) / 2.0f, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); planner.synchronize(); Redraw_Menu(); } @@ -1500,16 +1500,16 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ Draw_Menu_Item(row, ICON_Homing, F("Home Z Axis")); else { Popup_Handler(Home); - gcode.process_subcommands_now_P(PSTR("G28 Z")); + gcode.process_subcommands_now(F("G28 Z")); Popup_Handler(MoveWait); #if ENABLED(Z_SAFE_HOMING) planner.synchronize(); sprintf_P(cmd, PSTR("G0 F4000 X%s Y%s"), dtostrf(Z_SAFE_HOMING_X_POINT, 1, 3, str_1), dtostrf(Z_SAFE_HOMING_Y_POINT, 1, 3, str_2)); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); #else - gcode.process_subcommands_now_P(PSTR("G0 F4000 X117.5 Y117.5")); + gcode.process_subcommands_now(F("G0 F4000 X117.5 Y117.5")); #endif - gcode.process_subcommands_now_P(PSTR("G0 F300 Z0")); + gcode.process_subcommands_now(F("G0 F300 Z0")); planner.synchronize(); Redraw_Menu(); } @@ -1529,11 +1529,11 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if ENABLED(Z_SAFE_HOMING) planner.synchronize(); sprintf_P(cmd, PSTR("G0 F4000 X%s Y%s"), dtostrf(Z_SAFE_HOMING_X_POINT, 1, 3, str_1), dtostrf(Z_SAFE_HOMING_Y_POINT, 1, 3, str_2)); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); #else - gcode.process_subcommands_now_P(PSTR("G0 F4000 X117.5 Y117.5")); + gcode.process_subcommands_now(F("G0 F4000 X117.5 Y117.5")); #endif - gcode.process_subcommands_now_P(PSTR("G0 F300 Z0")); + gcode.process_subcommands_now(F("G0 F300 Z0")); planner.synchronize(); Redraw_Menu(); } @@ -1555,7 +1555,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ else { if (zoffsetvalue < MAX_Z_OFFSET) { if (liveadjust) { - gcode.process_subcommands_now_P(PSTR("M290 Z0.01")); + gcode.process_subcommands_now(F("M290 Z0.01")); planner.synchronize(); } zoffsetvalue += 0.01; @@ -1569,7 +1569,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ else { if (zoffsetvalue > MIN_Z_OFFSET) { if (liveadjust) { - gcode.process_subcommands_now_P(PSTR("M290 Z-0.01")); + gcode.process_subcommands_now(F("M290 Z-0.01")); planner.synchronize(); } zoffsetvalue -= 0.01; @@ -1737,7 +1737,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ thermalManager.wait_for_hotend(0); } Popup_Handler(FilLoad); - gcode.process_subcommands_now_P(PSTR("M701")); + gcode.process_subcommands_now(F("M701")); planner.synchronize(); Redraw_Menu(); } @@ -1756,7 +1756,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ thermalManager.wait_for_hotend(0); } Popup_Handler(FilLoad, true); - gcode.process_subcommands_now_P(PSTR("M702")); + gcode.process_subcommands_now(F("M702")); planner.synchronize(); Redraw_Menu(); } @@ -1775,7 +1775,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ } Popup_Handler(FilChange); sprintf_P(cmd, PSTR("M600 B1 R%i"), thermalManager.temp_hotend[0].target); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); } } break; @@ -2032,7 +2032,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ else { Popup_Handler(PIDWait); sprintf_P(cmd, PSTR("M303 E0 C%i S%i U1"), PID_cycles, PID_e_temp); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); planner.synchronize(); Redraw_Menu(); } @@ -2099,7 +2099,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ else { Popup_Handler(PIDWait); sprintf_P(cmd, PSTR("M303 E-1 C%i S%i U1"), PID_cycles, PID_bed_temp); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); planner.synchronize(); Redraw_Menu(); } @@ -3045,7 +3045,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ Draw_Menu_Item(row, ICON_StepY, F("M48 Probe Test")); else { sprintf_P(cmd, PSTR("G28O\nM48 X%s Y%s P%i"), dtostrf((X_BED_SIZE + X_MIN_POS) / 2.0f, 1, 3, str_1), dtostrf((Y_BED_SIZE + Y_MIN_POS) / 2.0f, 1, 3, str_2), testcount); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); } break; case PROBE_TEST_COUNT: @@ -3157,11 +3157,12 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ Popup_Handler(Home); gcode.home_all_axes(true); Popup_Handler(Level); - if (mesh_conf.tilt_grid > 1) + if (mesh_conf.tilt_grid > 1) { sprintf_P(cmd, PSTR("G29 J%i"), mesh_conf.tilt_grid); + gcode.process_subcommands_now(cmd); + } else - sprintf_P(cmd, PSTR("G29 J")); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(F("G29 J")); planner.synchronize(); Redraw_Menu(); } @@ -3189,8 +3190,8 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #endif #if HAS_BED_PROBE Popup_Handler(Level); - gcode.process_subcommands_now_P(PSTR("G29 P0\nG29 P1")); - gcode.process_subcommands_now_P(PSTR("G29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nM420 S1")); + gcode.process_subcommands_now(F("G29 P0\nG29 P1")); + gcode.process_subcommands_now(F("G29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nM420 S1")); planner.synchronize(); Update_Status("Probed all reachable points"); Popup_Handler(SaveLevel); @@ -3205,7 +3206,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #endif #elif HAS_BED_PROBE Popup_Handler(Level); - gcode.process_subcommands_now_P(PSTR("G29")); + gcode.process_subcommands_now(F("G29")); planner.synchronize(); Popup_Handler(SaveLevel); #else @@ -3213,7 +3214,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ set_bed_leveling_enabled(false); gridpoint = 1; Popup_Handler(MoveWait); - gcode.process_subcommands_now_P(PSTR("G29")); + gcode.process_subcommands_now(F("G29")); planner.synchronize(); Draw_Menu(ManualMesh); #endif @@ -3296,7 +3297,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ Popup_Handler(MeshSlot); break; } - gcode.process_subcommands_now_P(PSTR("G29 L")); + gcode.process_subcommands_now(F("G29 L")); planner.synchronize(); AudioFeedback(true); } @@ -3309,7 +3310,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ Popup_Handler(MeshSlot); break; } - gcode.process_subcommands_now_P(PSTR("G29 S")); + gcode.process_subcommands_now(F("G29 S")); planner.synchronize(); AudioFeedback(true); } @@ -3405,7 +3406,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ Draw_Menu_Item(row, ICON_ResumeEEPROM, F("Convert Mesh to Plane")); else { if (mesh_conf.create_plane_from_mesh()) break; - gcode.process_subcommands_now_P(PSTR("M420 S1")); + gcode.process_subcommands_now(F("M420 S1")); planner.synchronize(); AudioFeedback(true); } @@ -3513,7 +3514,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ Draw_Menu_Item(row, ICON_Axis, F("Microstep Up")); else if (Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] < MAX_Z_OFFSET) { Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] += 0.01; - gcode.process_subcommands_now_P(PSTR("M290 Z0.01")); + gcode.process_subcommands_now(F("M290 Z0.01")); planner.synchronize(); current_position.z += 0.01f; sync_plan_position(); @@ -3525,7 +3526,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ Draw_Menu_Item(row, ICON_AxisD, F("Microstep Down")); else if (Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] > MIN_Z_OFFSET) { Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] -= 0.01; - gcode.process_subcommands_now_P(PSTR("M290 Z-0.01")); + gcode.process_subcommands_now(F("M290 Z-0.01")); planner.synchronize(); current_position.z -= 0.01f; sync_plan_position(); @@ -3596,7 +3597,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ mesh_conf.manual_move(); } else { - gcode.process_subcommands_now_P(PSTR("G29 S")); + gcode.process_subcommands_now(F("G29 S")); planner.synchronize(); AudioFeedback(true); Draw_Menu(Leveling, LEVELING_GET_MESH); @@ -3634,7 +3635,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ Draw_Menu_Item(row, ICON_Axis, F("Microstep Up")); else if (Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] < MAX_Z_OFFSET) { Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] += 0.01; - gcode.process_subcommands_now_P(PSTR("M290 Z0.01")); + gcode.process_subcommands_now(F("M290 Z0.01")); planner.synchronize(); current_position.z += 0.01f; sync_plan_position(); @@ -3646,7 +3647,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ Draw_Menu_Item(row, ICON_Axis, F("Microstep Down")); else if (Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] > MIN_Z_OFFSET) { Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] -= 0.01; - gcode.process_subcommands_now_P(PSTR("M290 Z-0.01")); + gcode.process_subcommands_now(F("M290 Z-0.01")); planner.synchronize(); current_position.z -= 0.01f; sync_plan_position(); @@ -3673,7 +3674,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ if (draw) Draw_Menu_Item(row, ICON_Back, F("Cancel")); else { - gcode.process_subcommands_now_P(PSTR("G29 A")); + gcode.process_subcommands_now(F("G29 A")); planner.synchronize(); set_bed_leveling_enabled(level_state); Draw_Menu(Leveling, LEVELING_GET_MESH); @@ -3688,13 +3689,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ } else if (gridpoint < GRID_MAX_POINTS) { Popup_Handler(MoveWait); - gcode.process_subcommands_now_P(PSTR("G29")); + gcode.process_subcommands_now(F("G29")); planner.synchronize(); gridpoint++; Redraw_Menu(); } else { - gcode.process_subcommands_now_P(PSTR("G29")); + gcode.process_subcommands_now(F("G29")); planner.synchronize(); AudioFeedback(settings.save()); Draw_Menu(Leveling, LEVELING_GET_MESH); @@ -3713,7 +3714,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ if (draw) Draw_Menu_Item(row, ICON_Axis, F("Microstep Up")); else if (current_position.z < MAX_Z_OFFSET) { - gcode.process_subcommands_now_P(PSTR("M290 Z0.01")); + gcode.process_subcommands_now(F("M290 Z0.01")); planner.synchronize(); current_position.z += 0.01f; sync_plan_position(); @@ -3724,7 +3725,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ if (draw) Draw_Menu_Item(row, ICON_AxisD, F("Microstep Down")); else if (current_position.z > MIN_Z_OFFSET) { - gcode.process_subcommands_now_P(PSTR("M290 Z-0.01")); + gcode.process_subcommands_now(F("M290 Z-0.01")); planner.synchronize(); current_position.z -= 0.01f; sync_plan_position(); @@ -3845,7 +3846,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ if (draw) Draw_Menu_Item(row, ICON_Axis, F("Z-Offset Up")); else if (zoffsetvalue < MAX_Z_OFFSET) { - gcode.process_subcommands_now_P(PSTR("M290 Z0.01")); + gcode.process_subcommands_now(F("M290 Z0.01")); zoffsetvalue += 0.01; Draw_Float(zoffsetvalue, row - 1, false, 100); } @@ -3854,7 +3855,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ if (draw) Draw_Menu_Item(row, ICON_AxisD, F("Z-Offset Down")); else if (zoffsetvalue > MIN_Z_OFFSET) { - gcode.process_subcommands_now_P(PSTR("M290 Z-0.01")); + gcode.process_subcommands_now(F("M290 Z-0.01")); zoffsetvalue -= 0.01; Draw_Float(zoffsetvalue, row - 2, false, 100); } @@ -3932,27 +3933,27 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case Prepare: Popup_Handler(FilChange); sprintf_P(cmd, PSTR("M600 B1 R%i"), thermalManager.temp_hotend[0].target); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); break; #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) case ChangeFilament: switch (last_selection) { case CHANGEFIL_LOAD: Popup_Handler(FilLoad); - gcode.process_subcommands_now_P("M701"); + gcode.process_subcommands_now(F("M701")); planner.synchronize(); Redraw_Menu(true, true, true); break; case CHANGEFIL_UNLOAD: Popup_Handler(FilLoad, true); - gcode.process_subcommands_now_P("M702"); + gcode.process_subcommands_now(F("M702")); planner.synchronize(); Redraw_Menu(true, true, true); break; case CHANGEFIL_CHANGE: Popup_Handler(FilChange); sprintf_P(cmd, PSTR("M600 B1 R%i"), thermalManager.temp_hotend[0].target); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); break; } break; @@ -4291,7 +4292,7 @@ void CrealityDWINClass::Value_Control() { } else if (active_menu == Tune && selection == TUNE_ZOFFSET) { sprintf_P(cmd, PSTR("M290 Z%s"), dtostrf((tempvalue / valueunit - zoffsetvalue), 1, 3, str_1)); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); } if (TERN0(HAS_HOTEND, valuepointer == &thermalManager.temp_hotend[0].pid.Ki) || TERN0(HAS_HEATED_BED, valuepointer == &thermalManager.temp_bed.pid.Ki)) tempvalue = scalePID_i(tempvalue); @@ -4490,11 +4491,11 @@ void CrealityDWINClass::Print_Screen_Control() { char cmnd[20]; #if HAS_HEATED_BED cmnd[sprintf_P(cmnd, PSTR("M140 S%i"), pausebed)] = '\0'; - gcode.process_subcommands_now_P(PSTR(cmnd)); + gcode.process_subcommands_now(cmnd); #endif #if HAS_EXTRUDERS cmnd[sprintf_P(cmnd, PSTR("M109 S%i"), pausetemp)] = '\0'; - gcode.process_subcommands_now_P(PSTR(cmnd)); + gcode.process_subcommands_now(cmnd); #endif TERN_(HAS_FAN, thermalManager.fan_speed[0] = pausefan); planner.synchronize(); @@ -4619,7 +4620,7 @@ void CrealityDWINClass::Popup_Control() { } Popup_Handler(FilChange); sprintf_P(cmd, PSTR("M600 B1 R%i"), thermalManager.temp_hotend[0].target); - gcode.process_subcommands_now_P(cmd); + gcode.process_subcommands_now(cmd); } } else @@ -4642,7 +4643,7 @@ void CrealityDWINClass::Popup_Control() { case SaveLevel: if (selection == 0) { #if ENABLED(AUTO_BED_LEVELING_UBL) - gcode.process_subcommands_now_P(PSTR("G29 S")); + gcode.process_subcommands_now(F("G29 S")); planner.synchronize(); AudioFeedback(true); #else diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp index 60c3790882..2ec67b2727 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp @@ -262,7 +262,7 @@ void DGUSScreenHandler::DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var) { void DGUSScreenHandler::SDPrintingFinished() { if (DGUSAutoTurnOff) { queue.exhaust(); - gcode.process_subcommands_now_P(PSTR("M81")); + gcode.process_subcommands_now(F("M81")); } GotoScreen(MKSLCD_SCREEN_PrintDone); } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/spinner_dialog_box.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/spinner_dialog_box.cpp index 9117bcee10..2493de795a 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/spinner_dialog_box.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/spinner_dialog_box.cpp @@ -99,7 +99,7 @@ void SpinnerDialogBox::enqueueAndWait(FSTR_P message, char *commands) { } void SpinnerDialogBox::onIdle() { - if (mydata.auto_hide && !commandsInQueue() && TERN1(HOST_KEEPALIVE_FEATURE, GcodeSuite::busy_state == GcodeSuite::NOT_BUSY)) { + if (mydata.auto_hide && !commandsInQueue() && TERN1(HOST_KEEPALIVE_FEATURE, gcode.busy_state == gcode.NOT_BUSY)) { mydata.auto_hide = false; hide(); } diff --git a/Marlin/src/lcd/extui/mks_ui/draw_baby_stepping.cpp b/Marlin/src/lcd/extui/mks_ui/draw_baby_stepping.cpp index c7e6a62341..65617fa9bb 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_baby_stepping.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_baby_stepping.cpp @@ -65,32 +65,32 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { switch (obj->mks_obj_id) { case ID_BABY_STEP_X_P: sprintf_P(baby_buf, PSTR("M290 X%s"), dtostrf(babystep_dist, 1, 3, str_1)); - gcode.process_subcommands_now_P(PSTR(baby_buf)); + gcode.process_subcommands_now(F(baby_buf)); has_adjust_z = 1; break; case ID_BABY_STEP_X_N: sprintf_P(baby_buf, PSTR("M290 X%s"), dtostrf(-babystep_dist, 1, 3, str_1)); - gcode.process_subcommands_now_P(PSTR(baby_buf)); + gcode.process_subcommands_now(F(baby_buf)); has_adjust_z = 1; break; case ID_BABY_STEP_Y_P: sprintf_P(baby_buf, PSTR("M290 Y%s"), dtostrf(babystep_dist, 1, 3, str_1)); - gcode.process_subcommands_now_P(PSTR(baby_buf)); + gcode.process_subcommands_now(F(baby_buf)); has_adjust_z = 1; break; case ID_BABY_STEP_Y_N: sprintf_P(baby_buf, PSTR("M290 Y%s"), dtostrf(-babystep_dist, 1, 3, str_1)); - gcode.process_subcommands_now_P(PSTR(baby_buf)); + gcode.process_subcommands_now(F(baby_buf)); has_adjust_z = 1; break; case ID_BABY_STEP_Z_P: sprintf_P(baby_buf, PSTR("M290 Z%s"), dtostrf(babystep_dist, 1, 3, str_1)); - gcode.process_subcommands_now_P(PSTR(baby_buf)); + gcode.process_subcommands_now(F(baby_buf)); has_adjust_z = 1; break; case ID_BABY_STEP_Z_N: sprintf_P(baby_buf, PSTR("M290 Z%s"), dtostrf(-babystep_dist, 1, 3, str_1)); - gcode.process_subcommands_now_P(PSTR(baby_buf)); + gcode.process_subcommands_now(F(baby_buf)); has_adjust_z = 1; break; case ID_BABY_STEP_DIST: diff --git a/Marlin/src/lcd/extui/mks_ui/draw_filament_change.cpp b/Marlin/src/lcd/extui/mks_ui/draw_filament_change.cpp index 8432c74b1a..61d212303b 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_filament_change.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_filament_change.cpp @@ -94,7 +94,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { case ID_FILAMNT_RETURN: #if HAS_MULTI_EXTRUDER if (uiCfg.print_state != IDLE && uiCfg.print_state != REPRINTED) - gcode.process_subcommands_now_P(uiCfg.extruderIndexBak == 1 ? PSTR("T1") : PSTR("T0")); + gcode.process_subcommands_now(uiCfg.extruderIndexBak == 1 ? F("T1") : F("T0")); #endif feedrate_mm_s = (float)uiCfg.moveSpeed_bak; if (uiCfg.print_state == PAUSED) diff --git a/Marlin/src/lcd/extui/mks_ui/draw_number_key.cpp b/Marlin/src/lcd/extui/mks_ui/draw_number_key.cpp index a3cb7f6c1c..630bb4efef 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_number_key.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_number_key.cpp @@ -404,7 +404,7 @@ static void set_value_confirm() { case z_sensitivity: TERN_(Z_SENSORLESS, stepperZ.homing_threshold(atoi(key_value))); break; case z2_sensitivity: TERN_(Z2_SENSORLESS, stepperZ2.homing_threshold(atoi(key_value))); break; } - gcode.process_subcommands_now_P(PSTR("M500")); + gcode.process_subcommands_now(F("M500")); } static void event_handler(lv_obj_t *obj, lv_event_t event) { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_printing.cpp b/Marlin/src/lcd/extui/mks_ui/draw_printing.cpp index 58bbbfbd5b..322d0581ca 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_printing.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_printing.cpp @@ -307,7 +307,7 @@ void setProBarRate() { #if HAS_SUICIDE if (gCfgItems.finish_power_off) { - gcode.process_subcommands_now_P(PSTR("M1001")); + gcode.process_subcommands_now(F("M1001")); queue.inject_P(PSTR("M81")); marlin_state = MF_RUNNING; } diff --git a/Marlin/src/lcd/extui/mks_ui/printer_operation.cpp b/Marlin/src/lcd/extui/mks_ui/printer_operation.cpp index 04d8f16fcc..8f5b89cf34 100644 --- a/Marlin/src/lcd/extui/mks_ui/printer_operation.cpp +++ b/Marlin/src/lcd/extui/mks_ui/printer_operation.cpp @@ -53,7 +53,7 @@ void printer_state_polling() { uiCfg.waitEndMoves = 0; planner.synchronize(); - gcode.process_subcommands_now_P(PSTR("M25")); + gcode.process_subcommands_now(F("M25")); // save the position uiCfg.current_x_position_bak = current_position.x; @@ -93,7 +93,7 @@ void printer_state_polling() { sprintf_P(public_buf_m, PSTR("G1 Z%s"), dtostrf(uiCfg.current_z_position_bak, 1, 1, str_1)); gcode.process_subcommands_now(public_buf_m); } - gcode.process_subcommands_now_P(M24_STR); + gcode.process_subcommands_now(FPSTR(M24_STR)); uiCfg.print_state = WORKING; start_print_time(); diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index 8f419205f3..e1998cdb2e 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -1310,17 +1310,17 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { if (ENABLED(EVENT_GCODE_TOOLCHANGE_ALWAYS_RUN) || !no_move) { #ifdef EVENT_GCODE_TOOLCHANGE_T0 if (new_tool == 0) - gcode.process_subcommands_now_P(PSTR(EVENT_GCODE_TOOLCHANGE_T0)); + gcode.process_subcommands_now(F(EVENT_GCODE_TOOLCHANGE_T0)); #endif #ifdef EVENT_GCODE_TOOLCHANGE_T1 if (new_tool == 1) - gcode.process_subcommands_now_P(PSTR(EVENT_GCODE_TOOLCHANGE_T1)); + gcode.process_subcommands_now(F(EVENT_GCODE_TOOLCHANGE_T1)); #endif #ifdef EVENT_GCODE_AFTER_TOOLCHANGE if (TERN1(DUAL_X_CARRIAGE, dual_x_carriage_mode == DXC_AUTO_PARK_MODE)) - gcode.process_subcommands_now_P(PSTR(EVENT_GCODE_AFTER_TOOLCHANGE)); + gcode.process_subcommands_now(F(EVENT_GCODE_AFTER_TOOLCHANGE)); #endif }