@@ -342,6 +342,30 @@ void PrintJobRecovery::resume() {
342342 gcode.process_subcommands_now_P (PSTR (" M420 S0 Z0" ));
343343 #endif
344344
345+ #if HAS_HEATED_BED
346+ const int16_t bt = info.target_temperature_bed ;
347+ if (bt) {
348+ // Restore the bed temperature
349+ sprintf_P (cmd, PSTR (" M190 S%i" ), bt);
350+ gcode.process_subcommands_now (cmd);
351+ }
352+ #endif
353+
354+ // Restore all hotend temperatures
355+ #if HAS_HOTEND
356+ HOTEND_LOOP () {
357+ const int16_t et = info.target_temperature [e];
358+ if (et) {
359+ #if HAS_MULTI_HOTEND
360+ sprintf_P (cmd, PSTR (" T%i S" ), e);
361+ gcode.process_subcommands_now (cmd);
362+ #endif
363+ sprintf_P (cmd, PSTR (" M109 S%i" ), et);
364+ gcode.process_subcommands_now (cmd);
365+ }
366+ }
367+ #endif
368+
345369 // Reset E, raise Z, home XY...
346370 #if Z_HOME_DIR > 0
347371
@@ -353,20 +377,11 @@ void PrintJobRecovery::resume() {
353377
354378 #else // "G92.9 E0 ..."
355379
356- // Set Z to 0, raise Z by info.zraise, and Home (XY only for Cartesian)
357- // with no raise. (Only do simulated homing in Marlin Dev Mode.)
358-
359- sprintf_P (cmd, PSTR (" G92.9 E0 "
360- #if ENABLED(BACKUP_POWER_SUPPLY)
361- " Z%s" // Z was already raised at outage
362- #else
363- " Z0\n G1Z%s" // Set Z=0 and Raise Z now
364- #endif
365- ),
366- dtostrf (info.zraise , 1 , 3 , str_1)
367- );
380+ // If a Z raise occurred at outage restore Z, otherwise raise Z now
381+ sprintf_P (cmd, PSTR (" G92.9 E0 " TERN (BACKUP_POWER_SUPPLY, " Z%s" , " Z0\n G1Z%s" )), dtostrf (info.zraise , 1 , 3 , str_1));
368382 gcode.process_subcommands_now (cmd);
369383
384+ // Home safely with no Z raise
370385 gcode.process_subcommands_now_P (PSTR (
371386 " G28R0" // No raise during G28
372387 #if IS_CARTESIAN && DISABLED(POWER_LOSS_RECOVER_ZHOME)
@@ -404,30 +419,6 @@ void PrintJobRecovery::resume() {
404419 #endif
405420 #endif
406421
407- #if HAS_HEATED_BED
408- const int16_t bt = info.target_temperature_bed ;
409- if (bt) {
410- // Restore the bed temperature
411- sprintf_P (cmd, PSTR (" M190 S%i" ), bt);
412- gcode.process_subcommands_now (cmd);
413- }
414- #endif
415-
416- // Restore all hotend temperatures
417- #if HAS_HOTEND
418- HOTEND_LOOP () {
419- const int16_t et = info.target_temperature [e];
420- if (et) {
421- #if HAS_MULTI_HOTEND
422- sprintf_P (cmd, PSTR (" T%i S" ), e);
423- gcode.process_subcommands_now (cmd);
424- #endif
425- sprintf_P (cmd, PSTR (" M109 S%i" ), et);
426- gcode.process_subcommands_now (cmd);
427- }
428- }
429- #endif
430-
431422 // Select the previously active tool (with no_move)
432423 #if HAS_MULTI_EXTRUDER
433424 sprintf_P (cmd, PSTR (" T%i S" ), info.active_extruder );
0 commit comments