Skip to content

Commit 2b9ae0c

Browse files
committed
🎨 Apply F() to G-code subcommands
1 parent 433a27e commit 2b9ae0c

File tree

28 files changed

+136
-134
lines changed

28 files changed

+136
-134
lines changed

Marlin/src/feature/bedlevel/ubl/ubl.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -281,20 +281,20 @@ bool unified_bed_leveling::sanity_check() {
281281
}
282282
#endif
283283

284-
process_subcommands_now_P(G28_STR); // Home
285-
process_subcommands_now_P(PSTR(ALIGN_GCODE "\n" // Align multi z axis if available
286-
PROBE_GCODE "\n" // Build mesh with available hardware
287-
"G29P3\nG29P3")); // Ensure mesh is complete by running smart fill twice
284+
process_subcommands_now(FPSTR(G28_STR)); // Home
285+
process_subcommands_now(F(ALIGN_GCODE "\n" // Align multi z axis if available
286+
PROBE_GCODE "\n" // Build mesh with available hardware
287+
"G29P3\nG29P3")); // Ensure mesh is complete by running smart fill twice
288288

289289
if (parser.seenval('S')) {
290290
char umw_gcode[32];
291291
sprintf_P(umw_gcode, PSTR("G29S%i"), parser.value_int());
292292
queue.inject(umw_gcode);
293293
}
294294

295-
process_subcommands_now_P(PSTR("G29A\nG29F10\n" // Set UBL Active & Fade 10
296-
"M140S0\nM104S0\n" // Turn off heaters
297-
"M500")); // Store settings
295+
process_subcommands_now(F("G29A\nG29F10\n" // Set UBL Active & Fade 10
296+
"M140S0\nM104S0\n" // Turn off heaters
297+
"M500")); // Store settings
298298
}
299299

300300
#endif // UBL_MESH_WIZARD

Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ void unified_bed_leveling::G29() {
656656
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Z Probe End Script: ", Z_PROBE_END_SCRIPT);
657657
if (probe_deployed) {
658658
planner.synchronize();
659-
gcode.process_subcommands_now_P(PSTR(Z_PROBE_END_SCRIPT));
659+
gcode.process_subcommands_now(F(Z_PROBE_END_SCRIPT));
660660
}
661661
#else
662662
UNUSED(probe_deployed);

Marlin/src/feature/power.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void Power::power_on() {
8282
TERN_(HAS_TRINAMIC_CONFIG, safe_delay(PSU_POWERUP_DELAY));
8383

8484
#ifdef PSU_POWERUP_GCODE
85-
GcodeSuite::process_subcommands_now_P(PSTR(PSU_POWERUP_GCODE));
85+
gcode.process_subcommands_now(F(PSU_POWERUP_GCODE));
8686
#endif
8787
}
8888

@@ -95,7 +95,7 @@ void Power::power_off() {
9595
if (!psu_on) return;
9696

9797
#ifdef PSU_POWEROFF_GCODE
98-
GcodeSuite::process_subcommands_now_P(PSTR(PSU_POWEROFF_GCODE));
98+
gcode.process_subcommands_now(F(PSU_POWEROFF_GCODE));
9999
#endif
100100

101101
#if ENABLED(PS_OFF_SOUND)

Marlin/src/feature/powerloss.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
244244

245245
#if POWER_LOSS_RETRACT_LEN
246246
// Retract filament now
247-
gcode.process_subcommands_now_P(PSTR("G1 F3000 E-" STRINGIFY(POWER_LOSS_RETRACT_LEN)));
247+
gcode.process_subcommands_now(F("G1 F3000 E-" STRINGIFY(POWER_LOSS_RETRACT_LEN)));
248248
#endif
249249

250250
#if POWER_LOSS_ZRAISE
@@ -337,7 +337,7 @@ void PrintJobRecovery::resume() {
337337

338338
#if HAS_LEVELING
339339
// Make sure leveling is off before any G92 and G28
340-
gcode.process_subcommands_now_P(PSTR("M420 S0 Z0"));
340+
gcode.process_subcommands_now(F("M420 S0 Z0"));
341341
#endif
342342

343343
#if HAS_HEATED_BED
@@ -373,7 +373,7 @@ void PrintJobRecovery::resume() {
373373
// establish the current position as best we can.
374374
//
375375

376-
gcode.process_subcommands_now_P(PSTR("G92.9E0")); // Reset E to 0
376+
gcode.process_subcommands_now(F("G92.9E0")); // Reset E to 0
377377

378378
#if Z_HOME_TO_MAX
379379

@@ -410,7 +410,7 @@ void PrintJobRecovery::resume() {
410410
}
411411

412412
// Home XY with no Z raise, and also home Z here if Z isn't homing down below.
413-
gcode.process_subcommands_now_P(PSTR("G28R0" TERN_(HOME_XY_ONLY, "XY"))); // No raise during G28
413+
gcode.process_subcommands_now(F("G28R0" TERN_(HOME_XY_ONLY, "XY"))); // No raise during G28
414414

415415
#endif
416416

@@ -513,7 +513,7 @@ void PrintJobRecovery::resume() {
513513

514514
// Un-retract if there was a retract at outage
515515
#if ENABLED(BACKUP_POWER_SUPPLY) && POWER_LOSS_RETRACT_LEN > 0
516-
gcode.process_subcommands_now_P(PSTR("G1E" STRINGIFY(POWER_LOSS_RETRACT_LEN) "F3000"));
516+
gcode.process_subcommands_now(F("G1E" STRINGIFY(POWER_LOSS_RETRACT_LEN) "F3000"));
517517
#endif
518518

519519
// Additional purge on resume if configured
@@ -523,7 +523,7 @@ void PrintJobRecovery::resume() {
523523
#endif
524524

525525
#if ENABLED(NOZZLE_CLEAN_FEATURE)
526-
gcode.process_subcommands_now_P(PSTR("G12"));
526+
gcode.process_subcommands_now(F("G12"));
527527
#endif
528528

529529
// Move back over to the saved XY

Marlin/src/gcode/bedlevel/G35.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void GcodeSuite::G35() {
9292
TERN_(HAS_DUPLICATION_MODE, set_duplication_enabled(false));
9393

9494
// Home only Z axis when X and Y is trusted, otherwise all axes, if needed before this procedure
95-
if (!all_axes_trusted()) process_subcommands_now_P(PSTR("G28Z"));
95+
if (!all_axes_trusted()) process_subcommands_now(F("G28Z"));
9696

9797
bool err_break = false;
9898

Marlin/src/gcode/bedlevel/abl/G29.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ G29_TYPE GcodeSuite::G29() {
244244

245245
// Send 'N' to force homing before G29 (internal only)
246246
if (parser.seen_test('N'))
247-
process_subcommands_now_P(TERN(CAN_SET_LEVELING_AFTER_G28, PSTR("G28L0"), G28_STR));
247+
process_subcommands_now(TERN(CAN_SET_LEVELING_AFTER_G28, F("G28L0"), FPSTR(G28_STR)));
248248

249249
// Don't allow auto-leveling without homing first
250250
if (homing_needed_error()) G29_RETURN(false);
@@ -882,7 +882,7 @@ G29_TYPE GcodeSuite::G29() {
882882
#ifdef Z_PROBE_END_SCRIPT
883883
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Z Probe End Script: ", Z_PROBE_END_SCRIPT);
884884
planner.synchronize();
885-
process_subcommands_now_P(PSTR(Z_PROBE_END_SCRIPT));
885+
process_subcommands_now(F(Z_PROBE_END_SCRIPT));
886886
#endif
887887

888888
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_CompletedLeveling());

Marlin/src/gcode/calibrate/G34.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void GcodeSuite::G34() {
4747
TemporaryGlobalEndstopsState unlock_z(false);
4848

4949
#ifdef GANTRY_CALIBRATION_COMMANDS_PRE
50-
gcode.process_subcommands_now_P(PSTR(GANTRY_CALIBRATION_COMMANDS_PRE));
50+
process_subcommands_now(F(GANTRY_CALIBRATION_COMMANDS_PRE));
5151
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Sub Commands Processed");
5252
#endif
5353

@@ -148,7 +148,7 @@ void GcodeSuite::G34() {
148148

149149
#ifdef GANTRY_CALIBRATION_COMMANDS_POST
150150
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Running Post Commands");
151-
gcode.process_subcommands_now_P(PSTR(GANTRY_CALIBRATION_COMMANDS_POST));
151+
process_subcommands_now(F(GANTRY_CALIBRATION_COMMANDS_POST));
152152
#endif
153153

154154
SET_SOFT_ENDSTOP_LOOSE(false);

Marlin/src/gcode/calibrate/G34_M422.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ void GcodeSuite::G34() {
433433
// After this operation the z position needs correction
434434
set_axis_never_homed(Z_AXIS);
435435
// Home Z after the alignment procedure
436-
process_subcommands_now_P(PSTR("G28Z"));
436+
process_subcommands_now(F("G28Z"));
437437
#else
438438
// Use the probed height from the last iteration to determine the Z height.
439439
// z_measured_min is used, because all steppers are aligned to z_measured_min.

Marlin/src/gcode/calibrate/G425.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ inline void calibrate_all() {
709709
void GcodeSuite::G425() {
710710

711711
#ifdef CALIBRATION_SCRIPT_PRE
712-
GcodeSuite::process_subcommands_now_P(PSTR(CALIBRATION_SCRIPT_PRE));
712+
process_subcommands_now(F(CALIBRATION_SCRIPT_PRE));
713713
#endif
714714

715715
if (homing_needed_error()) return;
@@ -745,7 +745,7 @@ void GcodeSuite::G425() {
745745
SET_SOFT_ENDSTOP_LOOSE(false);
746746

747747
#ifdef CALIBRATION_SCRIPT_POST
748-
GcodeSuite::process_subcommands_now_P(PSTR(CALIBRATION_SCRIPT_POST));
748+
process_subcommands_now(F(CALIBRATION_SCRIPT_POST));
749749
#endif
750750
}
751751

Marlin/src/gcode/calibrate/G76_M192_M871.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ void GcodeSuite::G76() {
158158
return;
159159
}
160160

161-
process_subcommands_now_P(G28_STR);
161+
process_subcommands_now(FPSTR(G28_STR));
162162
}
163163

164164
remember_feedrate_scaling_off();

0 commit comments

Comments
 (0)