Fix some Power Loss Recovery behaviors (#18558)

This commit is contained in:
Jason Smith
2020-07-14 23:14:03 -07:00
committed by GitHub
parent 55e519a06f
commit 76b67d55e2
8 changed files with 168 additions and 110 deletions

View File

@@ -26,6 +26,8 @@
*/
#include "../sd/cardreader.h"
#include "../gcode/gcode.h"
#include "../inc/MarlinConfig.h"
#if ENABLED(MIXING_EXTRUDER)
@@ -45,6 +47,7 @@ typedef struct {
// Machine state
xyze_pos_t current_position;
float zraise;
#if HAS_HOME_OFFSET
xyz_pos_t home_offset;
@@ -161,33 +164,34 @@ class PrintJobRecovery {
static inline void cancel() { purge(); card.autostart_index = 0; }
static void load();
static void save(const bool force=ENABLED(SAVE_EACH_CMD_MODE));
static void save(const bool force=ENABLED(SAVE_EACH_CMD_MODE), const float zraise=0);
#if PIN_EXISTS(POWER_LOSS)
static inline void outage() {
if (enabled && READ(POWER_LOSS_PIN) == POWER_LOSS_STATE)
_outage();
}
#endif
#if PIN_EXISTS(POWER_LOSS)
static inline void outage() {
if (enabled && READ(POWER_LOSS_PIN) == POWER_LOSS_STATE)
_outage();
}
#endif
static inline bool valid() { return info.valid(); }
static inline bool valid() { return info.valid(); }
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
static void debug(PGM_P const prefix);
#else
static inline void debug(PGM_P const) {}
#endif
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
static void debug(PGM_P const prefix);
#else
static inline void debug(PGM_P const) {}
#endif
private:
static void write();
#if ENABLED(BACKUP_POWER_SUPPLY)
static void raise_z();
#endif
#if ENABLED(BACKUP_POWER_SUPPLY)
static void retract_and_lift(const float &zraise);
#endif
#if PIN_EXISTS(POWER_LOSS)
static void _outage();
#endif
#if PIN_EXISTS(POWER_LOSS)
friend class GcodeSuite;
static void _outage();
#endif
};
extern PrintJobRecovery recovery;