From 9e50375c034d054e6fb705d6eb110722198deb76 Mon Sep 17 00:00:00 2001 From: elpopo <68954733+elpopo-eng@users.noreply.github.com> Date: Sun, 25 Feb 2024 17:37:35 +0100 Subject: [PATCH] Add a park front macro for toolhead maintenance (#494) --- macros/base/park.cfg | 62 +++++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/macros/base/park.cfg b/macros/base/park.cfg index 0c1196925..b6b24c212 100644 --- a/macros/base/park.cfg +++ b/macros/base/park.cfg @@ -24,30 +24,44 @@ gcode: {% set z_safe = max_z %} {% endif %} - {% if printer.toolhead.homed_axes != "xyz" %} - RESPOND MSG="Cannot park because XYZ not homed" - {% else %} # retract filament before move up toolhead - {% if printer.extruder.can_extrude %} - {% if firmware_retraction_enabled %} # use firmware_retraction parameter for retract (in case firmware retraction is selected in printer.cfg) - {% if verbose %} - RESPOND MSG="Firmware retraction enabled, Extruder retraction = {printer.firmware_retraction.retract_length}" - {% endif %} - G10 - {% else %} # otherwise: - {% if MATERIAL != "XXX" %} # use material parameter if available for retract, otherwise use default value - {% set material = printer["gcode_macro _USER_VARIABLES"].material_parameters[MATERIAL] %} - {% set E = material.retract_length %} - {% endif %} - {% if verbose %} - RESPOND MSG="Firmware retraction disabled, Extruder retraction = {E}" - {% endif %} - G92 E0 - G1 E-{E} F2100 + _CG28 ; home if not already homed + + {% if printer.extruder.can_extrude %} + {% if firmware_retraction_enabled %} # use firmware_retraction parameter for retract (in case firmware retraction is selected in printer.cfg) + {% if verbose %} + RESPOND MSG="Firmware retraction enabled, Extruder retraction = {printer.firmware_retraction.retract_length}" + {% endif %} + G10 + {% else %} # otherwise: + {% if MATERIAL != "XXX" %} # use material parameter if available for retract, otherwise use default value + {% set material = printer["gcode_macro _USER_VARIABLES"].material_parameters[MATERIAL] %} + {% set E = material.retract_length %} + {% endif %} + {% if verbose %} + RESPOND MSG="Firmware retraction disabled, Extruder retraction = {E}" {% endif %} - {% else %} - RESPOND MSG="no extruder retraction because extruder temperature ({printer.extruder.temperature}) is lower than min_extrude_temp ({printer.configfile.config.extruder.min_extrude_temp})" + G92 E0 + G1 E-{E} F2100 {% endif %} - G90 - G1 Z{z_safe} F{Sz} - G0 X{Px} Y{Py} F{St} + {% else %} + RESPOND MSG="no extruder retraction because extruder temperature ({printer.extruder.temperature}) is lower than min_extrude_temp ({printer.configfile.config.extruder.min_extrude_temp})" {% endif %} + + G90 + G1 Z{z_safe} F{Sz} + G0 X{Px} Y{Py} F{St} + + +[gcode_macro PARK_FRONT] +description: Park the toolhead on the front of the printer for maintenance +gcode: + {% set St = printer["gcode_macro _USER_VARIABLES"].travel_speed * 60 %} + {% set Sz = printer["gcode_macro _USER_VARIABLES"].z_drop_speed * 60 %} + + _CG28 ; home if not already homed + + SAVE_GCODE_STATE NAME=PARK_FRONT + G90 ; absolute positioning + G0 Z{printer.toolhead.axis_maximum.z/3*2} F{Sz} + G0 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_minimum.y+10} F{St} + RESTORE_GCODE_STATE NAME=PARK_FRONT