-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathprint_end.cfg
78 lines (66 loc) · 2.59 KB
/
print_end.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
[gcode_macro PRINT_END]
#
# PRINT_END
#
# Use PRINT_END for the slicer ending script - please customise for your slicer of choice
#
description: End print and tidy up (retract filament, move toolhead, turn off heaters)
gcode:
{% set STAY_HOT = params.STAY_HOT|default(0)|int %} # STAY_HOT=1 to keep heaters primed for more printing
STATUS_BUSY
M400 ; wait for buffer to clear
G92 E0 ; zero the extruder
G1 E-10.0 F3600 ; retract filament
G91 ; relative positioning
# Get Boundaries
{% set max_x = printer.configfile.config["stepper_x"]["position_max"]|float %}
{% set max_y = printer.configfile.config["stepper_y"]["position_max"]|float %}
{% set max_z = printer.configfile.config["stepper_z"]["position_max"]|float %}
# Check end position to determine safe direction to move
{% if printer.toolhead.position.x < (max_x - 20) %}
{% set x_safe = 20.0 %}
{% else %}
{% set x_safe = -20.0 %}
{% endif %}
{% if printer.toolhead.position.y < (max_y - 20) %}
{% set y_safe = 20.0 %}
{% else %}
{% set y_safe = -20.0 %}
{% endif %}
{% if printer.toolhead.position.z < (max_z - 40) %}
{% set z_safe = 40.0 %}
{% else %}
{% set z_safe = max_z - printer.toolhead.position.z %}
{% endif %}
G0 Z{z_safe} F3600 ; move nozzle up
G0 X{x_safe} Y{y_safe} F20000 ; move nozzle to remove stringing
M107 ; turn off fan
G90 ; absolute positioning
G0 X{max_x / 2} Y{max_y - 20} F3600 ; park nozzle near rear
M117 Print Complete.
{% if STAY_HOT != 1 %}
M118 Disabling heaters
TURN_OFF_HEATERS
M84 ; disable steppers
{% else %}
M118 Keeping printer hot for more printing...
SET_HEATER_TEMPERATURE HEATER=extruder TARGET=150 ; set nozzle temp for standy-by for probing
{% endif %}
{% if printer.configfile.config["bed_mesh"] %}
BED_MESH_CLEAR
{% endif %}
{% if printer['fan_generic exhaust_fan'] %}
STOP_TEMP_MONITOR
SET_FAN_SPEED FAN=exhaust_fan SPEED=1.0
FAN_DELAY FAN=exhaust_fan DELAY=300
{% else %}
M118 No exhaust fan configured
{% endif %}
{% if printer['fan_generic cooling_fan'] %}
SET_FAN_SPEED FAN=cooling_fan SPEED=1.0
FAN_DELAY2 FAN=cooling_fan DELAY=300
{% else %}
M118 No cooling fan configured
{% endif %}
STATUS_READY
UPDATE_DELAYED_GCODE ID=_CLEAR_DISPLAY DURATION=60