Browse Source

Save Power Loss Recovery only on move commands

Scott Lahteine 5 years ago
parent
commit
2e5a3b01fd
2 changed files with 13 additions and 6 deletions
  1. 12
    1
      Marlin/src/gcode/gcode.cpp
  2. 1
    5
      Marlin/src/gcode/queue.cpp

+ 12
- 1
Marlin/src/gcode/gcode.cpp View File

40
   #include "../feature/host_actions.h"
40
   #include "../feature/host_actions.h"
41
 #endif
41
 #endif
42
 
42
 
43
+#if ENABLED(POWER_LOSS_RECOVERY)
44
+  #include "../sd/cardreader.h"
45
+  #include "../feature/power_loss_recovery.h"
46
+#endif
47
+
43
 #include "../Marlin.h" // for idle() and suspend_auto_report
48
 #include "../Marlin.h" // for idle() and suspend_auto_report
44
 
49
 
45
 millis_t GcodeSuite::previous_move_ms;
50
 millis_t GcodeSuite::previous_move_ms;
86
  *  - Set the feedrate, if included
91
  *  - Set the feedrate, if included
87
  */
92
  */
88
 void GcodeSuite::get_destination_from_command() {
93
 void GcodeSuite::get_destination_from_command() {
94
+  bool seen[XYZE] = { false, false, false, false };
89
   LOOP_XYZE(i) {
95
   LOOP_XYZE(i) {
90
-    if (parser.seen(axis_codes[i])) {
96
+    if ( (seen[i] = parser.seenval(axis_codes[i])) ) {
91
       const float v = parser.value_axis_units((AxisEnum)i);
97
       const float v = parser.value_axis_units((AxisEnum)i);
92
       destination[i] = (axis_relative_modes[i] || relative_mode)
98
       destination[i] = (axis_relative_modes[i] || relative_mode)
93
         ? current_position[i] + v
99
         ? current_position[i] + v
97
       destination[i] = current_position[i];
103
       destination[i] = current_position[i];
98
   }
104
   }
99
 
105
 
106
+  #if ENABLED(POWER_LOSS_RECOVERY)
107
+    // Only update power loss recovery on moves with E
108
+    if ((seen[E_AXIS] || seen[Z_AXIS]) && IS_SD_PRINTING()) recovery.save();
109
+  #endif
110
+
100
   if (parser.linearval('F') > 0)
111
   if (parser.linearval('F') > 0)
101
     feedrate_mm_s = MMM_TO_MMS(parser.value_feedrate());
112
     feedrate_mm_s = MMM_TO_MMS(parser.value_feedrate());
102
 
113
 

+ 1
- 5
Marlin/src/gcode/queue.cpp View File

868
           ok_to_send();
868
           ok_to_send();
869
       }
869
       }
870
     }
870
     }
871
-    else {
871
+    else
872
       gcode.process_next_command();
872
       gcode.process_next_command();
873
-      #if ENABLED(POWER_LOSS_RECOVERY)
874
-        if (IS_SD_PRINTING()) recovery.save();
875
-      #endif
876
-    }
877
 
873
 
878
   #else
874
   #else
879
 
875
 

Loading…
Cancel
Save