These are my G-Code script's that i am using in OctoPrint with my Ender 3 Pro running the Marlin firmware.
; check for paused state
{% if pause_position.x is not none %}
; relative XYZE
G91
M83
; retract filament, move Z slightly upwards
G1 Z+5 E-5 F4500
; absolute XYZE
M82
G90
; move to a safe rest position, adjust as necessary
G1 X0 Y0
; disable all heaters
{% snippet 'disable_hotends' %}
{% snippet 'disable_bed' %}
; disable fan
M106 S0
{% endif %}
; check for paused state
{% if pause_position.x is not none %}
; enable fan
M106 S255
; heat the nozzle
{% for tool in range(printer_profile.extruder.count) %}
{% if pause_temperature[tool] and pause_temperature[tool]['target'] is not none %}
{% if tool == 0 and printer_profile.extruder.count == 1 %}
M109 T{{ tool }} S{{ pause_temperature[tool]['target'] }}
{% else %}
M109 S{{ pause_temperature[tool]['target'] }}
{% endif %}
{% else %}
{% if tool == 0 and printer_profile.extruder.count == 1 %}
M104 T{{ tool }} S0
{% else %}
M104 S0
{% endif %}
{% endif %}
{% endfor %}
; heat the bed
{% if printer_profile.heatedBed %}
{% if pause_temperature['b'] and pause_temperature['b']['target'] is not none %}
M190 S{{ pause_temperature['b']['target'] }}
{% else %}
M140 S0
{% endif %}
{% endif %}
; relative extruder
M83
; prime nozzle
G1 E-5 F4500
G1 E5 F4500
G1 E5 F4500
; absolute E
M82
; absolute XYZ
G90
; 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 %}
- Incorporate last fanspeed into after resume instead of fixed value with Octoprint 1.9.0
OctoPrint/OctoPrint#4531