Resuming behavior after Pause + switch off
-
Hi everyone
I've been setting up my Power Failure Macros and while I've gone a long way, i'm wondering something :
what happens when I pause a print then switch off the printer. Obviously I guess resurrect.g will be used instead of resume.g for resuming the print. Is resume.g also called at some point ?
I ask this because when pausing, I have set up a 10mm retraction. But I don't undo that retraction in my resurrect-prologue.g (resume.g undoes it) because it can cause issues during a "normal" power failure.
How should i go about this ?
-
What do the first lines of resurrect.g look like?
Where do you have the retraction happening? In Pause.g or in the power loss entry in config.g?
When you resume the print from a paused state (or any state really) you would do well to prime the nozzle to ensure it's ready to go before re-starting the print.
-
@Phaedrux Thank you for your reply and sorry for being slow, I was into other things until now but had to come back to this.
To add context, i'm on a custom build with a dual extrusion / dual hotend setup. On toolchange the standby tool will retract 10mm, on pause the active tool will also retract 10mm.
So I was thinking, I should prime both extruders then retract them both 10mm in resurrect.g.
My issue is i need to unretract the active tool in resurrect-prologue but I need to know which tool is supposed to be active. (the wipe cycle will wipe tool 0 then tool 1 whatever the active extruder was in the first place, resurrect.g activates the relevant tool after resurrect-prologue anyway)
For now I just manually add a G1 E10 at the end of resurrect.g after the relevant tool was selected.
Can i modify the write out of resurrect.g so G1 E10 gets added automatically ? How so?
Or should I play with object models like tools[].state or tools[].number or state.currentTool in (a macro called by) resurrect-prologue ?Also I ran into an issue, I paused a print then switched the printer off. pause.g lifts the carriage in Z by 5mm then parks in a corner. The thing is, when i resurrected, the saved position for Z for the resuction of the print is offset up by 5mm. X and Y are fine though
I guess I should change my pause.g; pause.g M83 ; relative extruder moves G1 E-10 F3600 ; retract 10mm of filament G91 ; relative positioning G1 H1 Z5 F360 ; lift Z by 5mm G90 ; absolute positioning G1 X0 Y0 F6000 ; go to X=0 Y=0
; resume.g ; called before a print from SD card is resumed ; ; generated by RepRapFirmware Configuration Tool v3.3.15 on Mon Jan 09 2023 14:50:14 GMT+0100 (Central European Standard Time) M98 P"homex.g" ; M98 P"homey.g" ; G1 R1 X0 Y0 Z5 F6000 ; go to 5mm above position of the last print move G1 R1 X0 Y0 Z0 ; go back to the last print move M83 ; relative extruder moves G1 E10 F3600 ; extrude 10mm of filament
; resurrect-prologue.g M98 P"0:/macros/resetglobals.g" if !exists(global.layerNumber) global layerNumber = 0 if !exists (global.totalLayerCount) global totalLayerCount = 10000 M98 P"0:/macros/layernumberglobal.g" M98 P"0:/macros/totallayercountglobal.g" T1 P0 T0 M116 ; wait for temperatures G28 X Y ; home X and Y M98 P"0:/sys/homezmax.g" ; home Z using max endstop M83 ; relative extrusion G90 ; absolute positioning G1 X300 G1 X350 E20 F600 ; undo the retraction that was done in the M911 power fail script G1 Y10.5 G1 E-10 G1 X300 T1 G1 X350 E20 F600 G1 Y11 G1 E-10 G1 X300
; new pause.g ? M83 ; relative extruder moves G1 E-10 F3600 ; retract 10mm of filament G91 ; relative positioning G1 H1 Z3 F360 ; lift Z by 3mm G90 ; absolute positioning G1 X0 Y0 F6000 ; go to X=0 Y=0 G91 G1 H1 Z-3 F360 ; undo Z lift as to not mess with eventual Z offset on powerloss recovery ; resume.g will lift the head up 5mm so it doesn't risk hitting anything while travelling G90
-
I think i got this for the tool change thing. I would still love to be able to unretract right at the end of resurrect.g (e.g. a G11 command right at the end) but I'll use this for now !
T{abs(state.currentTool -1)} ; select inactive tool
-
@dc42 Hello ! I found the place in gcode.cpp where i could add a G11 or a G1 E10 at the end of ressurect.g . Not sure I want to go down the path of compiling a custom firmware though, but:
Would this work ? : adding// Now unretract filament buf.catf("G11");
after
// Now move down to the correct Z height buf.catf("\nG0 F6000 Z%.3f\n", (double)pauseRestorePoint.moveCoords[Z_AXIS]);
in
if (ok) { // Build the commands to restore the head position. These assume that we are working in mm. // Start with a vertical move to 2mm above the final Z position buf.printf("G0 F6000 Z%.3f\n", (double)(pauseRestorePoint.moveCoords[Z_AXIS] + 2.0)); // Now set all the other axes buf.cat("G0 F6000"); for (size_t axis = 0; axis < numVisibleAxes; ++axis) { if (axis != Z_AXIS) { buf.catf(" %c%.3f", axisLetters[axis], (double)pauseRestorePoint.moveCoords[axis]); } } // Now move down to the correct Z height buf.catf("\nG0 F6000 Z%.3f\n", (double)pauseRestorePoint.moveCoords[Z_AXIS]); // Set the feed rate buf.catf("G1 F%.1f", (double)InverseConvertSpeedToMmPerMin(pauseRestorePoint.feedRate));