Browse Source

Misc Power Loss cleanup

vanilla_fb_2.0.x
Scott Lahteine 3 years ago
parent
commit
45d3866f97
  1. 9
      Marlin/src/feature/powerloss.cpp
  2. 5
      Marlin/src/feature/powerloss.h

9
Marlin/src/feature/powerloss.cpp

@ -66,9 +66,6 @@ PrintJobRecovery recovery;
#ifndef POWER_LOSS_PURGE_LEN #ifndef POWER_LOSS_PURGE_LEN
#define POWER_LOSS_PURGE_LEN 0 #define POWER_LOSS_PURGE_LEN 0
#endif #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) #if DISABLED(BACKUP_POWER_SUPPLY)
#undef POWER_LOSS_RETRACT_LEN // No retract at outage without backup power #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 // 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 #if Z_HOME_DIR > 0
@ -380,7 +377,7 @@ void PrintJobRecovery::resume() {
"G28R0" // Home all axes (no raise) "G28R0" // Home all axes (no raise)
)); ));
#else // "G92.9 E0 ..." #else
// If a Z raise occurred at outage restore Z, otherwise raise Z now // 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)); 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")); gcode.process_subcommands_now_P(PSTR("G12"));
#endif #endif
// Move back to the saved XY // Move back over to the saved XY
sprintf_P(cmd, PSTR("G1X%sY%sF3000"), sprintf_P(cmd, PSTR("G1X%sY%sF3000"),
dtostrf(info.current_position.x, 1, 3, str_1), dtostrf(info.current_position.x, 1, 3, str_1),
dtostrf(info.current_position.y, 1, 3, str_2) dtostrf(info.current_position.y, 1, 3, str_2)

5
Marlin/src/feature/powerloss.h

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

Loading…
Cancel
Save