2026-10-10 14:24:37 +02:00
|
|
|
# PAUSE, RESUME, CANCEL_PRINT, M600 (based on the KlipperScreen recommended macros)
|
2026-10-10 15:20:28 +02:00
|
|
|
#
|
|
|
|
|
# Chain on this printer (AFC renames PAUSE/RESUME at startup):
|
|
|
|
|
# PAUSE -> AFC_PAUSE (saves position, z-hop) -> this PAUSE -> PAUSE_BASE
|
|
|
|
|
# RESUME -> AFC_RESUME -> this RESUME -> HEAT_SOAK_RESUME -> _RESUME_PRINT
|
|
|
|
|
# -> RESUME_BASE, then AFC restores the saved position
|
|
|
|
|
# RESUME is defined only here: heating/heat_soak.cfg used to define its own,
|
|
|
|
|
# which replaced this one completely (no unretract, no fan restore).
|
2026-10-10 14:24:37 +02:00
|
|
|
|
2026-10-10 13:45:11 +02:00
|
|
|
# https://klipperscreen.readthedocs.io/en/latest/macros/#recommended
|
|
|
|
|
[gcode_macro PAUSE]
|
|
|
|
|
description: Pause the actual running print
|
|
|
|
|
rename_existing: PAUSE_BASE
|
|
|
|
|
variable_saved_fan_speed: 0.0
|
2026-10-10 15:20:28 +02:00
|
|
|
variable_parked: False # set by PAUSE, used by _RESUME_PRINT
|
2026-10-10 13:45:11 +02:00
|
|
|
gcode:
|
2026-10-10 15:20:28 +02:00
|
|
|
{% if not printer.pause_resume.is_paused %}
|
|
|
|
|
SET_GCODE_VARIABLE MACRO=PAUSE VARIABLE=saved_fan_speed VALUE={printer.fan.speed}
|
|
|
|
|
# Pause first, so the saved state is the print position, then retract and park
|
|
|
|
|
PAUSE_BASE
|
|
|
|
|
_TOOLHEAD_PARK_PAUSE_CANCEL
|
|
|
|
|
SET_GCODE_VARIABLE MACRO=PAUSE VARIABLE=parked VALUE=True
|
|
|
|
|
# Set fan to S28 (28/255 ≈ 0.1098)
|
|
|
|
|
M106 S28
|
|
|
|
|
{% else %}
|
|
|
|
|
PAUSE_BASE
|
2026-10-10 13:45:11 +02:00
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
|
|
[gcode_macro RESUME]
|
2026-10-10 15:20:28 +02:00
|
|
|
description: Resume the print (while HEAT_SOAK runs: skip the soak phase)
|
2026-10-10 13:45:11 +02:00
|
|
|
rename_existing: RESUME_BASE
|
|
|
|
|
gcode:
|
2026-10-10 15:20:28 +02:00
|
|
|
HEAT_SOAK_RESUME ON_RESUME=_RESUME_PRINT {rawparams}
|
|
|
|
|
|
|
|
|
|
[gcode_macro _RESUME_PRINT]
|
|
|
|
|
description: Resume after PAUSE: unretract, restore the part fan, continue the print
|
|
|
|
|
gcode:
|
|
|
|
|
{% set pause = printer["gcode_macro PAUSE"] %}
|
2026-10-10 13:45:11 +02:00
|
|
|
{% set extrude = printer['gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL'].extrude %}
|
|
|
|
|
#### get VELOCITY parameter if specified ####
|
|
|
|
|
{% if 'VELOCITY' in params|upper %}
|
|
|
|
|
{% set get_params = ('VELOCITY=' + params.VELOCITY) %}
|
|
|
|
|
{%else %}
|
|
|
|
|
{% set get_params = "" %}
|
|
|
|
|
{% endif %}
|
|
|
|
|
##### end of definitions #####
|
2026-10-10 15:20:28 +02:00
|
|
|
# Only undo what PAUSE did; HEAT_SOAK pauses with PAUSE_BASE (no retract, no park)
|
|
|
|
|
{% if pause.parked %}
|
|
|
|
|
{% if printer.extruder.can_extrude|lower == 'true' %}
|
|
|
|
|
M83
|
|
|
|
|
G1 E{extrude} F2100
|
|
|
|
|
{% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
|
|
|
|
|
{% else %}
|
|
|
|
|
{action_respond_info("Extruder not hot enough")}
|
|
|
|
|
{% endif %}
|
2026-10-10 13:45:11 +02:00
|
|
|
|
2026-10-10 15:20:28 +02:00
|
|
|
# Restore saved fan speed
|
|
|
|
|
{% set old_fan = pause.saved_fan_speed %}
|
|
|
|
|
{% if old_fan > 0 %}
|
|
|
|
|
M106 S{[(old_fan * 255)|int, 255]|min}
|
|
|
|
|
{% else %}
|
2026-10-10 13:45:11 +02:00
|
|
|
M107
|
2026-10-10 15:20:28 +02:00
|
|
|
{% endif %}
|
|
|
|
|
SET_GCODE_VARIABLE MACRO=PAUSE VARIABLE=parked VALUE=False
|
2026-10-10 13:45:11 +02:00
|
|
|
{% endif %}
|
2026-10-10 15:20:28 +02:00
|
|
|
|
|
|
|
|
RESUME_BASE {get_params}
|
2026-10-10 13:45:11 +02:00
|
|
|
_status_printing
|
|
|
|
|
|
|
|
|
|
[gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL]
|
|
|
|
|
description: Helper: park toolhead used in PAUSE and CANCEL_PRINT
|
|
|
|
|
variable_extrude: 2.0
|
|
|
|
|
gcode:
|
|
|
|
|
##### set park positon for x and y #####
|
|
|
|
|
# default is your max posion from your printer.cfg
|
|
|
|
|
|
|
|
|
|
# {% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %}
|
|
|
|
|
{% set x_park = 20.0 %}
|
|
|
|
|
{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
|
|
|
|
|
{% set z_park_delta = 2.0 %}
|
|
|
|
|
##### calculate save lift position #####
|
|
|
|
|
{% set max_z = printer.toolhead.axis_maximum.z|float %}
|
|
|
|
|
{% set act_z = printer.toolhead.position.z|float %}
|
|
|
|
|
{% if act_z < (max_z - z_park_delta) %}
|
|
|
|
|
{% set z_safe = z_park_delta %}
|
|
|
|
|
{% else %}
|
|
|
|
|
{% set z_safe = max_z - act_z %}
|
|
|
|
|
{% endif %}
|
|
|
|
|
##### end of definitions #####
|
|
|
|
|
{% if printer.extruder.can_extrude|lower == 'true' %}
|
|
|
|
|
M83
|
|
|
|
|
G1 E-{extrude} F2100
|
|
|
|
|
{% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
|
|
|
|
|
{% else %}
|
|
|
|
|
{action_respond_info("Extruder not hot enough")}
|
|
|
|
|
{% endif %}
|
|
|
|
|
{% if "xyz" in printer.toolhead.homed_axes %}
|
|
|
|
|
G91
|
|
|
|
|
G1 Z{z_safe} F900
|
|
|
|
|
G90
|
|
|
|
|
G1 X{x_park} Y{y_park} F6000
|
|
|
|
|
{% if printer.gcode_move.absolute_coordinates|lower == 'false' %} G91 {% endif %}
|
|
|
|
|
{% else %}
|
|
|
|
|
{action_respond_info("Printer not homed")}
|
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
|
|
[gcode_macro CANCEL_PRINT]
|
|
|
|
|
description: Cancel the actual running print
|
|
|
|
|
rename_existing: CANCEL_PRINT_BASE_KLIPPERSCREEN
|
|
|
|
|
variable_park: True
|
|
|
|
|
gcode:
|
2026-10-11 15:01:55 +02:00
|
|
|
{% set pause = printer["gcode_macro PAUSE"] %}
|
|
|
|
|
{% set park_retract = printer['gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL'].extrude %}
|
2026-10-10 13:45:11 +02:00
|
|
|
## Move head and retract only if not already in the pause state and park set to true
|
|
|
|
|
|
|
|
|
|
{% if printer.pause_resume.is_paused|lower == 'false' and park|lower == 'true'%}
|
|
|
|
|
_TOOLHEAD_PARK_PAUSE_CANCEL
|
|
|
|
|
{% endif %}
|
|
|
|
|
|
2026-10-10 15:20:28 +02:00
|
|
|
STOP_HEAT_SOAK
|
2026-10-10 13:45:11 +02:00
|
|
|
CANCEL_PRINT_BASE_KLIPPERSCREEN
|
2026-10-11 15:01:55 +02:00
|
|
|
# Same end-of-print retract as PRINT_END (skipped if the nozzle is already cold);
|
|
|
|
|
# EXTRA: the park retract of PAUSE or of the park above, so PRINT_START undoes it too
|
|
|
|
|
{% if printer.pause_resume.is_paused %}
|
|
|
|
|
_NOZZLE_RETRACT EXTRA={park_retract if pause.parked else 0}
|
|
|
|
|
{% elif park and printer.extruder.can_extrude %}
|
|
|
|
|
_NOZZLE_RETRACT EXTRA={park_retract}
|
|
|
|
|
{% else %}
|
|
|
|
|
_NOZZLE_RETRACT
|
|
|
|
|
{% endif %}
|
2026-10-10 15:20:28 +02:00
|
|
|
# Same cleanup as PRINT_END: heaters incl. chamber heater, fan, flow, bdwidth
|
|
|
|
|
_PRINT_CLEANUP
|
|
|
|
|
SET_GCODE_VARIABLE MACRO=PAUSE VARIABLE=parked VALUE=False
|
|
|
|
|
_status_ready
|
2026-10-10 13:45:11 +02:00
|
|
|
|
|
|
|
|
[gcode_macro M600]
|
|
|
|
|
#
|
|
|
|
|
# M600
|
|
|
|
|
# https://github.com/simplisticton/common-macros/tree/main
|
|
|
|
|
#
|
|
|
|
|
# Mimic Marlin's Pause for filament change command
|
|
|
|
|
description: Pause for filament change
|
|
|
|
|
gcode:
|
|
|
|
|
PAUSE
|
|
|
|
|
M117 Paused
|
2026-10-10 14:24:37 +02:00
|
|
|
M118 Print paused for filament change... type "Resume" to continue
|