Preheat before Power Loss Recovery homing (#20697)

This commit is contained in:
Java 2021-01-07 07:57:11 +05:00 committed by GitHub
parent abea8ff8f4
commit 8edcf03715
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -342,6 +342,30 @@ void PrintJobRecovery::resume() {
gcode.process_subcommands_now_P(PSTR("M420 S0 Z0")); gcode.process_subcommands_now_P(PSTR("M420 S0 Z0"));
#endif #endif
#if HAS_HEATED_BED
const int16_t bt = info.target_temperature_bed;
if (bt) {
// Restore the bed temperature
sprintf_P(cmd, PSTR("M190 S%i"), bt);
gcode.process_subcommands_now(cmd);
}
#endif
// Restore all hotend temperatures
#if HAS_HOTEND
HOTEND_LOOP() {
const int16_t et = info.target_temperature[e];
if (et) {
#if HAS_MULTI_HOTEND
sprintf_P(cmd, PSTR("T%i S"), e);
gcode.process_subcommands_now(cmd);
#endif
sprintf_P(cmd, PSTR("M109 S%i"), et);
gcode.process_subcommands_now(cmd);
}
}
#endif
// Reset E, raise Z, home XY... // Reset E, raise Z, home XY...
#if Z_HOME_DIR > 0 #if Z_HOME_DIR > 0
@ -353,20 +377,11 @@ void PrintJobRecovery::resume() {
#else // "G92.9 E0 ..." #else // "G92.9 E0 ..."
// Set Z to 0, raise Z by info.zraise, and Home (XY only for Cartesian) // If a Z raise occurred at outage restore Z, otherwise raise Z now
// with no raise. (Only do simulated homing in Marlin Dev Mode.) sprintf_P(cmd, PSTR("G92.9 E0 " TERN(BACKUP_POWER_SUPPLY, "Z%s", "Z0\nG1Z%s")), dtostrf(info.zraise, 1, 3, str_1));
sprintf_P(cmd, PSTR("G92.9 E0 "
#if ENABLED(BACKUP_POWER_SUPPLY)
"Z%s" // Z was already raised at outage
#else
"Z0\nG1Z%s" // Set Z=0 and Raise Z now
#endif
),
dtostrf(info.zraise, 1, 3, str_1)
);
gcode.process_subcommands_now(cmd); gcode.process_subcommands_now(cmd);
// Home safely with no Z raise
gcode.process_subcommands_now_P(PSTR( gcode.process_subcommands_now_P(PSTR(
"G28R0" // No raise during G28 "G28R0" // No raise during G28
#if IS_CARTESIAN && DISABLED(POWER_LOSS_RECOVER_ZHOME) #if IS_CARTESIAN && DISABLED(POWER_LOSS_RECOVER_ZHOME)
@ -404,30 +419,6 @@ void PrintJobRecovery::resume() {
#endif #endif
#endif #endif
#if HAS_HEATED_BED
const int16_t bt = info.target_temperature_bed;
if (bt) {
// Restore the bed temperature
sprintf_P(cmd, PSTR("M190 S%i"), bt);
gcode.process_subcommands_now(cmd);
}
#endif
// Restore all hotend temperatures
#if HAS_HOTEND
HOTEND_LOOP() {
const int16_t et = info.target_temperature[e];
if (et) {
#if HAS_MULTI_HOTEND
sprintf_P(cmd, PSTR("T%i S"), e);
gcode.process_subcommands_now(cmd);
#endif
sprintf_P(cmd, PSTR("M109 S%i"), et);
gcode.process_subcommands_now(cmd);
}
}
#endif
// Select the previously active tool (with no_move) // Select the previously active tool (with no_move)
#if HAS_MULTI_EXTRUDER #if HAS_MULTI_EXTRUDER
sprintf_P(cmd, PSTR("T%i S"), info.active_extruder); sprintf_P(cmd, PSTR("T%i S"), info.active_extruder);