Resume after pause failing to move printhead to correct resume position

EDIT: Solution posted at post 33. Search for:

--- SOLUTION---

To get to it easily.

What is the problem?

Printer does not resume correctly after a GCODE pause. I set a pause to insert a nut at a specific layer in Prusaslicer. Printer properly pauses at the layer that was set. Hotend moves away from the print object. I insert the nut and am ready to resume. I click "Resume" in Octoprint. Print head moves to correct X-Y position but prints a layer "in the air" before then moving down to the position of the next layer. So the print fails.

What did you already try to solve it?

Print pauses and resumes correctly if using a SD card.

I tried changing the GCODE scripts following old threads. I reviewed older threads that were similar but not quite the same, and nothing in those threads I've tried has worked so far.

I believe I have the scripts back to their original state, with anything I tried so far either removed or commented out.

I also tried creating a new printer from an unchanged factory default printer in Prusaslicer and adding the Octoprint connection to it. My original printer had some changes where it didn't heat the nozzle until after the bed levelling check.

Have you tried running in safe mode?

Yes

Did running in safe mode solve the problem?

No, same behavior

Systeminfo Bundle

octoprint-systeminfo-20250617134900.zip (97.4 KB)

Additional information about your setup

OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ... as much data as possible

OctoPrint 1.11.2 Python 3.9.2 OctoPi* 1.0.0cam (build 2024.11.05.100055)

Prusa MK3S+
Prusaslicer 2.9.2
Prusa-Firmware 3.14.1+8237_74a577bc0 based on Marlin FIRMWARE_URL:GitHub - prusa3d/Prusa-Firmware: Firmware for Original Prusa i3 3D printer by PrusaResearch PROTOCOL_VERSION:1.0 MACHINE_TYPE:Prusa i3 MK3S+R

Test files attached.
TestRing_PETG_2.gcode (58.4 KB)
TestRing_PETG_1.gcode (69.4 KB)

6/25/25 EDIT:

Contents of GCODE scripts. If not marked, the section was blank. This inclues some commands I'd tried but have commented out. As far as I know this is how it came installed, I definately didn't figure these commands out on my own:

;================AFTER CANCELLED 
;M604
; After print job is cancelled:
; disable motors
M84

;disable all heaters
{% snippet 'disable_hotends' %}
{% snippet 'disable_bed' %}
;disable fan
M106 S0

;================AFTER PRINT JOB IS PAUSED
;M601 
;M104 S{first_layer_temperature[0]-50}
After Print Job is Paused

{% if pause_position.x is not none %}
; relative XYZE
G91
M83

; retract filament of 0.8 mm up, move Z slightly upwards and 
G1 Z+5 E-0.8 F4500

; absolute XYZE
M82
G90

; move to a safe rest position, adjust as necessary
G1 X0 Y0 Z180
{% endif %}

;================BEFORE PRINT JOB IS RESUMED
;M602
;M104 S{first_layer_temperature[0]}

Before print job is resumed
{% if pause_position.x is not none %}
; relative extruder
M83

; prime nozzle
G1 E-0.8 F4500
G1 E0.8 F4500
G1 E0.8 F4500

; absolute E
M82

; absolute XYZ
G90

; reset E
G92 E{{ pause_position.e }}

; WARNING!!! - use M83 or M82(exruder absolute mode) according what your slicer generates
M83 ; extruder relative mode

; move back to pause position XYZ
G1 X{{ pause_position.x }} Y{{ pause_position.y }} Z{{ pause_position.z }} F4500

; reset to feed rate before pause if available
{% if pause_position.f is not none %}G1 F{{ pause_position.f }}{% endif %}

{% endif %}

===========END Octoprint Scripts

This is the slicer startup code for my MK3S printer for what it's worth, to see that its positioning settings:

G90 ; Absolute Positioning
M83  ; extruder relative mode
M140 S[first_layer_bed_temperature] ; set bed temp
M109 S160 ; Set extruder temp before bed level
M190 S[first_layer_bed_temperature] ; wait for bed temp

G28 W ; home all without mesh bed level
;G80 ; mesh bed leveling set 3x3, 5x5, or 7x7 in settings menu
G80 X{first_layer_print_min[0]} Y{first_layer_print_min[1]} W{(first_layer_print_max[0]) - (first_layer_print_min[0])} H{(first_layer_print_max[1]) - (first_layer_print_min[1])} ; mesh bed levelling

G1 Y-3.0 Z0.6 F1000.0 ; go outside print area

M109 S[first_layer_temperature] ; wait for extruder temp

G92 E0.0
G1 Z0.2 E8 ; Purge Bubble
G1 X60.0 E9.0  F1000.0 ; intro line
G1 X100.0 E12.5  F1000.0 ; intro line
G92 E0.0

========== END Slicer startup GCODE

Please let me know if I missed including anything. I tried very hard to be thorough.

What do these scrips actually look like?

I believe your problem is that pause / resume scripts must restore the slicer settings for absolute / relative positioning and absolute / relative extrusion.

If you search this forum for "resume after pause prusa" you will find the correct scripts to use. Alternatively, upload the scripts you are using (you have already uploaded sample gcode) and we will correct them for you.

Ewald: I have edited original post to include them

b-morgan: Thanks, I had tried hard to find the correct combo from searching the old posts but everything I found wasn't quite right or didn't work. I've added the scripts to the original post.

Please: New information always to new posts.

And also: For Code, please us the Preformatted Text feature of the forum editor.
Format

The first thing needed is to determine the mode(s) the slicer uses. This can be determined by searching the gcode for M82, M83, G90, and G91. Alternatively, you can examine a few lines with G0 and G1 commands. I don't know of any slicers that default to relative movement (G91). Some slicers default to absolute E (M82) and some to relative E(M83).

Note that G90 and G91 set the extruder mode as well so if you want relative E with absolute X,Y,Z then you need to issue the M command after the G command.

PrusaSlicer defaults are absolute X,Y,Z and relative E. This is the state when you enter the AFTER PRINT JOB IS PAUSED script and must be the state when you exit the BEFORE PRINT JOB IS RESUMED script.

Aside from a couple of extra commands, your pause and resume scripts appear to be correct for your slicer. I have removed the extra commands and shuffled a couple of commands around as seen below.

Now we need to know what happens when you pause the print using the (Prusa specific) M601 command. Since I don't have a Prusa printer, I use @PAUSE which is the OctoPrint specific command.

If you enable serial logging in OctoPrint and add an M114 command to the beginning and end of the scripts, we might gain some additional insight into what is going wrong.

;================AFTER PRINT JOB IS PAUSED
;M601
;M104 S{first_layer_temperature[0]-50}
After Print Job is Paused

{% if pause_position.x is not none %}
G91     ; relative XYZE

; retract filament of 0.8 mm up, move Z slightly upwards and
G1 Z+5 E-0.8 F4500

G90    ; absolute XYZE

; move to a safe rest position, adjust as necessary
G1 X0 Y0 Z180
{% endif %}
;================BEFORE PRINT JOB IS RESUMED
;M602
;M104 S{first_layer_temperature[0]}

Before print job is resumed
{% if pause_position.x is not none %}

M83    ; relative extruder

; prime nozzle
G1 E-0.8 F4500
G1 E0.8 F4500
G1 E0.8 F4500

G90   ; absolute XYZE

; WARNING!!! - use M83 or M82(exruder absolute mode) according what your slicer generates
M83 ; extruder relative mode

; reset E
G92 E{{ pause_position.e }}

; move back to pause position XYZ

G1 X{{ pause_position.x }} Y{{ pause_position.y }} Z{{ pause_position.z }} F4500

; reset to feed rate before pause if available
{% if pause_position.f is not none %}G1 F{{ pause_position.f }}{% endif %}

{% endif %}

Remember liberal use of the pre-formatted text icon will make it much easier for us to examine the output you post. Rather than upload the serial.log directly, upload a systeminfo bundle instead.

re formatting, got it (now), fixed my edit. re: sysinfo, that is what I thought I uploaded previously. Anyway, I'll try your adjustments, pull fresh bundles and report back. Thank you very much for the help.

1 Like

You did and thanks for the reformatting!

I changed the GCODE scripts to the ones you sent above.

I created a 3 layer square with a pause inserted by the slicer after the 1st layer. Started the job via Octoprint.

It prints the 1st layer, pauses. At the pause the printhead moves up and rearward, then stops.

I click "resume" in Octoprint and the printhead moves back to the correct X-Y coordinate BUT it does not move to correct Z. It prints the second layer "in the air", and then, on the 3rd layer the printhead moves to the correct Z (for the 3rd layer) and prints layer 3. I cancelled the print before it finished layer 3.

I'm going to add M114 and re-run now, will post the system info bundle as requested. Stand by...

Further steps taken:

  1. Added M114 to the very top of after pause code and at the very end of before resume. Enabled serial logging.
  2. Clicked the "print" button inside Octoprint on the same exact file I had uploaded earlier. The printer printed all 3 layers, it did not pause at all. It printed 3 layers to completion.
  3. I repeated the print also from Octoprint, same behavior. No pauses are happening when I print from file in Octoprint.
  4. I repeated the print, this time resending from the slicer directly. Again, no pauses.
  5. Power cycled the printer and reprinted from Octoprint print button. This time it paused after the first layer correctly, on resume it had the same behavior, moves to correct XY but stays at paused Z height, prints layer 2 in the air. I cancelled the print while printing layer 2 in the air.
  6. collected fresh systeminfo bundle here.
    octoprint-systeminfo-20250626123344.zip (120.6 KB)

Seems the problem is it is not saving the right Z to return to?

What can I try next?

Could it be this?

; retract filament of 0.8 mm up, move Z slightly upwards and
G1 Z+5 E-0.8 F4500

Maybe that Z move happened after the "pause_position.z" was stored. so the restoral location is Z+5 high? If Z is relative at that point that would make sense, I think.

OK, I added a G1 Z-5 at the resume code and that seems to have made it work, sort of. The print head moved to the correct position, however it did the Z-5 as the very first thing, then the X-Y move. On a fragile print that's risky as travelling along at the layer height above the object being printed is askign for trouble, especially with any oozed filament, I'd think. Any way to make it do that Z move last? It's last in the code, I don't understand why it's the first thing to happen.

;================BEFORE PRINT JOB IS RESUMED
;M602
;M104 S{first_layer_temperature[0]}

Before print job is resumed
{% if pause_position.x is not none %}

M83 ; relative extruder

; prime nozzle
G1 E-0.8 F4500
G1 E0.8 F4500
G1 E0.8 F4500

G90 ; absolute XYZE

; WARNING!!! - use M83 or M82(exruder absolute mode) according what your slicer generates
M83 ; extruder relative mode

; reset E
G92 E{{ pause_position.e }}

; move back to pause position XYZ

G1 X{{ pause_position.x }} Y{{ pause_position.y }} Z{{ pause_position.z }} F4500

; reset to feed rate before pause if available
{% if pause_position.f is not none %}G1 F{{ pause_position.f }}{% endif %}

{% endif %}
M114
G1 Z-5

I spoke too soon. Adding the G1 Z-5 at the end did get the printhead to the right position, albeit not in the desired order. I tried moving it up in the code to just under the XYZ reposition, but it was completely ignored there and was back to not in the right place at all when resuming.

But I discovered the second issue, Resume is also not restarting the nozzle heater. Pause turns it off apparently, it starts cooling down. If I let to go down 20 deg or so before pressing resume, I can see that not only does it not go back to the print temp, it continues to go down, assuming it's still headed completely off. So besides Z, that's not restoring, either.

There are no temperature adjusting gcode commands in the pause and resume scripts. Any changes to the temperature are a result of the M601 command in the gcode produced by the slicer. See https://forum.prusa3d.com/forum/original-prusa-i3-mk2-s-others-archive/anyone-tried-the-new-pause-print-gcode-m601-m602/.

My suggestion would be to change the M601 command in the gcode produced by the slicer to @pause. Alternatively, use the pause and resume scripts as shown in the above topic.

1 Like

re temp, good to know. I'll try those (relatively simple scripts) and report back.

For the @pause you mention, you mean edit the gcode file and replace:

M601

with

@pause

right?

If I can't find a way to do that programmatically via some kind of post processing, it would be a pain as I normally just click "send to printer" in Prusaslicer.

Yes, that's exactly what I meant. Manually edit the gcode file.

This is an experiment to help determine the correct contents of the OctoPrint pause and resume scripts. It should eliminate the temperature changes caused by the M601 and may eliminate the
wonky Z location. We won't know until we try.

The other experiment would be to replace the OctoPrint pause and resume scripts with those shown in the Prusa forum thread. I'm unsure about how the printer will handle multiple M601 commands because the part gcode starts the pause with one and the pause script has another one but I don't have a Prusa printer so you have to tell us.

Once we figure out how to pause and resume correctly, then we can move on to figuring out the post processing issue.

A quick look at the PrusaSlicer 2.9.2 printer settings and under Custom G-code, Pause Print G-code you can change the M601 to @pause. That should take care of the post processing issue.

1 Like