Save Power Loss Recovery only on move commands

2.0.x
Scott Lahteine 6 years ago
parent 15738ea506
commit 2e5a3b01fd

@ -40,6 +40,11 @@ GcodeSuite gcode;
#include "../feature/host_actions.h"
#endif
#if ENABLED(POWER_LOSS_RECOVERY)
#include "../sd/cardreader.h"
#include "../feature/power_loss_recovery.h"
#endif
#include "../Marlin.h" // for idle() and suspend_auto_report
millis_t GcodeSuite::previous_move_ms;
@ -86,8 +91,9 @@ int8_t GcodeSuite::get_target_extruder_from_command() {
* - Set the feedrate, if included
*/
void GcodeSuite::get_destination_from_command() {
bool seen[XYZE] = { false, false, false, false };
LOOP_XYZE(i) {
if (parser.seen(axis_codes[i])) {
if ( (seen[i] = parser.seenval(axis_codes[i])) ) {
const float v = parser.value_axis_units((AxisEnum)i);
destination[i] = (axis_relative_modes[i] || relative_mode)
? current_position[i] + v
@ -97,6 +103,11 @@ void GcodeSuite::get_destination_from_command() {
destination[i] = current_position[i];
}
#if ENABLED(POWER_LOSS_RECOVERY)
// Only update power loss recovery on moves with E
if ((seen[E_AXIS] || seen[Z_AXIS]) && IS_SD_PRINTING()) recovery.save();
#endif
if (parser.linearval('F') > 0)
feedrate_mm_s = MMM_TO_MMS(parser.value_feedrate());

@ -868,12 +868,8 @@ void advance_command_queue() {
ok_to_send();
}
}
else {
else
gcode.process_next_command();
#if ENABLED(POWER_LOSS_RECOVERY)
if (IS_SD_PRINTING()) recovery.save();
#endif
}
#else

Loading…
Cancel
Save