92 lines
2.5 KiB
INI
92 lines
2.5 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:
|
|
CLEAR_PAUSE
|
|
|
|
# Perform a G28 'home' (if needed), wait for the bed to finish heating and do a QGL
|
|
SMARTHOME
|
|
SMARTQGL
|
|
|
|
# Start preheating the bed
|
|
M117 Heating bed/toolhead
|
|
_LCD_KNOB COLOR=RED BLINK=1
|
|
M140 S{T_BED}
|
|
M104 S{params.T_EXTRUDER|float*0.75}
|
|
G0 Z30 F1800
|
|
G0 X175 Y175 Z10 F6000
|
|
|
|
# Perform a G28 'home' (if needed), wait for the bed to finish heating and do a QGL
|
|
M190 S{T_BED}
|
|
;LOAD_MESH_TEMP BED_TEMPERATURE{T_BED}
|
|
BED_MESH_PROFILE LOAD=default
|
|
|
|
# Hover over purge bucket, wait for the hotend to finish, then purge/wipe and rehome Z
|
|
G0 X46 Y350 Z10 F18000
|
|
M109 S{T_EXTRUDER}
|
|
clean_nozzle
|
|
G28 Z
|
|
|
|
# Move the nozzle near the bed
|
|
G0 X4.1 Y0.1 Z2.0 F6000
|
|
G1 Z0.3 F6000
|
|
|
|
# Prime line
|
|
PRIME_EXTRUDER
|
|
M117
|
|
|
|
|
|
[gcode_macro END_PRINT]
|
|
variable_print_done: 'false'
|
|
gcode:
|
|
SAVE_GCODE_STATE NAME=STATE_PRINT_END
|
|
|
|
##### Get Boundaries #####
|
|
{% set max_x = printer.toolhead.axis_maximum.x|float %}
|
|
{% set max_y = printer.toolhead.axis_maximum.y|float %}
|
|
{% set max_z = printer.toolhead.axis_maximum.z|float %}
|
|
{% set act_x = printer.toolhead.position.x|float %}
|
|
{% set act_y = printer.toolhead.position.y|float %}
|
|
{% set act_z = printer.toolhead.position.z|float %}
|
|
|
|
##### Calculate save move #####
|
|
{% if act_x < (max_x - 20.0) %}
|
|
{% set x_safe = 20.0 %}
|
|
{% else %}
|
|
{% set x_safe = -20.0 %}
|
|
{% endif %}
|
|
{% if act_y < (max_y - 20.0) %}
|
|
{% set y_safe = 20.0 %}
|
|
{% else %}
|
|
{% set y_safe = -20.0 %}
|
|
{% endif %}
|
|
{% if act_z < (max_z - 2.0) %}
|
|
{% set z_safe = 2.0 %}
|
|
{% else %}
|
|
{% set z_safe = max_z - act_z %}
|
|
{% endif %}
|
|
|
|
M400
|
|
G92 E0
|
|
G1 E-2 F1800
|
|
G91
|
|
G0 X{x_safe} Y{y_safe} Z{z_safe} F20000 ; move nozzle to remove stringing
|
|
TURN_OFF_HEATERS
|
|
M107
|
|
G90
|
|
G0 X46 Y350 F18000 ; Park over purge bucket
|
|
BED_MESH_CLEAR
|
|
M300 ; Play a tone
|
|
_LCD_KNOB 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
|
|
|