|
@@ -151,6 +151,12 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*=
|
151
|
151
|
|
152
|
152
|
// Machine state
|
153
|
153
|
COPY(info.current_position, current_position);
|
|
154
|
+ #if HAS_HOME_OFFSET
|
|
155
|
+ COPY(info.home_offset, home_offset);
|
|
156
|
+ #endif
|
|
157
|
+ #if HAS_POSITION_SHIFT
|
|
158
|
+ COPY(info.position_shift, position_shift);
|
|
159
|
+ #endif
|
154
|
160
|
info.feedrate = uint16_t(feedrate_mm_s * 60.0f);
|
155
|
161
|
|
156
|
162
|
#if HOTENDS > 1
|
|
@@ -187,7 +193,7 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*=
|
187
|
193
|
info.retract_hop = fwretract.current_hop;
|
188
|
194
|
#endif
|
189
|
195
|
|
190
|
|
- //relative mode
|
|
196
|
+ // Relative mode
|
191
|
197
|
info.relative_mode = relative_mode;
|
192
|
198
|
info.relative_modes_e = gcode.axis_relative_modes[E_AXIS];
|
193
|
199
|
|
|
@@ -239,9 +245,9 @@ void PrintJobRecovery::resume() {
|
239
|
245
|
gcode.process_subcommands_now_P(PSTR("M420 S0 Z0"));
|
240
|
246
|
#endif
|
241
|
247
|
|
242
|
|
- // Set Z to 0, raise Z by 2mm, and Home (XY only for Cartesian) with no raise
|
243
|
|
- // (Only do simulated homing in Marlin Dev Mode.)
|
244
|
|
- gcode.process_subcommands_now_P(PSTR("G92.0 Z0\nG1 Z" STRINGIFY(RECOVERY_ZRAISE) "\nG28 R0"
|
|
248
|
+ // Set Z to 0, raise Z by RECOVERY_ZRAISE, and Home (XY only for Cartesian)
|
|
249
|
+ // with no raise. (Only do simulated homing in Marlin Dev Mode.)
|
|
250
|
+ gcode.process_subcommands_now_P(PSTR("G92.9 E0 Z0\nG1 Z" STRINGIFY(RECOVERY_ZRAISE) "\nG28 R0"
|
245
|
251
|
#if ENABLED(MARLIN_DEV_MODE)
|
246
|
252
|
" S"
|
247
|
253
|
#elif !IS_KINEMATIC
|
|
@@ -252,7 +258,7 @@ void PrintJobRecovery::resume() {
|
252
|
258
|
// Pretend that all axes are homed
|
253
|
259
|
axis_homed = axis_known_position = xyz_bits;
|
254
|
260
|
|
255
|
|
- char cmd[40], str_1[16], str_2[16];
|
|
261
|
+ char cmd[50], str_1[16], str_2[16];
|
256
|
262
|
|
257
|
263
|
// Select the previously active tool (with no_move)
|
258
|
264
|
#if EXTRUDERS > 1
|
|
@@ -315,16 +321,16 @@ void PrintJobRecovery::resume() {
|
315
|
321
|
memcpy(&mixer.gradient, &info.gradient, sizeof(info.gradient));
|
316
|
322
|
#endif
|
317
|
323
|
|
318
|
|
- // Restore Z (plus raise) and E positions with G92.0
|
319
|
|
- dtostrf(info.current_position[Z_AXIS] + RECOVERY_ZRAISE, 1, 3, str_1);
|
320
|
|
- dtostrf(info.current_position[E_AXIS]
|
321
|
|
- #if ENABLED(SAVE_EACH_CMD_MODE)
|
322
|
|
- - 5 // Extra extrusion on restart
|
323
|
|
- #endif
|
324
|
|
- , 1, 3, str_2
|
325
|
|
- );
|
326
|
|
- sprintf_P(cmd, PSTR("G92.0 Z%s E%s"), str_1, str_2);
|
327
|
|
- gcode.process_subcommands_now(cmd);
|
|
324
|
+ // Extrude and retract to clean the nozzle
|
|
325
|
+ #if POWER_LOSS_PURGE_LEN
|
|
326
|
+ //sprintf_P(cmd, PSTR("G1 E%d F200"), POWER_LOSS_PURGE_LEN);
|
|
327
|
+ //gcode.process_subcommands_now(cmd);
|
|
328
|
+ gcode.process_subcommands_now_P(PSTR("G1 E" STRINGIFY(POWER_LOSS_PURGE_LEN) " F200"));
|
|
329
|
+ #endif
|
|
330
|
+ #if POWER_LOSS_RETRACT_LEN
|
|
331
|
+ sprintf_P(cmd, PSTR("G1 E%d F3000"), POWER_LOSS_PURGE_LEN - POWER_LOSS_RETRACT_LEN);
|
|
332
|
+ gcode.process_subcommands_now(cmd);
|
|
333
|
+ #endif
|
328
|
334
|
|
329
|
335
|
// Move back to the saved XY
|
330
|
336
|
dtostrf(info.current_position[X_AXIS], 1, 3, str_1);
|
|
@@ -337,13 +343,37 @@ void PrintJobRecovery::resume() {
|
337
|
343
|
sprintf_P(cmd, PSTR("G1 Z%s F200"), str_1);
|
338
|
344
|
gcode.process_subcommands_now(cmd);
|
339
|
345
|
|
|
346
|
+ // Un-retract
|
|
347
|
+ #if POWER_LOSS_PURGE_LEN
|
|
348
|
+ //sprintf_P(cmd, PSTR("G1 E%d F3000"), POWER_LOSS_PURGE_LEN);
|
|
349
|
+ //gcode.process_subcommands_now(cmd);
|
|
350
|
+ gcode.process_subcommands_now_P(PSTR("G1 E" STRINGIFY(POWER_LOSS_PURGE_LEN) " F3000"));
|
|
351
|
+ #endif
|
|
352
|
+
|
340
|
353
|
// Restore the feedrate
|
341
|
354
|
sprintf_P(cmd, PSTR("G1 F%d"), info.feedrate);
|
342
|
355
|
gcode.process_subcommands_now(cmd);
|
343
|
356
|
|
344
|
|
- //relative mode
|
345
|
|
- if (info.relative_mode) relative_mode = true;
|
346
|
|
- if (info.relative_modes_e) gcode.axis_relative_modes[E_AXIS] = true;
|
|
357
|
+ // Restore E position with G92.9
|
|
358
|
+ dtostrf(info.current_position[E_AXIS], 1, 3, str_1);
|
|
359
|
+ sprintf_P(cmd, PSTR("G92.9 E%s"), str_1);
|
|
360
|
+ gcode.process_subcommands_now(cmd);
|
|
361
|
+
|
|
362
|
+ // Relative mode
|
|
363
|
+ relative_mode = info.relative_mode;
|
|
364
|
+ gcode.axis_relative_modes[E_AXIS] = info.relative_modes_e;
|
|
365
|
+
|
|
366
|
+ #if HAS_HOME_OFFSET || HAS_POSITION_SHIFT
|
|
367
|
+ LOOP_XYZ(i) {
|
|
368
|
+ #if HAS_HOME_OFFSET
|
|
369
|
+ home_offset[i] = info.home_offset[i];
|
|
370
|
+ #endif
|
|
371
|
+ #if HAS_POSITION_SHIFT
|
|
372
|
+ position_shift[i] = info.position_shift[i];
|
|
373
|
+ #endif
|
|
374
|
+ update_workspace_offset((AxisEnum)i);
|
|
375
|
+ }
|
|
376
|
+ #endif
|
347
|
377
|
|
348
|
378
|
// Process commands from the old pending queue
|
349
|
379
|
uint8_t c = info.commands_in_queue, r = info.cmd_queue_index_r;
|
|
@@ -372,6 +402,25 @@ void PrintJobRecovery::resume() {
|
372
|
402
|
DEBUG_ECHO(info.current_position[i]);
|
373
|
403
|
}
|
374
|
404
|
DEBUG_EOL();
|
|
405
|
+
|
|
406
|
+ #if HAS_HOME_OFFSET
|
|
407
|
+ DEBUG_ECHOPGM("home_offset: ");
|
|
408
|
+ LOOP_XYZ(i) {
|
|
409
|
+ if (i) DEBUG_CHAR(',');
|
|
410
|
+ DEBUG_ECHO(info.home_offset[i]);
|
|
411
|
+ }
|
|
412
|
+ DEBUG_EOL();
|
|
413
|
+ #endif
|
|
414
|
+
|
|
415
|
+ #if HAS_POSITION_SHIFT
|
|
416
|
+ DEBUG_ECHOPGM("position_shift: ");
|
|
417
|
+ LOOP_XYZ(i) {
|
|
418
|
+ if (i) DEBUG_CHAR(',');
|
|
419
|
+ DEBUG_ECHO(info.position_shift[i]);
|
|
420
|
+ }
|
|
421
|
+ DEBUG_EOL();
|
|
422
|
+ #endif
|
|
423
|
+
|
375
|
424
|
DEBUG_ECHOLNPAIR("feedrate: ", info.feedrate);
|
376
|
425
|
|
377
|
426
|
#if HOTENDS > 1
|