From 5b4675f1ed3faf1369c8dca7547c8c39fd71bc87 Mon Sep 17 00:00:00 2001 From: elpopo <68954733+elpopo-eng@users.noreply.github.com> Date: Fri, 1 Mar 2024 16:41:08 +0100 Subject: [PATCH 1/2] fix homing check for PARK in error gcode (#513) --- config/machine.cfg | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/config/machine.cfg b/config/machine.cfg index 0f239a2a6..734cb60f5 100644 --- a/config/machine.cfg +++ b/config/machine.cfg @@ -1,13 +1,18 @@ [virtual_sdcard] path: ~/printer_data/gcodes on_error_gcode: - {% if printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %} - STATUS_LEDS COLOR="ERROR" - {% endif %} - {% if printer["gcode_macro _USER_VARIABLES"].probe_type_enabled == "dockable" %} - _PROBE_ON_ERROR_ACTION - {% endif %} - PARK + {% if printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %} + STATUS_LEDS COLOR="ERROR" + {% endif %} + {% if printer["gcode_macro _USER_VARIABLES"].probe_type_enabled == "dockable" or printer["gcode_macro _USER_VARIABLES"].probe_type_enabled == "dockable_virtual" %} + _PROBE_ON_ERROR_ACTION + {% endif %} + + # Park only if printer is homed + {% if "xyz" in printer.toolhead.homed_axes %} + PARK + {% endif %} + [idle_timeout] timeout: 1800 From 3bcc2df874208dc68594e59ca0dc103c4daeb752 Mon Sep 17 00:00:00 2001 From: elpopo <68954733+elpopo-eng@users.noreply.github.com> Date: Mon, 4 Mar 2024 10:10:32 +0100 Subject: [PATCH 2/2] fix PARK with overriden param E (#515) --- macros/base/park.cfg | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/macros/base/park.cfg b/macros/base/park.cfg index dca0db2d5..c0b994b27 100644 --- a/macros/base/park.cfg +++ b/macros/base/park.cfg @@ -2,8 +2,7 @@ description: Park the toolhead at the back and retract some filament if the nozzle is hot gcode: {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} - {% set E = params.E|default(1.7)|float|abs %} - {% set MATERIAL = printer['gcode_macro START_PRINT'].material %} + {% set material = printer['gcode_macro START_PRINT'].material %} {% set Px, Py = printer["gcode_macro _USER_VARIABLES"].park_position_xy|map('float') %} {% set Px = params.X|default(Px)|float %} @@ -24,22 +23,37 @@ gcode: {% set z_safe = max_z %} {% endif %} + SAVE_GCODE_STATE NAME=PARK + _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 params.E is defined %} + {% set E = params.E|float|abs %} + {% if verbose %} - RESPOND MSG="Firmware retraction disabled, Extruder retraction = {E}" + RESPOND MSG="Retraction overrided with parameter, Extruder retraction = {E}" + {% endif %} + {% else %} + {% 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 printer["gcode_macro _USER_VARIABLES"].material_parameters[material] is defined %} # use material parameter if available for retract, otherwise use default value + {% set E = printer["gcode_macro _USER_VARIABLES"].material_parameters[material].retract_length|default(1.7) %} + {% else %} + {% set E = 1.7 %} + {% endif %} + + {% if verbose %} + RESPOND MSG="Firmware retraction disabled, Extruder retraction = {E}" + {% endif %} {% endif %} + {% endif %} + + {% if E is defined and E > 0 %} G92 E0 G1 E-{E} F2100 {% endif %} @@ -48,7 +62,8 @@ gcode: G90 G1 Z{z_safe} F{Sz} G0 X{Px} Y{Py} F{St} - + + RESTORE_GCODE_STATE NAME=PARK [gcode_macro PARK_FRONT] description: Park the toolhead on the front of the printer for maintenance