|
|
@ -65,6 +65,9 @@ PrintJobRecovery recovery;
|
|
|
|
#ifndef POWER_LOSS_RETRACT_LEN
|
|
|
|
#ifndef POWER_LOSS_RETRACT_LEN
|
|
|
|
#define POWER_LOSS_RETRACT_LEN 0
|
|
|
|
#define POWER_LOSS_RETRACT_LEN 0
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef POWER_LOSS_ZRAISE
|
|
|
|
|
|
|
|
#define POWER_LOSS_ZRAISE 2
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Clear the recovery info
|
|
|
|
* Clear the recovery info
|
|
|
@ -235,10 +238,34 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*=
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if PIN_EXISTS(POWER_LOSS)
|
|
|
|
#if PIN_EXISTS(POWER_LOSS)
|
|
|
|
|
|
|
|
|
|
|
|
void PrintJobRecovery::_outage() {
|
|
|
|
void PrintJobRecovery::_outage() {
|
|
|
|
save(true);
|
|
|
|
#if ENABLED(BACKUP_POWER_SUPPLY)
|
|
|
|
|
|
|
|
static bool lock = false;
|
|
|
|
|
|
|
|
if (lock) return; // No re-entrance from idle() during raise_z()
|
|
|
|
|
|
|
|
lock = true;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (IS_SD_PRINTING()) save(true);
|
|
|
|
|
|
|
|
#if ENABLED(BACKUP_POWER_SUPPLY)
|
|
|
|
|
|
|
|
raise_z();
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
kill(GET_TEXT(MSG_OUTAGE_RECOVERY));
|
|
|
|
kill(GET_TEXT(MSG_OUTAGE_RECOVERY));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(BACKUP_POWER_SUPPLY)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void PrintJobRecovery::raise_z() {
|
|
|
|
|
|
|
|
// Disable all heaters to reduce power loss
|
|
|
|
|
|
|
|
thermalManager.disable_all_heaters();
|
|
|
|
|
|
|
|
quickstop_stepper();
|
|
|
|
|
|
|
|
// Raise Z axis
|
|
|
|
|
|
|
|
gcode.process_subcommands_now_P(PSTR("G91\nG0 Z" STRINGIFY(POWER_LOSS_ZRAISE)));
|
|
|
|
|
|
|
|
planner.synchronize();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -260,8 +287,6 @@ void PrintJobRecovery::write() {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void PrintJobRecovery::resume() {
|
|
|
|
void PrintJobRecovery::resume() {
|
|
|
|
|
|
|
|
|
|
|
|
#define RECOVERY_ZRAISE 2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const uint32_t resume_sdpos = info.sdpos; // Get here before the stepper ISR overwrites it
|
|
|
|
const uint32_t resume_sdpos = info.sdpos; // Get here before the stepper ISR overwrites it
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_LEVELING
|
|
|
|
#if HAS_LEVELING
|
|
|
@ -272,15 +297,27 @@ void PrintJobRecovery::resume() {
|
|
|
|
// Reset E, raise Z, home XY...
|
|
|
|
// Reset E, raise Z, home XY...
|
|
|
|
gcode.process_subcommands_now_P(PSTR("G92.9 E0"
|
|
|
|
gcode.process_subcommands_now_P(PSTR("G92.9 E0"
|
|
|
|
#if Z_HOME_DIR > 0
|
|
|
|
#if Z_HOME_DIR > 0
|
|
|
|
// If Z homing goes to max, reset E and home all
|
|
|
|
|
|
|
|
"\nG28R0"
|
|
|
|
// If Z homing goes to max, just reset E and home all
|
|
|
|
|
|
|
|
"\n"
|
|
|
|
|
|
|
|
"G28R0"
|
|
|
|
#if ENABLED(MARLIN_DEV_MODE)
|
|
|
|
#if ENABLED(MARLIN_DEV_MODE)
|
|
|
|
"S"
|
|
|
|
"S"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
|
|
#else // "G92.9 E0 ..."
|
|
|
|
|
|
|
|
|
|
|
|
// Set Z to 0, raise Z by RECOVERY_ZRAISE, and Home (XY only for Cartesian)
|
|
|
|
// Set Z to 0, raise Z by RECOVERY_ZRAISE, and Home (XY only for Cartesian)
|
|
|
|
// with no raise. (Only do simulated homing in Marlin Dev Mode.)
|
|
|
|
// with no raise. (Only do simulated homing in Marlin Dev Mode.)
|
|
|
|
"Z0\nG1Z" STRINGIFY(RECOVERY_ZRAISE) "\nG28R0"
|
|
|
|
#if ENABLED(BACKUP_POWER_SUPPLY)
|
|
|
|
|
|
|
|
"Z" STRINGIFY(POWER_LOSS_ZRAISE) // Z-axis was already raised at outage
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
"Z0\n" // Set Z=0
|
|
|
|
|
|
|
|
"G1Z" STRINGIFY(POWER_LOSS_ZRAISE) // Raise Z
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
"\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"G28R0"
|
|
|
|
#if ENABLED(MARLIN_DEV_MODE)
|
|
|
|
#if ENABLED(MARLIN_DEV_MODE)
|
|
|
|
"S"
|
|
|
|
"S"
|
|
|
|
#elif !IS_KINEMATIC
|
|
|
|
#elif !IS_KINEMATIC
|
|
|
|