Skip to content

Commit

Permalink
Add a park front macro for toolhead maintenance (#494)
Browse files Browse the repository at this point in the history
  • Loading branch information
elpopo-eng authored Feb 25, 2024
1 parent 405a98e commit 9e50375
Showing 1 changed file with 38 additions and 24 deletions.
62 changes: 38 additions & 24 deletions macros/base/park.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 9e50375

Please sign in to comment.