-
Notifications
You must be signed in to change notification settings - Fork 4
/
macros.cfg
442 lines (381 loc) · 12.4 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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
#####################################################################
# Macros
#####################################################################
# Conditional G28
[gcode_macro CG28]
gcode:
G91
{% if printer.toolhead.homed_axes != "xyz" %}
LOWERCURRENT
G90
G28
RESETCURRENT
{% endif %}
[gcode_macro G32]
gcode:
G90
G28
QUAD_GANTRY_LEVEL
G28
BED_MESH_PROFILE LOAD=default
clean_nozzle
CALIBRATE_Z
#################################
######### HOUR COUNTER ##########
#################################
# [gcode_macro COUNTER_OFF]
# gcode:
# Set_pin pin=hourCounter value=0
# [gcode_macro COUNTER_ON]
# gcode:
# Set_pin pin=hourCounter value=1
##############################
######### NEVERMORE ##########
##############################
# [gcode_macro Nevermore_on]
# gcode:
# Set_pin pin=nevermore value=1
# [gcode_macro Nevermore_off]
# gcode:
# Set_pin pin=nevermore value=0
[gcode_macro PRINT_START]
gcode:
green
M117 Homing...
G28
M117 Heating Bed...
# Nevermore_on
red
M106 S255 ; set part fan to 100% to warm chamber
M140 S{ params.BED} ; set bed final temp
M190 S{ params.BED} ; wait for bed final temp
{% if params.BED|int > 70 %} ; Heat soak for ABS
{% if "z" not in printer.toolhead.homed_axes %}
# G28 ;Only G28 Home if needed
{% endif %}
G0 X150 Y150 Z30 ; move toolhead to centre
M117 Heat Soak: 42~degrees~
orange
TEMPERATURE_WAIT SENSOR="temperature_sensor chamber" MINIMUM=42
M117 Soak Complete!
{% else %}
M117 Heat Soak not required
#SET_HEATER_TEMPERATURE HEATER=extruder TARGET={EXTRUDER}
{% endif %}
M106 S0 ; turn off part fan
green
yellow
M117 Heating Extruder...
M109 S{params.EXTRUDER} ; wait for extruder final temp
led_on
M117 Parking...
Park_Toolhead
M117 Cleaning...
CLEAN_NOZZLE
Attach_Probe_Lock
M117 Quad Gantry Level
#TODO: add If Leveled function soon
QUAD_GANTRY_LEVEL
Dock_probe_unlock
M117 Cleaning...
CLEAN_NOZZLE
Attach_probe_lock
Green
M117 Calibrating Z...
CALIBRATE_Z
RESET_EXTRUDER
Dock_Probe_Unlock
CLEAN_NOZZLE
#COUNTER_ON
blue
ERCF_HOME
SONG_SHORT_BEEP
M117 Printing...
[gcode_macro RESET_EXTRUDER]
gcode:
G92 E0 ; reset extruder
[gcode_macro PRINT_END]
gcode:
SONG_SMB_FLAGPOLE
#COUNTER_OFF
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
M84
# Nevermore_off
M117
[gcode_macro LED_ON]
gcode:
white
[gcode_macro PURGE_LINE]
# A purge line on the left of the bed to prime the extruder
gcode:
G92 E0 ; zero/reset extruder
G1 X2.2 Y20 Z0.3 F18000 ; move to start position
G1 E+15 F150 ; extrude to put the pressure (-20 from purge macro)
G92 E0
G1 X2.2 Y200 Z0.25 F1500 E10 ; extrude the first line
G1 X2.5 Y200 Z0.3 F18000 ; move to side a little
G1 X2.5 Y20 Z0.25 F1500.0 E20 ; extrude the second line
G92 E0 ; zero/reset extruder
G1 Z2.0 E-0.1 F3000 ; move nozzle up and retract tiny bit
G92 E0
[display_status]
[pause_resume]
recover_velocity: 300.0
[gcode_macro LOWERCURRENT]
gcode:
SET_TMC_CURRENT STEPPER=stepper_z CURRENT=0.35 HOLDCURRENT=0.35 ; lower z stepper current (in case of crash)
SET_TMC_CURRENT STEPPER=stepper_z1 CURRENT=0.35 HOLDCURRENT=0.35
SET_TMC_CURRENT STEPPER=stepper_z2 CURRENT=0.35 HOLDCURRENT=0.35
SET_TMC_CURRENT STEPPER=stepper_z3 CURRENT=0.35 HOLDCURRENT=0.35
[gcode_macro RESETCURRENT]
gcode:
SET_TMC_CURRENT STEPPER=stepper_z CURRENT={printer.configfile.settings["tmc2209 stepper_z"].run_current} HOLDCURRENT={printer.configfile.settings["tmc2209 stepper_z"].hold_current}
SET_TMC_CURRENT STEPPER=stepper_z1 CURRENT={printer.configfile.settings["tmc2209 stepper_z1"].run_current} HOLDCURRENT={printer.configfile.settings["tmc2209 stepper_z1"].hold_current}
SET_TMC_CURRENT STEPPER=stepper_z2 CURRENT={printer.configfile.settings["tmc2209 stepper_z2"].run_current} HOLDCURRENT={printer.configfile.settings["tmc2209 stepper_z2"].hold_current}
SET_TMC_CURRENT STEPPER=stepper_z3 CURRENT={printer.configfile.settings["tmc2209 stepper_z3"].run_current} HOLDCURRENT={printer.configfile.settings["tmc2209 stepper_z3"].hold_current}
[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
default_parameter_X: 230 #edit to your park position
default_parameter_Y: 230 #edit to your park position
default_parameter_Z: 10 #edit to your park position
default_parameter_E: 1 #edit to your retract length
gcode:
SAVE_GCODE_STATE NAME=PAUSE_state
BASE_PAUSE
G91
{% if printer.extruder.temperature > 180 %}
G1 E-{E} F2100
{% endif %}
G1 Z{Z}
G90
G1 X{X} Y{Y} F6000
[gcode_macro RESUME]
rename_existing: BASE_RESUME
default_parameter_E: 1 #edit to your retract length
gcode:
G91
G1 E{E} F2100
G90
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
BASE_RESUME
# Park bed for heatsoaking
[gcode_macro PARK]
default_parameter_FORCE: 0
gcode:
{% if printer.idle_timeout.state != "Printing" or FORCE|int == 1 %}
CG28 ; Home if not already homed
SAVE_GCODE_STATE NAME=PARK
G90 ; absolute positioning
G0 X150 Y150 Z30 F5000 ; Move to position
RESTORE_GCODE_STATE NAME=PARK
{% else %}
{ action_respond_info("PARK disabled while printing!") }
{% endif %}
# Park front for maintenance / cleaning
[gcode_macro PARKFRONT]
gcode:
{% if printer.idle_timeout.state != "Printing" %}
CG28 ; Home if not already homed
SAVE_GCODE_STATE NAME=PARKFRONT
G90 ; absolute coords
G1 Z100 X130 Y10 F5000 ; Move to position
RESTORE_GCODE_STATE NAME=PARKFRONT
{% else %}
{ action_respond_info("PARKFRONT disabled while printing!") }
{% endif %}
# Park Toolhead Routine
[gcode_macro Park_Toolhead]
gcode:
G1 X150 Y150 F18000
[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
# 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 #####
# default is your max posion from your printer.cfg
{% 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 #####
SAVE_GCODE_STATE NAME=PAUSE_state
BASE_PAUSE
G91
G1 E-{E} F2100
G1 Z{z_safe} F900
G90
G1 X{x_park} Y{y_park} F6000
[gcode_macro CENTER_ALL]
gcode:
G90
G1 X150 Y0 Z100 F30000
[gcode_macro UNLOAD_FILAMENT_ABS]
gcode:
SAVE_GCODE_STATE NAME=UNLOADFILAMENT
M109 S225 ; wait for extruder to cool down to prevent blob
M83 ; set extruder to relative
#G1 E2 F300 ; (CAUSING CLOGS AT 10mm?) extrude a little to soften tip
G1 E-50 F300 ; retract filament completely
G1 E-50 F1000 ; retract filament completely
RESTORE_GCODE_STATE NAME=UNLOADFILAMENT
[gcode_macro LOAD_FILAMENT]
gcode:
SAVE_GCODE_STATE NAME=LOADFILAMENT
M83 ; set extruder to relative
G1 E45 F300 ; quickly load filament to down filament path
G1 E40 F300 ; slower extrusion for hotend path / prime
RESTORE_GCODE_STATE NAME=LOADFILAMENT
[gcode_macro PREHEAT_ABS]
gcode:
SET_HEATER_TEMPERATURE HEATER=extruder TARGET=240
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET=110
[gcode_macro Z_END_CALIBRATE]
gcode:
PREHEAT_ABS
G28
clean_nozzle
G28
QUAD_GANTRY_LEVEL
G28
BED_MESH_CLEAR
G1 X150 Y150 Z4 F7800
Z_ENDSTOP_CALIBRATE
######################################################################
# 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.
[gcode_macro M600]
variable_paused: True
default_parameter_X: 125
default_parameter_Y: 125
default_parameter_Z: 10
gcode:
SAVE_GCODE_STATE NAME=M600_state
BASE_PAUSE
G91
G1 E-.8 F2700
G1 Z{Z}
SET_GCODE_VARIABLE MACRO=RESUME_M600 VARIABLE=x VALUE={printer.gcode_move.gcode_position.x}
SET_GCODE_VARIABLE MACRO=RESUME_M600 VARIABLE=y VALUE={printer.gcode_move.gcode_position.y}
SET_GCODE_VARIABLE MACRO=RESUME_M600 VARIABLE=z VALUE={printer.gcode_move.gcode_position.z}
G90
G1 X{X} Y{Y} F3000
G91
G1 E-67 F1000
SET_GCODE_VARIABLE MACRO=M600 VARIABLE=paused VALUE=True
RESTORE_GCODE_STATE NAME=M600_state
[gcode_macro RESUME_M600]
variable_x: 125
variable_y: 125
variable_z: 125
gcode:
SET_GCODE_VARIABLE MACRO=M600 VARIABLE=paused VALUE=False
SAVE_GCODE_STATE NAME=RESUME_M600_state
G90
G1 X75 Y253 F6000
G91
G1 E67 F1000
PURGE_N_BRUSH EXTRUDER={printer.extruder.target} PURGE=100
G90
G1 Z{z}
G1 X{x} Y{y} F6000
RESTORE_GCODE_STATE NAME=RESUME_M600_state
BASE_RESUME
# [gcode_macro RESUME]
# rename_existing: BASE_RESUME
# gcode:
# ##### read E from pause macro #####
# {% set E = printer["gcode_macro PAUSE"].extrude|float %}
# ##### end of definitions #####
# G91
# G1 E{E} F2100
# RESTORE_GCODE_STATE NAME=PAUSE_state
# BASE_RESUME
[gcode_macro RESUME]
rename_existing: BASE_RESUME
gcode:
RESTORE_GCODE_STATE NAME=PAUSE_state
G90
{% if printer["gcode_macro ERCF_VAR"].clog_detection|int == 1 %}
SET_FILAMENT_SENSOR SENSOR=encoder_sensor ENABLE=1
{% endif %}
BASE_RESUME
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
TURN_OFF_HEATERS
CLEAR_PAUSE
SDCARD_RESET_FILE
{% set x_park = printer.toolhead.axis_minimum.x|float + 5.0 %}
{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_z = printer.toolhead.position.z|float %}
{% if act_z < (max_z - 20.0) %}
{% set z_safe = 20.0 %}
{% else %}
{% set z_safe = max_z - act_z %}
{% endif %}
SET_FILAMENT_SENSOR SENSOR=encoder_sensor ENABLE=0
G91
G1 Z{z_safe} F900
G90
G0 X{x_park} Y{y_park} F6000
BASE_CANCEL_PRINT
[gcode_macro ZUP]
gcode:
SET_GCODE_OFFSET Z_ADJUST=0.01 MOVE=1
[gcode_macro ZDOWN]
gcode:
SET_GCODE_OFFSET Z_ADJUST=-0.01 MOVE=1
# For example SPEEDTEST I=10
# Compare the GET_POSITION output before and after, see if you skipped steps. IIRC you want the "mcu" line to show within 16 before and after (a full step)
[gcode_macro SPEEDTEST]
gcode:
#Parameters
{% set i = params.I|default(1)|int %}
SAVE_GCODE_STATE NAME=SPEEDTEST
G28 X Y
GET_POSITION
G90 ; absolute positioning
{% for iteration in range(i|int) %}
G1 X0 Y0 F27000
G1 X290 Y290 F27000
G1 X0 Y0 F27000
G1 X290 Y290 F27000
G1 X0 Y290 F36000
G1 X290 Y0 F27000
G1 X0 Y290 F27000
G1 X290 Y0 F27000
G1 X0 Y290 F27000
G1 X0 Y0 F36000
G1 X290 Y0 F36000
G1 X290 Y290 F36000
G1 X0 Y290 F36000
G1 X0 Y0 F36000
{% endfor %}
G28 X Y
GET_POSITION
RESTORE_GCODE_STATE NAME=SPEEDTEST