|
|
|
@ -126,6 +126,10 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*=
|
|
|
|
|
millis_t ms = millis();
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef POWER_LOSS_MIN_Z_CHANGE
|
|
|
|
|
#define POWER_LOSS_MIN_Z_CHANGE 0.05 // Vase-mode-friendly out of the box
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// Did Z change since the last call?
|
|
|
|
|
if (force
|
|
|
|
|
#if DISABLED(SAVE_EACH_CMD_MODE) // Always save state when enabled
|
|
|
|
@ -135,8 +139,8 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*=
|
|
|
|
|
#if SAVE_INFO_INTERVAL_MS > 0 // Save if interval is elapsed
|
|
|
|
|
|| ELAPSED(ms, next_save_ms)
|
|
|
|
|
#endif
|
|
|
|
|
// Save every time Z is higher than the last call
|
|
|
|
|
|| current_position[Z_AXIS] > info.current_position[Z_AXIS]
|
|
|
|
|
// Save if Z is above the last-saved position by some minimum height
|
|
|
|
|
|| current_position[Z_AXIS] > info.current_position[Z_AXIS] + POWER_LOSS_MIN_Z_CHANGE
|
|
|
|
|
#endif
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
|
@ -228,9 +232,8 @@ void PrintJobRecovery::write() {
|
|
|
|
|
open(false);
|
|
|
|
|
file.seekSet(0);
|
|
|
|
|
const int16_t ret = file.write(&info, sizeof(info));
|
|
|
|
|
close();
|
|
|
|
|
|
|
|
|
|
if (ret == -1) DEBUG_ECHOLNPGM("Power-loss file write failed.");
|
|
|
|
|
if (!file.close()) DEBUG_ECHOLNPGM("Power-loss file close failed.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|