Misc Power Loss cleanup

This commit is contained in:
Scott Lahteine 2021-05-07 22:36:36 -05:00
parent 94edfc0a8f
commit 45d3866f97
2 changed files with 17 additions and 15 deletions

View file

@ -66,9 +66,6 @@ PrintJobRecovery recovery;
#ifndef POWER_LOSS_PURGE_LEN
#define POWER_LOSS_PURGE_LEN 0
#endif
#ifndef POWER_LOSS_ZRAISE
#define POWER_LOSS_ZRAISE 2 // Move on loss with backup power, or on resume without it
#endif
#if DISABLED(BACKUP_POWER_SUPPLY)
#undef POWER_LOSS_RETRACT_LEN // No retract at outage without backup power
@ -370,7 +367,7 @@ void PrintJobRecovery::resume() {
//
// Home the axes that can safely be homed, and
// establish the current position as best we can
// establish the current position as best we can.
//
#if Z_HOME_DIR > 0
@ -380,7 +377,7 @@ void PrintJobRecovery::resume() {
"G28R0" // Home all axes (no raise)
));
#else // "G92.9 E0 ..."
#else
// If a Z raise occurred at outage restore Z, otherwise raise Z now
sprintf_P(cmd, PSTR("G92.9 E0 " TERN(BACKUP_POWER_SUPPLY, "Z%s", "Z0\nG1Z%s")), dtostrf(info.zraise, 1, 3, str_1));
@ -488,7 +485,7 @@ void PrintJobRecovery::resume() {
gcode.process_subcommands_now_P(PSTR("G12"));
#endif
// Move back to the saved XY
// Move back over to the saved XY
sprintf_P(cmd, PSTR("G1X%sY%sF3000"),
dtostrf(info.current_position.x, 1, 3, str_1),
dtostrf(info.current_position.y, 1, 3, str_2)

View file

@ -42,6 +42,10 @@
#define POWER_LOSS_STATE HIGH
#endif
#ifndef POWER_LOSS_ZRAISE
#define POWER_LOSS_ZRAISE 2
#endif
//#define DEBUG_POWER_LOSS_RECOVERY
//#define SAVE_EACH_CMD_MODE
//#define SAVE_INFO_INTERVAL_MS 0
@ -52,6 +56,7 @@ typedef struct {
// Machine state
xyze_pos_t current_position;
uint16_t feedrate;
float zraise;
// Repeat information