-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacros.cfg
470 lines (438 loc) · 13 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
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
#//// \\\\ //// \\\\ //// \\\\ //// \\\\ //// \\\\ //// \\\\ //// \\\\
#\\\\ //// \\\\ //// \\\\ //// \\\\ //// \\\\ //// \\\\ //// \\\\ ////
#
# MACROS
#
#//// \\\\ //// \\\\ //// \\\\ //// \\\\ //// \\\\ //// \\\\ //// \\\\
#\\\\ //// \\\\ //// \\\\ //// \\\\ //// \\\\ //// \\\\ //// \\\\ ////
#=====================================================
# START PRINT
#=====================================================
[gcode_macro START_PRINT]
gcode:
{% set T_BED = params.T_BED|default(50) %}
{% set T_EXTRUDER = params.T_EXTRUDER|default(205) %}
G92
# Start bed heating and continue
M140 S{T_BED}
{% if printer.heater_bed.temperature > params.T_BED|float*0.85 %}
M140 S{T_BED}
M109 S{T_EXTRUDER}
M190 S{T_BED}
{% else %}
M190 S{params.T_BED|float*0.85} # wait till 0.85 of bed temp is reached, then continue
M140 S{T_BED}
M109 S{T_EXTRUDER}
M190 S{T_BED}
{% endif %}
G28
PRIME_LINE
#=====================================================
# END PRINT
#=====================================================
[gcode_macro END_PRINT]
gcode:
G1 X10 Y10 Z96 F3000
G1 E-10 F5000
M104 S0
M140 S0
M204
M106 S0
G28 Z
M84
#=====================================================
# PRIME LINE - credits to Icesythe7
#=====================================================
[gcode_macro PRIME_LINE]
gcode:
G90
G1 X0 Y0 F4000; Go to front
G1 Z0.15 F1500 ; Drop to bed
G92 E0 ; zero the extruded length
G1 X40 Y2 E25 F500 ; Extrude 25mm of filament in a 4cm line
G92 E0 ; zero the extruded length
G1 E-1 F500 ; Retract a little
G1 X10 F5000 ; Quickly wipe away from the filament line
G1 Z0.3 F1500 ; Raise and begin printing.
#=====================================================
# PARK PRINTER
#=====================================================
[gcode_macro M125]
gcode:
SAVE_GCODE_STATE NAME=parking
M117 Parking toolhead
G91
G1 Z10 F600
G90
G1 X10 Y60 F4000
RESTORE_GCODE_STATE NAME=parking
#=====================================================
# LOW TEMP CHECK
#=====================================================
[gcode_macro LOW_TEMP_CHECK]
gcode:
{% set T_EXTRUDER = params.T_EXTRUDER|default(205) %}
{% if printer.extruder.target != 0 %}
{% if printer.extruder.temperature < printer.extruder.target %}
M118 Heating from {printer.extruder.temperature} to {printer.extruder.target}.
M109 S{printer.extruder.target|float}
{% endif %}
{% else %}
{% if printer.extruder.target < T_EXTRUDER %}
M118 No setpoint, heating to {T_EXTRUDER}.
M109 S{T_EXTRUDER}
{% endif %}
{% endif %}
#======================================================
# LOAD FILAMENT
#======================================================
[gcode_macro M701]
#[gcode_macro Load_Filament]
gcode:
SAVE_GCODE_STATE NAME=loading_filament
M117 Loading Filament
M83
G92 E0.0
LOW_TEMP_CHECK
G1 E120 F3000
G1 E50 F200
G92 E0.0
RESTORE_GCODE_STATE NAME=loading_filament
#======================================================
# UNLOAD FILAMENT
#======================================================
[gcode_macro M702]
#[gcode_macro Unload_Filament]
gcode:
SAVE_GCODE_STATE NAME=unloading_filament
M125
M117 Unloading Filament
LOW_TEMP_CHECK
G91
G1 E10 F100
G92 E0.0
G1 E-150 F3000
G92 E0.0
RESTORE_GCODE_STATE NAME=unloading_filament
#======================================================
# FILAMENT CHANGE
#======================================================
[gcode_macro M600]
gcode:
SAVE_GCODE_STATE NAME=M600_state
PAUSE
G91
G1 E-.8 F2700
G1 Z{10}
G90
G1 X10 Y60 F3000
G91
G1 E-1 F1000
RESTORE_GCODE_STATE NAME=M600_state
#======================================================
# COUNTDOWN MACRO
#======================================================
[gcode_macro COUNTDOWN]
gcode:
{% set MSG = params.MSG|default("Time: ") %}
{% set TIME = params.TIME|default(10) %}
{% for s in range(TIME|int, 0, -1) %}
G4 P1000
M117 {params.MSG} {s}s
M118 {params.MSG} {s}s
{% endfor %}
[pause_resume]
#======================================================
# HOMING MACROS
#======================================================
[gcode_macro _HOME_X]
gcode:
# Always use consistent run_current on A/B steppers during sensorless homing
{% set RUN_CURRENT_X = printer.configfile.settings['tmc2209 stepper_x'].run_current|float %}
{% set RUN_CURRENT_Y = printer.configfile.settings['tmc2209 stepper_y'].run_current|float %}
{% set HOME_CURRENT = 0.8 %}
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={HOME_CURRENT}
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={HOME_CURRENT}
# Wait just a second… (give StallGuard registers time to clear)
G4 P1000
# Home
G28 X
# Wait just a second… (give StallGuard registers time to clear)
G4 P1000
# Move away
G91
G1 X-55 F1200
# Set current during print
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CURRENT_X}
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CURRENT_Y}
[gcode_macro _HOME_Y]
gcode:
# Set current for sensorless homing
{% set RUN_CURRENT_X = printer.configfile.settings['tmc2209 stepper_x'].run_current|float %}
{% set RUN_CURRENT_Y = printer.configfile.settings['tmc2209 stepper_y'].run_current|float %}
{% set HOME_CURRENT = 0.8 %}
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={HOME_CURRENT}
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={HOME_CURRENT}
# Wait just a second… (give StallGuard registers time to clear)
G4 P1000
# Home
G28 Y
# Wait just a second… (give StallGuard registers time to clear)
G4 P1000
# Move away
G91
G1 Y-55 F1200
# Set current during print
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CURRENT_X}
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CURRENT_Y}
[gcode_macro _HOME_Z]
gcode:
# Always use consistent run_current on A/B steppers during sensorless homing
{% set RUN_CURRENT_Z = printer.configfile.settings['tmc2209 stepper_z'].run_current|float %}
{% set HOME_CURRENT = 0.8 %}
SET_TMC_CURRENT STEPPER=stepper_z CURRENT={HOME_CURRENT}
# Wait just a second… (give StallGuard registers time to clear)
G4 P1000
# Home
G28 Z
# Wait just a second… (give StallGuard registers time to clear)
G4 P1000
# Move away
G91
G1 Z-10 F1200
G4 P1000
# Home
G28 Z
# Wait just a second… (give StallGuard registers time to clear)
G4 P1000
# Move away
G91
G1 Z-10 F1200
# Set current during print
SET_TMC_CURRENT STEPPER=stepper_z CURRENT={RUN_CURRENT_Z}
#=====================================================
# PAUSE
#=====================================================
[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
gcode:
##### set defaults #####
{% set x = params.X|default(5) %} #edit to your park position
{% set y = params.Y|default(60) %} #edit to your park position
{% set z = params.Z|default(10)|float %} #edit to your park position
{% set e = params.E|default(1) %} #edit to your retract length
##### calculate save lift position #####
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_z = printer.toolhead.position.z|float %}
{% set lift_z = z|abs %}
{% if act_z < (max_z - lift_z) %}
{% set z_safe = lift_z %}
{% else %}
{% set z_safe = max_z - act_z %}
{% endif %}
##### end of definitions #####
PAUSE_BASE
G91
{% if printer.extruder.can_extrude|lower == 'true' %}
G1 E-{e} F2100
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
{% if "xyz" in printer.toolhead.homed_axes %}
G1 Z{z_safe}
G90
G1 X{x} Y{y} F6000
{% else %}
{action_respond_info("Printer not homed")}
{% endif %}
#=====================================================
# RESUME
#=====================================================
[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
gcode:
##### set defaults #####
{% set e = params.E|default(1) %} #edit to your retract length
#### get VELOCITY parameter if specified ####
{% if 'VELOCITY' in params|upper %}
{% set get_params = ('VELOCITY=' + params.VELOCITY) %}
{%else %}
{% set get_params = "" %}
{% endif %}
##### end of definitions #####
G91
{% if printer.extruder.can_extrude|lower == 'true' %}
G1 E{e} F2100
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
RESUME_BASE {get_params}
#=====================================================
# CANCEL
#=====================================================
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
TURN_OFF_HEATERS
CLEAR_PAUSE
SDCARD_RESET_FILE
BASE_CANCEL_PRINT
#=====================================================
# Manual Bed Level
#=====================================================
[gcode_macro LEVEL_BED]
description: run manual bed leveling
gcode:
{% if "xyz" not in printer.toolhead.homed_axes %}
G28
{% endif %}
BED_SCREWS_ADJUST
#=====================================================
# Filament IN ## Adjust "E400" according to your bowden-length
#=====================================================
[gcode_macro FILAMENT_IN]
description: Filament In
gcode:
G91
G1 E400 F2000
G1 E25 F300
G1 E-5 F400
G90
#=====================================================
# Filament OUT
#=====================================================
[gcode_macro FILAMENT_OUT]
description: Filament Out
gcode:
G91
G1 E10 F600
G1 E-450 F2000
G90
#=====================================================
# PID Tuning
#=====================================================
[gcode_macro PID_EXTRUDER]
description: Calibrate PID Hotend
gcode: {% set TARGET_TEMP = params.TARGET_TEMP|default(210)|float %}
PID_CALIBRATE HEATER=extruder TARGET={TARGET_TEMP}
TURN_OFF_HEATERS
SAVE_CONFIG
description: Calibrate PID Heatbed
[gcode_macro PID_BED]
gcode: {% set TARGET_TEMP = params.TARGET_TEMP|default(60)|float %}
PID_CALIBRATE HEATER=heater_bed TARGET={TARGET_TEMP}
TURN_OFF_HEATERS
SAVE_CONFIG
#=====================================================
# Input Shaper ## Only works if you have an accelerometer plugged in and input-shaping installed, for more information, see https://www.klipper3d.org/Measuring_Resonances.html
#=====================================================
[gcode_macro SHAPE]
description:Input Shaper
gcode:
{% if "xyz" not in printer.toolhead.homed_axes %}
G28
{% endif %}
SHAPER_CALIBRATE
#=====================================================
# Torture ## These are here to help you find the limits. (USE AT YOUR OWN RISK!) credits to Icesythe7 for simplifying these
#=====================================================
[gcode_macro TORTURE]
description: Test all axis movements at max speeds set in mainsail
gcode:
{% if "xyz" not in printer.toolhead.homed_axes %}
G28
{% endif %}
G90
G1 X5 Y5 F10000
G1 Z10 F5000
G91
{% set repeat_count = 8 %}
{% for repeat in range(repeat_count) %}
G1 X+100 F500000
G1 Y+100 F500000
G1 X-100 F500000
G1 Y-100 F500000
G1 Z+80 F450000
G1 Z-80 F450000
G1 Z+80 F450000
G1 Z-80 F450000
{% endfor %}
G28 Z
G90
[gcode_macro TORTURE_Z]
description: Test z axis movements
gcode:
{% if "xyz" not in printer.toolhead.homed_axes %}
G28
{% endif %}
G90
G1 Z10 F5000
G91
{% set repeat_count = 8 %}
{% set ns = namespace(z_coord=80) %}
{% for repeat in range(repeat_count) %}
G1 Z{ns.z_coord} F450000
{% set ns.z_coord = ns.z_coord * -1 %}
{% endfor %}
G28 Z
G90
[gcode_macro TORTURE_XY]
description: Test x and y axis movements
gcode:
{% if "xyz" not in printer.toolhead.homed_axes %}
G28
{% endif %}
G90
G1 X5 Y5 F10000
G1 Z10 F5000
G91
{% set repeat_count = 8 %}
{% for repeat in range(repeat_count) %}
G1 X+100 F500000
G1 Y+100 F500000
G1 X-100 F500000
G1 Y-100 F500000
{% endfor %}
G28 Z
G90
[gcode_macro TORTURE_SHAKE]
description: Shake it baby
gcode:
{% if "xyz" not in printer.toolhead.homed_axes %}
G28
{% endif %}
G90
G1 X45 Y45 F10000
G1 Z50 F5000
G91
{% set repeat_count = 8 %}
{% for repeat in range(repeat_count) %}
G1 X+15 F800000
G1 X-15 F800000
{% endfor %}
{% set repeat_count = 8 %}
{% for repeat in range(repeat_count) %}
G1 Y+15 F800000
G1 Y-15 F800000
{% endfor %}
G28 Z
G90
[gcode_macro WAKA_WAKA]
description: Make it walk.
gcode:
{% if "xyz" not in printer.toolhead.homed_axes %}
G28
{% endif %}
G90
G1 X45 Y45 F10000
G1 Z50 F5000
G91
{% set repeat_count = 1000 %}
{% for repeat in range(repeat_count) %}
G1 Y+30 F800000
G1 Y-30 F800000
{% endfor %}
G28 Z
G90