Voron2_Config/macros.cfg

102 lines
3.1 KiB
INI
Raw Permalink Normal View History

#####################################################################
# Macros
#####################################################################
[gcode_macro FILAMENT_STATE]
gcode:
SAVE_VARIABLE VARIABLE=filament_loaded VALUE={(params.LOADED | int) > 0}
[gcode_macro FILAMENT_CHANGE]
variable_state: 0
variable_allow_change: 0
gcode:
{% if params.STATE is defined %}
SET_GCODE_VARIABLE MACRO=FILAMENT_CHANGE VARIABLE=state VALUE={(params.STATE | int) > 0}
{% endif %}
{% if params.ALLOW_CHANGE is defined %}
SET_GCODE_VARIABLE MACRO=FILAMENT_CHANGE VARIABLE=allow_change VALUE={(params.ALLOW_CHANGE | int) > 0}
{% endif %}
[gcode_macro M73]
rename_existing: M73.1
variable_p: 0.0
variable_rtime: 0.0
gcode:
SET_GCODE_VARIABLE MACRO=M73 VARIABLE=rtime VALUE={params.R | int}
{% if params.P is defined %}
SET_GCODE_VARIABLE MACRO=M73 VARIABLE=p VALUE={params.P | int}
M73.1 P{params.P}
{% endif %}
[gcode_macro G32]
gcode:
{% if 'x' in printer.toolhead.homed_axes and 'y' in printer.toolhead.homed_axes %}
G28 Z
{% else %}
G28
{% endif %}
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:
G28 X Y
M190 S{params.BED | int}
M109 S{params.EXTRUDER | int}
BED_MESH_CLEAR
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