Retract at print end, undo it at print start

Klipper's G10 retracts only once until a G11, and nothing sends G11 on
this printer: the G10 in PRINT_WARMUP used up the retract, so PRINT_END
never retracted and the nozzle leaked while cooling down.

- _NOZZLE_RETRACT retracts and remembers the amount in the saved
  variable nozzle_retract (survives restarts, capped at 15 mm).
  PRINT_END retracts 5 mm, PRINT_WARMUP 2 mm, CANCEL_PRINT 5 mm plus the
  park/PAUSE retract.
- _NOZZLE_UNRETRACT in PRINT_START pushes it back over the bucket before
  the wipe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-10-11 15:01:55 +02:00
1 parent 179bd0991b
commit e152246e9f
3 files changed
+61 -3

No files matched your search

+11
View File
@@ -109,6 +109,8 @@ description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE_KLIPPERSCREEN
variable_park: True
gcode:
{% set pause = printer["gcode_macro PAUSE"] %}
{% set park_retract = printer['gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL'].extrude %}
## 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'%}
@@ -117,6 +119,15 @@ gcode:
STOP_HEAT_SOAK
CANCEL_PRINT_BASE_KLIPPERSCREEN
# 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 %}
# Same cleanup as PRINT_END: heaters incl. chamber heater, fan, flow, bdwidth
_PRINT_CLEANUP
SET_GCODE_VARIABLE MACRO=PAUSE VARIABLE=parked VALUE=False