klipper_config/macros.cfg

151 lines
4.4 KiB
INI

[gcode_macro G32]
gcode:
BED_MESH_CLEAR
G28
QUAD_GANTRY_LEVEL
G28
G0 X150 Y150 Z30 F3600
[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
gcode:
TURN_OFF_HEATERS
CANCEL_PRINT_BASE
[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
# change this if you need more or less extrusion
variable_extrude: 1.0
gcode:
# read E from pause macro
{% set E = printer["gcode_macro PAUSE"].extrude|float %}
# set park positon for x and y
{% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %}
{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
# calculate save lift position
{% 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 %}
# end of definitions
PAUSE_BASE
G91
{% if printer.extruder.can_extrude|lower == 'true' %}
G1 E-{E} F2100
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
{% if "xyz" in printer.toolhead.homed_axes %}
G1 Z{z_safe} F900
G90
G1 X{x_park} Y{y_park} F6000
{% else %}
{action_respond_info("Printer not homed")}
{% endif %}
[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
gcode:
# read E from pause macro
{% set E = printer["gcode_macro PAUSE"].extrude|float %}
# get VELOCITY parameter if specified
{% if 'VELOCITY' in params|upper %}
{% set get_params = ('VELOCITY=' + params.VELOCITY) %}
{%else %}
{% set get_params = "" %}
{% endif %}
# end of definitions
{% if printer.extruder.can_extrude|lower == 'true' %}
G91
G1 E{E} F2100
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
RESUME_BASE {get_params}
[gcode_macro FILAMENT_UNLOAD]
description: unload filament
gcode:
{% if printer.extruder.can_extrude|lower == 'true' %}
M83 # e relative coordinates
G0 E-75 F3000 # unload
M82 # e absolute coordinates
{% else %}
{action_respond_info("extruder not hot enough")}
{% endif %}
[gcode_macro FILAMENT_LOAD]
description: load filament
gcode:
{% if printer.extruder.can_extrude|lower == 'true' %}
M83 # e relative coordinates
G0 E75 F3000
G0 E30 F300
M82 # e absolute coordinates
{% else %}
{action_respond_info("extruder not hot enough")}
{% endif %}
[gcode_macro FILAMENT_PURGE]
description: purge filament
gcode:
{% set e = params.e|default(10)|float %}
{% if printer.extruder.can_extrude|lower == 'true' %}
M83 # e relative coordinates
G1 E-{e} F300
M82 # e absolute coordinates
{% else %}
{action_respond_info("extruder not hot enough")}
{% endif %}
[gcode_macro PRINT_START]
gcode:
M117 >> configuring
SET_LED LED=caselight RED=0.00 GREEN=0.00 BLUE=0.50
M140 S{BED} # start bed heating
M104 S{EXTRUDER} # start extruder heating
G92 E0 # reset extruder
G21 # set units to millimeters
G90 # use absolute coordinates
M83 # use relative distances for extrusion
G4 P1000
M117 >> homing
SET_LED LED=caselight RED=0.00 GREEN=0.50 BLUE=0.00
G32 # home all axes
M117 >> heating
SET_LED LED=caselight RED=0.50 GREEN=0.00 BLUE=0.00
G92 E0 # reset extruder
M190 S{BED} # set and wait for bed temperature
M109 S{EXTRUDER} # set and wait for nozzle temperature
M117 >> starting
SET_LED LED=caselight RED=0.50 GREEN=0.50 BLUE=0.50
[gcode_macro PRINT_END]
gcode:
M117 >> finished
M400 ; wait for buffer to clear
G92 E0 ; zero the extruder
G1 E-10.0 F3600 ; retract filament
G91 ; relative positioning
G0 Z1.00 X20.0 Y20.0 F20000 ; move nozzle to remove stringing
TURN_OFF_HEATERS
M107 ; turn off fan
G1 Z2 F3000 ; move nozzle up 2mm
G90 ; absolute positioning
G0 X125 Y250 F3600 ; park nozzle at rear
BED_MESH_CLEAR