@@ -112,8 +112,7 @@ void PrintJobRecovery::check() {
112112 if (card.isMounted ()) {
113113 load ();
114114 if (!valid ()) return cancel ();
115- queue.inject_P (PSTR (" M1000 S" ));
116- TERN_ (DWIN_CREALITY_LCD, dwin_flag = true );
115+ queue.inject_P (PSTR (" M1000S" ));
117116 }
118117}
119118
@@ -227,6 +226,10 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=0*/
227226 // Elapsed print job time
228227 info.print_job_elapsed = print_job_timer.duration ();
229228
229+ // Misc. Marlin flags
230+ info.flag .dryrun = !!(marlin_debug_flags & MARLIN_DEBUG_DRYRUN);
231+ info.flag .allow_cold_extrusion = TERN0 (PREVENT_COLD_EXTRUSION, thermalManager.allow_cold_extrude );
232+
230233 write ();
231234 }
232235}
@@ -326,6 +329,12 @@ void PrintJobRecovery::resume() {
326329
327330 const uint32_t resume_sdpos = info.sdpos ; // Get here before the stepper ISR overwrites it
328331
332+ // Apply the dry-run flag if enabled
333+ if (info.flag .dryrun ) marlin_debug_flags |= MARLIN_DEBUG_DRYRUN;
334+
335+ // Restore cold extrusion permission
336+ TERN_ (PREVENT_COLD_EXTRUSION, thermalManager.allow_cold_extrude = info.flag .allow_cold_extrusion );
337+
329338 #if HAS_LEVELING
330339 // Make sure leveling is off before any G92 and G28
331340 gcode.process_subcommands_now_P (PSTR (" M420 S0 Z0" ));
@@ -337,7 +346,7 @@ void PrintJobRecovery::resume() {
337346 // If Z homing goes to max, just reset E and home all
338347 gcode.process_subcommands_now_P (PSTR (
339348 " G92.9 E0\n "
340- " G28R0" TERN_ (MARLIN_DEV_MODE, " S " )
349+ " G28R0"
341350 ));
342351
343352 #else // "G92.9 E0 ..."
@@ -358,7 +367,6 @@ void PrintJobRecovery::resume() {
358367
359368 gcode.process_subcommands_now_P (PSTR (
360369 " G28R0" // No raise during G28
361- TERN_ (MARLIN_DEV_MODE, " S" ) // Simulated Homing
362370 TERN_ (IS_CARTESIAN, " XY" ) // Don't home Z on Cartesian
363371 ));
364372
@@ -498,13 +506,23 @@ void PrintJobRecovery::resume() {
498506 LOOP_XYZ (i) update_workspace_offset ((AxisEnum)i);
499507 #endif
500508
509+ #if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
510+ const uint8_t old_flags = marlin_debug_flags;
511+ marlin_debug_flags |= MARLIN_DEBUG_ECHO;
512+ #endif
513+
514+ // Continue to apply PLR when a file is resumed!
515+ enable (true );
516+
501517 // Resume the SD file from the last position
502518 char *fn = info.sd_filename ;
503519 extern const char M23_STR[];
504520 sprintf_P (cmd, M23_STR, fn);
505521 gcode.process_subcommands_now (cmd);
506522 sprintf_P (cmd, PSTR (" M24 S%ld T%ld" ), resume_sdpos, info.print_job_elapsed );
507523 gcode.process_subcommands_now (cmd);
524+
525+ TERN_ (DEBUG_POWER_LOSS_RECOVERY, marlin_debug_flags = old_flags);
508526}
509527
510528#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
@@ -584,6 +602,8 @@ void PrintJobRecovery::resume() {
584602 DEBUG_ECHOLNPAIR (" sd_filename: " , info.sd_filename );
585603 DEBUG_ECHOLNPAIR (" sdpos: " , info.sdpos );
586604 DEBUG_ECHOLNPAIR (" print_job_elapsed: " , info.print_job_elapsed );
605+ DEBUG_ECHOLNPAIR (" dryrun: " , int (info.flag .dryrun ));
606+ DEBUG_ECHOLNPAIR (" allow_cold_extrusion: " , int (info.flag .allow_cold_extrusion ));
587607 }
588608 else
589609 DEBUG_ECHOLNPGM (" INVALID DATA" );
0 commit comments