Improve Power-loss Recovery (#15135)
This commit is contained in:
@ -118,7 +118,7 @@ void GcodeSuite::get_destination_from_command() {
|
||||
destination[i] = current_position[i];
|
||||
}
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#if ENABLED(POWER_LOSS_RECOVERY) && !PIN_EXISTS(POWER_LOSS)
|
||||
// Only update power loss recovery on moves with E
|
||||
if (recovery.enabled && IS_SD_PRINTING() && seen[E_AXIS] && (seen[X_AXIS] || seen[Y_AXIS]))
|
||||
recovery.save();
|
||||
@ -823,6 +823,10 @@ void GcodeSuite::process_next_command() {
|
||||
|
||||
PORT_REDIRECT(queue.port[queue.index_r]);
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.queue_index_r = queue.index_r;
|
||||
#endif
|
||||
|
||||
if (DEBUGGING(ECHO)) {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLN(current_command);
|
||||
|
@ -43,6 +43,9 @@ GCodeQueue queue;
|
||||
#include "../feature/binary_protocol.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#include "../feature/power_loss_recovery.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* GCode line number handling. Hosts may opt to include line numbers when
|
||||
@ -120,6 +123,9 @@ void GCodeQueue::_commit_command(bool say_ok
|
||||
#if NUM_SERIAL > 1
|
||||
port[index_w] = p;
|
||||
#endif
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.commit_sdpos(index_w);
|
||||
#endif
|
||||
if (++index_w >= BUFSIZE) index_w = 0;
|
||||
length++;
|
||||
}
|
||||
@ -557,6 +563,10 @@ void GCodeQueue::get_serial_commands() {
|
||||
sd_count = 0; // clear sd line buffer
|
||||
|
||||
_commit_command(false);
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.cmd_sdpos = card.getIndex(); // Prime for the next _commit_command
|
||||
#endif
|
||||
}
|
||||
else if (sd_count >= MAX_CMD_SIZE - 1) {
|
||||
/**
|
||||
|
@ -38,6 +38,10 @@
|
||||
#include "../../feature/host_actions.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#include "../../feature/power_loss_recovery.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* M24: Start or Resume SD Print
|
||||
*/
|
||||
@ -58,6 +62,9 @@ void GcodeSuite::M24() {
|
||||
if (card.isFileOpen()) {
|
||||
card.startFileprint();
|
||||
print_job_timer.start();
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.prepare();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if ENABLED(HOST_ACTION_COMMANDS)
|
||||
|
Reference in New Issue
Block a user