Save/restore Relative modes in Power-Loss Recovery (#13501)

This commit is contained in:
Msq001 2019-03-30 02:40:42 +08:00 committed by Scott Lahteine
parent c6466c23fe
commit f0d14b83bc
2 changed files with 11 additions and 0 deletions

View file

@ -185,6 +185,10 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*=
info.retract_hop = fwretract.current_hop;
#endif
//relative mode
info.relative_mode = relative_mode;
info.relative_modes_e = gcode.axis_relative_modes[E_AXIS];
// Commands in the queue
info.commands_in_queue = save_queue ? commands_in_queue : 0;
info.cmd_queue_index_r = cmd_queue_index_r;
@ -339,6 +343,10 @@ void PrintJobRecovery::resume() {
sprintf_P(cmd, PSTR("G1 F%d"), info.feedrate);
gcode.process_subcommands_now(cmd);
//relative mode
if (info.relative_mode) relative_mode = true;
if (info.relative_modes_e) gcode.axis_relative_modes[E_AXIS] = true;
// Process commands from the old pending queue
uint8_t c = info.commands_in_queue, r = info.cmd_queue_index_r;
for (; c--; r = (r + 1) % BUFSIZE)

View file

@ -76,6 +76,9 @@ typedef struct {
#endif
#endif
// Relative mode
bool relative_mode, relative_modes_e;
// Command queue
uint8_t commands_in_queue, cmd_queue_index_r;
char command_queue[BUFSIZE][MAX_CMD_SIZE];