diff --git a/src/modules/fluidd/filesystem/home/pi/klipper_config/client_macros.cfg b/src/modules/fluidd/filesystem/home/pi/klipper_config/client_macros.cfg index 682dd6ef9..a115a5d90 100644 --- a/src/modules/fluidd/filesystem/home/pi/klipper_config/client_macros.cfg +++ b/src/modules/fluidd/filesystem/home/pi/klipper_config/client_macros.cfg @@ -1,5 +1,5 @@ -# This macro is required for Fluidd to correctly function. -# You can copy this entries into your printer.cfg. +# These macros are required for Fluidd to correctly function. +# You can copy these entries into your printer.cfg. # # Alternatively, import this file by adding # this line into your printer.cfg; @@ -13,3 +13,34 @@ gcode: CLEAR_PAUSE SDCARD_RESET_FILE BASE_CANCEL_PRINT + +[gcode_macro PAUSE] +rename_existing: BASE_PAUSE +default_parameter_E: 1.7 +gcode: + {% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %} + {% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %} + {% set max_z = printer.toolhead.axis_maximum.z|float %} + {% set act_z = printer.toolhead.position.z|float %} + {% if act_z < (max_z - 2.0) %} + {% set z_safe = 2.0 %} + {% else %} + {% set z_safe = max_z - act_z %} + {% endif %} + SAVE_GCODE_STATE NAME=PAUSE_state + BASE_PAUSE + G91 + G1 E-{E} F2100 + G1 Z{z_safe} F900 + G90 + G0 X{x_park} Y{y_park} F6000 + G91 + +[gcode_macro RESUME] +rename_existing: BASE_RESUME +default_parameter_E: 1.7 +gcode: + G91 + G1 E{E} F2100 + RESTORE_GCODE_STATE NAME=PAUSE_state + BASE_RESUME