From fd72f36fcd894cff6ea45740a2e12ab9b4790509 Mon Sep 17 00:00:00 2001 From: Thomas Schmid Date: Thu, 6 Jan 2022 12:53:00 +0100 Subject: [PATCH] Move macros into seperate file Move gcode macros into sperate file macros.cfg and include it in main config file printer.cfg. Signed-off-by: Thomas Schmid --- macros.cfg | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++ printer.cfg | 64 +-------------------------------------------------- 2 files changed, 67 insertions(+), 63 deletions(-) create mode 100644 macros.cfg diff --git a/macros.cfg b/macros.cfg new file mode 100644 index 0000000..db6e967 --- /dev/null +++ b/macros.cfg @@ -0,0 +1,66 @@ +##################################################################### +# Macros +##################################################################### + +[gcode_macro G32] +gcode: + BED_MESH_CLEAR + G28 + QUAD_GANTRY_LEVEL + G0 X340 Y340 F18000 + G28 + ## Uncomment for for your size printer: + #-------------------------------------------------------------------- + ## Uncomment for 250mm build + #G0 X125 Y125 Z30 F3600 + + ## Uncomment for 300 build + #G0 X150 Y150 Z30 F3600 + + ## Uncomment for 350mm build + #G0 X175 Y175 Z30 F3600 + G0 Z20 + #-------------------------------------------------------------------- + +[gcode_macro PURGE_LINE] +gcode: + G0 X0 Y0 F18000 ; move to print bed corner + G92 E0 + G0 Z0.2 F3000 ; move to bed + G1 X100 E20 F1000 ; intro line + G92 E0 + + G1 E-0.5 F3600 + +[gcode_macro PRINT_START] +# Use PRINT_START for the slicer starting script - please customise for your slicer of choice +gcode: + G32 ; home all axes + G1 Z20 F3000 ; move nozzle away from bed + + PURGE_LINE + +[gcode_macro PRINT_END] +# Use PRINT_END for the slicer ending script - please customise for your slicer of choice +gcode: + # safe anti-stringing move coords + {% set th = printer.toolhead %} + {% set x_safe = th.position.x + 20 * (1 if th.axis_maximum.x - th.position.x > 20 else -1) %} + {% set y_safe = th.position.y + 20 * (1 if th.axis_maximum.y - th.position.y > 20 else -1) %} + {% set z_safe = [th.position.z + 2, th.axis_maximum.z]|min %} + + SAVE_GCODE_STATE NAME=STATE_PRINT_END + + M400 ; wait for buffer to clear + G92 E0 ; zero the extruder + G1 E-2.0 F3600 ; retract filament + + TURN_OFF_HEATERS + + G90 ; absolute positioning + G0 X{x_safe} Y{y_safe} Z{z_safe} F20000 ; move nozzle to remove stringing + G0 X{th.axis_maximum.x//2} Y{th.axis_maximum.y - 2} F3600 ; park nozzle at rear + M107 ; turn off fan + + BED_MESH_CLEAR + RESTORE_GCODE_STATE NAME=STATE_PRINT_END \ No newline at end of file diff --git a/printer.cfg b/printer.cfg index 20ae89a..4a74ca4 100644 --- a/printer.cfg +++ b/printer.cfg @@ -574,69 +574,7 @@ gcode: ##################################################################### # Macros ##################################################################### - -[gcode_macro G32] -gcode: - BED_MESH_CLEAR - G28 - QUAD_GANTRY_LEVEL - G0 X340 Y340 F18000 - G28 - ## Uncomment for for your size printer: - #-------------------------------------------------------------------- - ## Uncomment for 250mm build - #G0 X125 Y125 Z30 F3600 - - ## Uncomment for 300 build - #G0 X150 Y150 Z30 F3600 - - ## Uncomment for 350mm build - #G0 X175 Y175 Z30 F3600 - G0 Z20 - #-------------------------------------------------------------------- - -[gcode_macro PURGE_LINE] -gcode: - G0 X0 Y0 F18000 ; move to print bed corner - G92 E0 - G0 Z0.2 F3000 ; move to bed - G1 X100 E20 F1000 ; intro line - G92 E0 - - G1 E-0.5 F3600 - -[gcode_macro PRINT_START] -# Use PRINT_START for the slicer starting script - please customise for your slicer of choice -gcode: - G32 ; home all axes - G1 Z20 F3000 ; move nozzle away from bed - - PURGE_LINE - -[gcode_macro PRINT_END] -# Use PRINT_END for the slicer ending script - please customise for your slicer of choice -gcode: - # safe anti-stringing move coords - {% set th = printer.toolhead %} - {% set x_safe = th.position.x + 20 * (1 if th.axis_maximum.x - th.position.x > 20 else -1) %} - {% set y_safe = th.position.y + 20 * (1 if th.axis_maximum.y - th.position.y > 20 else -1) %} - {% set z_safe = [th.position.z + 2, th.axis_maximum.z]|min %} - - SAVE_GCODE_STATE NAME=STATE_PRINT_END - - M400 ; wait for buffer to clear - G92 E0 ; zero the extruder - G1 E-2.0 F3600 ; retract filament - - TURN_OFF_HEATERS - - G90 ; absolute positioning - G0 X{x_safe} Y{y_safe} Z{z_safe} F20000 ; move nozzle to remove stringing - G0 X{th.axis_maximum.x//2} Y{th.axis_maximum.y - 2} F3600 ; park nozzle at rear - M107 ; turn off fan - - BED_MESH_CLEAR - RESTORE_GCODE_STATE NAME=STATE_PRINT_END +[include macros.cfg] #*# <---------------------- SAVE_CONFIG ----------------------> #*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.