Browse Source

Save Power Loss Recovery only on move commands

pull/1/head
Scott Lahteine 6 years ago
parent
commit
2e5a3b01fd
  1. 13
      Marlin/src/gcode/gcode.cpp
  2. 6
      Marlin/src/gcode/queue.cpp

13
Marlin/src/gcode/gcode.cpp

@ -40,6 +40,11 @@ GcodeSuite gcode;
#include "../feature/host_actions.h" #include "../feature/host_actions.h"
#endif #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 #include "../Marlin.h" // for idle() and suspend_auto_report
millis_t GcodeSuite::previous_move_ms; millis_t GcodeSuite::previous_move_ms;
@ -86,8 +91,9 @@ int8_t GcodeSuite::get_target_extruder_from_command() {
* - Set the feedrate, if included * - Set the feedrate, if included
*/ */
void GcodeSuite::get_destination_from_command() { void GcodeSuite::get_destination_from_command() {
bool seen[XYZE] = { false, false, false, false };
LOOP_XYZE(i) { 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); const float v = parser.value_axis_units((AxisEnum)i);
destination[i] = (axis_relative_modes[i] || relative_mode) destination[i] = (axis_relative_modes[i] || relative_mode)
? current_position[i] + v ? current_position[i] + v
@ -97,6 +103,11 @@ void GcodeSuite::get_destination_from_command() {
destination[i] = current_position[i]; 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) if (parser.linearval('F') > 0)
feedrate_mm_s = MMM_TO_MMS(parser.value_feedrate()); feedrate_mm_s = MMM_TO_MMS(parser.value_feedrate());

6
Marlin/src/gcode/queue.cpp

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

Loading…
Cancel
Save