VoronV0_klipper/macros.d/start_end.cfg

94 lines
2.7 KiB
INI

######################################################################
# Start Print and End Print
######################################################################
# Replace the slicer's custom start and end g-code scripts with
# START_PRINT and END_PRINT.
[gcode_macro START_PRINT]
variable_parameter_T_BED: 60
variable_parameter_T_EXTRUDER: 190
gcode:
##### Get Boundaries #####
{% set max_x = printer.toolhead.axis_maximum.x|float %}
{% set max_y = printer.toolhead.axis_maximum.y|float %}
{% set mid_x = max_x / 2 %}
{% set mid_y = max_y / 2 %}
CLEAR_PAUSE
G90
# Hold the hotend temperature (useful for reprints)
M104 S{printer.extruder.temperature}
# Start preheating the bed
M117 Heating bed
_STATUS_LED COLOR=RED BLINK=1
M140 S{T_BED}
# Perform a G28 'home' (if needed)
SMARTHOME
# Check to see if we need more time preheating the bed, if so
{% if printer.heater_bed.temperature < params.T_BED|float*0.85 %}
M117 Heating bed to 85%
G0 X{mid_x} Y{mid_y} Z10 F20000
M106
M190 S{params.T_BED|float*0.85}
{% endif %}
M117 Heating bed/toolhead
{% if printer.extruder.temperature < params.T_EXTRUDER|float*0.75 %}
M104 S{params.T_EXTRUDER|float*0.75}
{% endif %}
M190 S{T_BED}
M107
# Move the nozzle near the bed
G0 X0 Y{max_y} Z2.0 F20000
M117 Heating toolhead
M109 S{T_EXTRUDER}
# Prime line
_STATUS_LED COLOR=GREEN BLINK=1
PURGE_EXTRUDER
PRIME_EXTRUDER
M117
_STATUS_LED COLOR=BLUE BLINK=1
[gcode_macro END_PRINT]
variable_print_done: 'false'
gcode:
##### Get Boundaries #####
{% set max_y = printer.toolhead.axis_maximum.y|float %}
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set mid_x = (printer.toolhead.axis_maximum.x|float / 2)|float %}
SAVE_GCODE_STATE NAME=STATE_PRINT_END
M400 ; Wait for buffer to clear
# Anti-Stringing
G92 E0 ; zero the extruder
G1 E-2.0 F3600 ; retract 2mm of filament at 60mm/s
G91 ; relative positioning
G1 X1 F20000 ; move 1mm to the side at 333mm/sec
G2 E0 I-1 ; do a no extrusion circle move with a 0.5mm radius centered on orig
G1 Z5.00 F3000 ; move up by 5mm @ 50mm/sec to clear the print
G90 ; absolute positioning
TURN_OFF_HEATERS
M107
G90
G0 X{mid_x} Y{max_y} F20000
G0 Z{max_z} F6000
BED_MESH_CLEAR
M300 ; Play a tone
_STATUS_LED COLOR=GREEN
UPDATE_DELAYED_GCODE ID=_CLEAR_DISPLAY DURATION=10
SET_GCODE_VARIABLE MACRO=END_PRINT VARIABLE=print_done VALUE='"true"'
RESTORE_GCODE_STATE NAME=STATE_PRINT_END