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