-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacros.cfg
235 lines (195 loc) · 7.25 KB
/
macros.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
[gcode_macro G32]
gcode:
SAVE_GCODE_STATE NAME=STATE_G32 ; saves previous gcode state
G90 ; absolute positioning
G28 ; home all axises
QUAD_GANTRY_LEVEL ; deracks gantry
G28 Z ; rehomes Z axis
RESTORE_GCODE_STATE NAME=STATE_G32 ; restores previous gcode state
[gcode_macro CENTER]
gcode:
SAVE_GCODE_STATE NAME=STATE_CENTER ;
G90 ; absolute positioning
G0 X175 Y175 Z150 F10000 ; Centers the print head in the build volume
RESTORE_GCODE_STATE NAME=STATE_CENTER
[gcode_macro PRINT_START]
gcode:
# Variables
{% set BED_TEMP = params.BED_TEMP|int %}
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|int %}
{% set CHAMBER_TEMP = params.CHAMBER_TEMP|int %}
# Start sequence
M117 Heating bed
M190 S{BED_TEMP} ; wait for bed to reach temperature
M117 Preheating nozzle
M104 S150 ; wait for nozzle to heat to soften without oozing
# Homing/deracking
M107 ; Print fan off
G28 ; Home all axes
QUAD_GANTRY_LEVEL
# Heat/clean nozzle
M117 Heating nozzle
G0 Z30 F2000 ; raise Z while nozzle heating
M109 S{EXTRUDER_TEMP} ; set and wait for nozzle to reach printing temperature
CLEAN_NOZZLE ; Cleans nozzle on brass brush
G28 Z ; Rehome Z after QGL & cleaning nozzle
BED_MESH_PROFILE LOAD=default ; load default bed mesh
PRIME_NOZZLE
[gcode_macro PRINT_END]
gcode:
M400 ; wait for buffer to clear
G92 E0 ; zero the extruder
G1 E-5.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 - 2) %}
{% set z_safe = 2.0 %}
{% else %}
{% set z_safe = max_z - printer.toolhead.position.z %}
{% endif %}
{% set z_park_abs = printer.toolhead.position.z + 25.0 %}
{% if z_park_abs > max_z %}
{% set z_park_abs = max_z %}
{% endif %}
G0 Z{z_safe} F3600 ; move nozzle up
G0 X{x_safe} Y{y_safe} F20000 ; move nozzle to remove stringing
G1 E-20.0 F3600 ; retract filament another 20mm (completely out of hot zone)
TURN_OFF_HEATERS
M107 ; turn off fan
G90 ; absolute positioning
G0 Z{z_park_abs} F3600 ; move nozzle up away from the print
G0 X{max_x / 2} Y{max_y} F15000 ; park nozzle at rear
BED_MESH_CLEAR
M117 Done
[gcode_macro CALIBRATE_Z_ENDSTOP]
gcode:
SAVE_GCODE_STATE NAME=CALIBRATE_Z_ENDSTOP
# Calibration
BED_MESH_CLEAR
G32
CLEAN_NOZZLE
G0 X175 Y175 Z5 F10000
PROBE_ACCURACY
G0 X175 Y175 Z5 F10000
Z_ENDSTOP_CALIBRATE
SAVE_CONFIG
RESTORE_GCODE_STATE NAME=CALIBRATE_Z_ENDSTOP
[gcode_macro PRIME_NOZZLE]
gcode:
# Setup
SAVE_GCODE_STATE NAME=PRIME_NOZZLE_STATE
M117 Priming
G90 ; Absolute coordinates.
M83 ; Relative extruder mode.
G92 E0
# Move to start of line.
G0 Z10 F5000
G0 Y3 X3 F18000
G0 Z0.2 F900
# Print the line.
G91 ; Relative coordinates.
G1 X100 E25 F1000 ; Extrude filament 25mm (how much it retracted in PRINT_END).
G0 Y-2 F1000
G1 X-60 E9 F1000 ; Print second part of the line.
G1 E-0.5 F3000 ; Retract to avoid stringing.
G1 X0.5 E0 F1000 ; Wipe back to break string.
G1 X-5.5 E0 F1000 ; Wipe forward to break string.
RESTORE_GCODE_STATE NAME=PRIME_NOZZLE_STATE
[gcode_macro CLEAN_NOZZLE]
gcode:
# Setup
SAVE_GCODE_STATE NAME=CLEAN_NOZZLE_STATE
M117 Cleaning nozzle
G90 ; Relative coordinates
# Position nozzle at brush
G0 Z10 F2000 ; Move gantry to safe height
G0 X267 Y348 F20000 ; Move gantry to edge of brush
G0 Z-2 F2000 ; Lower nozzle into brush
# Brush nozzle
G0 X300 F5000 ; 1
G0 X267
G0 X300 ; 2
G0 X267
;G0 X300 ; 3
;G0 X267
;G0 X300 ; 4
;G0 X267
;G0 X300 ; 5
;G0 X267
# Exit
G0 Z10 F2000 ; Raise gantry to safe height
RESTORE_GCODE_STATE NAME=CLEAN_NOZZLE_STATE
[gcode_macro LOAD_FILAMENT]
gcode:
# Setup
{% set INITIAL_TEMP = printer.extruder.target %}
{% set TEMP = params.TEMP|default(235)|int %}
SAVE_GCODE_STATE NAME=LOAD_FILAMENT
M117 Heating nozzle...
M109 S{params.TEMP} ; Heats nozzle
M117 Unloading filament...
M83 ; Set relative extruder distances
G0 E50 F300 ; Unloads 50mm of filament
M104 S{INITIAL_TEMP}
M117 Filament unloaded
# Beeper tune
; M300 S440 P200
; M300 S880 P300
; M300 S660 P250
RESTORE_GCODE_STATE NAME=LOAD_FILAMENT
[gcode_macro UNLOAD_FILAMENT]
gcode:
# Setup
{% set INITIAL_TEMP = printer.extruder.target %}
{% set TEMP = params.TEMP|default(235)|int %}
SAVE_GCODE_STATE NAME=LOAD_FILAMENT
M117 Heating nozzle...
M109 S{params.TEMP} ; Heats nozzle
M117 Unloading filament...
M83 ; Set relative extruder distances
G0 E-50 F300 ; Unloads 50mm of filament
M104 S{INITIAL_TEMP}
M117 Filament loaded
# Beeper tune
; M300 S440 P200
; M300 S880 P300
; M300 S660 P250
RESTORE_GCODE_STATE NAME=UNLOAD_FILAMENT
######################################################################
# Filament Change
######################################################################
# M600: Filament Change. This macro will pause the printer, move the
# tool to the change position, and retract the filament 50mm. Adjust
# the retraction settings for your own extruder. After filament has
# been changed, the print can be resumed from its previous position
# with the "RESUME" gcode.
[pause_resume]
[gcode_macro M600]
gcode:
{% set X = params.X|default(50)|float %}
{% set Y = params.Y|default(0)|float %}
{% set Z = params.Z|default(10)|float %}
SAVE_GCODE_STATE NAME=M600_state
PAUSE
G91
G1 E-.8 F2700
G1 Z{Z}
G90
G1 X{X} Y{Y} F3000
G91
G1 E-50 F1000
RESTORE_GCODE_STATE NAME=M600_state