/
macros.cfg
372 lines (302 loc) · 11.3 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
[include beep.cfg]
# SUPER SLICER
# Printer Settings > <PRINTER_NAME_FROM_DROPDOWN> > Custom G-code >
#
# Super Slicer Start G-code
# START_PRINT_REDUX FIRST_LAYER_BED_TEMPERATURE={first_layer_bed_temperature} FIRST_LAYER_TEMPERATURE={first_layer_temperature}
[gcode_macro START_PRINT_REDUX]
description: Start G-code for SuperSlicer
gcode:
{% set first_layer_bed_temperature = params.FIRST_LAYER_BED_TEMPERATURE|default(65) %}
{% set first_layer_temperature = params.FIRST_LAYER_TEMPERATURE|default(200) %}
#SAVE_GCODE_STATE
HOME_IF_NOT_HOME
G21 # Millimeter Units
G90 # Absolute Positioning
M83 # E Relative
#M140 S{first_layer_bed_temperature} # Set Bed Temperature
M104 S{first_layer_temperature} # Set Hotend Temperature
M190 S{first_layer_bed_temperature} # Wait for Bed Temperature
M109 S{first_layer_temperature} # Wait for Hotend Temperature
BED_MESH_PROFILE LOAD=default
TURN_ON_LED # LED On
THE_LEGEND_OF_ZELDA_MAGIC_RECORDER
PRIME_LINE_REDUX
#RESTORE_GCODE_STATE
[gcode_macro PRIME_LINE_REDUX]
description: Purge filament & prime line
gcode:
G0 Z0.2 # Linear Move - Non-Print
G92 E0 # Set Position
G0 E40 F300 # Linear Move - Non-Print - Extrude Only
G0 X5 Y5 # Linear Move - Non-Print
G1 X100 E10 F600 # Linear Move - Print
G92 E0 # Set Position
G0 Z2 # Linear Move - Non-Print
G1 X110 Z0.3 F5000 # Linear Move - Non-Print
G90 # Absolute Positioning
M82 # E Absolute
# Super Slicer End G-code
# END_PRINT_REDUX
[gcode_macro END_PRINT_REDUX]
description: End G-code for SuperSlicer
gcode:
TURN_OFF_HEATERS
G91 # Relative Positioning
G0 E-1 F3000 # Linear Move - Non-Print
G0 X-1 Y-1 Z5 E-5 # Linear Move - Non-Print
G90 # Absolute Positioning
G0 X0 Y234 F3000 # Linear Move - Non-Print
TURN_OFF_FAN
DISABLE_STEPPERS
THE_LEGEND_OF_ZELDA_ITEM
# CALIBRATION
#
[gcode_macro HOME_IF_NOT_HOME]
description: You can't go home again
gcode:
{% if printer.toolhead.homed_axes != 'xyz' %}
G28 # Auto Home
{% endif %}
[gcode_macro HOME_AND_CENTER]
description: Home all & center nozzle (if not already)
gcode:
HOME_IF_NOT_HOME
G90 # Absolute Positioning
G0 X122.5 Y122.5 # Linear Move - Non-Print
#{ action_respond_info("Head positioned at center...") }
[gcode_macro PROBE_CALIBRATE_POSITION]
description: Move carriage to center of bed for PROBE_CALIBRATE
gcode:
HOME_AND_CENTER
TURN_ON_LED # LED On
[gcode_macro CALIBRATE_BED_MESH]
description: Calibrate bed mesh
gcode:
HOME_IF_NOT_HOME
M140 S60 # Set Bed Temperature
M190 S60 # Wait for Bed Temperature
M104 S150 # Set Hotend Temperature
M109 S150 # Wait for Hotend Temperature
BED_MESH_CALIBRATION
#{ action_respond_info("Ready for bed mesh calibration...") }
[gcode_macro BED_MESH_CALIBRATION]
gcode:
BED_MESH_PROFILE REMOVE=default
BED_MESH_CLEAR
BED_MESH_CALIBRATE
THE_LEGEND_OF_ZELDA_SECRET_DISCOVERY
SAVE_CONFIG
[gcode_macro PID_EXTRUDER]
description: Perform PID tuning of extruder with desired fan speed
gcode:
{% set extruder_temp = params.EXTRUDER_TEMP|default(200)|float %}
{% set fan_speed = params.FAN_SPEED|default(255)|int %}
TURN_ON_FAN SPEED={fan_speed}
PID_CALIBRATE HEATER=extruder TARGET={extruder_temp}
[gcode_macro PID_BED]
gcode:
{% set heater_bed_target = params.TARGET|default(60)|float %}
TURN_OFF_FAN
PID_CALIBRATE HEATER=heater_bed TARGET={heater_bed_target}
# MAINTENANCE
#
[gcode_macro UNLOAD_FILAMENT]
gcode:
HOME_IF_NOT_HOME
M109 S210 # Wait for Hotend Temperature
TURN_OFF_LED # LED Off
M83 # E Relative
G0 E2 F300 # Linear Move - Non-Print - Extrude Only
G0 E-15 F3000 # Linear Move - Non-Print
G0 E-100 F500 # Linear Move - Non-Print
G0 E-300 F2000 # Linear Move - Non-Print
G0 E-85 F250 # Linear Move - Non-Print
M82 # E Absolute
SET_FILAMENT_SENSOR SENSOR=runout ENABLE=0
THE_LEGEND_OF_ZELDA_ITEM_SAVE_CONTINUE_RETRY_SCREEN
[gcode_macro LOAD_FILAMENT]
gcode:
HOME_IF_NOT_HOME
M109 S210 # Wait for Hotend Temperature
TURN_ON_LED # LED On
M83 # E Relative
G0 E400 F400 # Linear Move - Print - Extrude Only
G0 E150 F400 # Linear Move - Print - Extrude Only
M82 # E Absolute
SET_FILAMENT_SENSOR SENSOR=runout ENABLE=1
THE_LEGEND_OF_ZELDA_ITEM_SAVE_CONTINUE_RETRY_SCREEN
[gcode_macro DISABLE_STEPPERS]
gcode:
M18 # Disable steppers
[gcode_macro TURN_ON_FAN]
description: Turn on print cooling fan and set its speed
# usage: TURN_ON_FAN [SPEED=<speed>]
gcode:
{% set S = params.SPEED|default(255)|int %}
{% if S > 255 or S < 0 %}
{ action_raise_error("S%i is out of range." | format(S)) }
{% endif %}
M106 S{S} # Set Fan Speed
[gcode_macro TURN_OFF_FAN]
gcode:
M107 # Fan Off
[gcode_macro TURN_ON_LED]
gcode:
SET_PIN PIN=led_pin VALUE=1
[gcode_macro TURN_OFF_LED]
gcode:
SET_PIN PIN=led_pin VALUE=0
[gcode_macro TURN_OFF_EVERYTHING]
gcode:
TURN_OFF_HEATERS # Klipper macro
TURN_OFF_FAN
TURN_OFF_LED # LED On
[gcode_macro MAINTENANCE_POSITION]
description: Move carriage to maintenance position for easier access
gcode:
HOME_IF_NOT_HOME
G0 Z150 F1000 # Linear Move - Non-Print
TURN_OFF_EVERYTHING
DISABLE_STEPPERS
TURN_ON_LED # LED On
[gcode_macro SEARCH_VARS]
description: Search for variables based on string input
# usage: 'SEARCH_VARS s="profile"'
gcode:
{% if not params.S %}
{action_respond_info("hmm.. try 'SEARCH_VARS s=\"profile\"'")}
{% else %}
{% set resultcount = namespace(total=0) %}
{% set search = params.S|lower %}
{% set ns = namespace() %}
{% for item in printer %}
{% if ' ' in item %}
{% set ns.path = ['printer', "['%s']" % (item), ''] %}
{% else %}
{% set ns.path = ['printer.', item, ''] %}
{% endif %}
{% if search in ns.path|lower %}
{ action_respond_info(ns.path|join) }
{% set resultcount.total = 1 + resultcount.total %}
{% endif %}
{% if printer[item].items() %}
{% for childkey, child in printer[item].items() recursive %}
{% set ns.path = ns.path[:loop.depth|int + 1] %}
{% if ' ' in childkey %}
{% set null = ns.path.append("['%s']" % (childkey)) %}
{% else %}
{% set null = ns.path.append(".%s" % (childkey)) %}
{% endif %}
{% if child is mapping %}
{ loop(child.items()) }
{% else %}
{% if search in ns.path|lower %}
{ action_respond_info("%s : %s" % (ns.path|join, child)) }
{% set resultcount.total = 1 + resultcount.total %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% if resultcount.total >= 1 %}
{action_respond_info("found \"" + params.S + "\" " + resultcount.total|string +" times.")}
{% else %}
{action_respond_info("\"" + params.S + "\" not found.")}
{% endif %}
{% set resultcount.total = 0|int %}
{% endif %}
######################################################################
# 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
######################################################################
# PAUSE PRINT
######################################################################
[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
# 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 %}
{%set min_extrude_temp = printer.configfile.settings["extruder"]["min_extrude_temp"]|int %}
{%set act_extrude_temp = printer.extruder.temperature|int %}
##### end of definitions #####
PAUSE_BASE
G91
{% if act_extrude_temp > min_extrude_temp %}
G1 E-{E} F2100
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
{% if "xyz" in printer.toolhead.homed_axes %}
G1 Z{z_safe} F900
G90
G1 X{x_park} Y{y_park} F6000
{% else %}
{action_respond_info("Printer not homed")}
{% endif %}
######################################################################
# RESUME PRINT
######################################################################
[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
gcode:
##### read E from pause macro #####
{% set E = printer["gcode_macro PAUSE"].extrude|float %}
{% set min_extrude_temp = printer.configfile.settings["extruder"]["min_extrude_temp"]|int %}
{% set act_extrude_temp = printer.extruder.temperature|int %}
#### get VELOCITY parameter if specified ####
{% if 'VELOCITY' in params|upper %}
{% set get_params = ('VELOCITY=' + params.VELOCITY) %}
{% else %}
{% set get_params = "" %}
{% endif %}
##### end of definitions #####
{% if act_extrude_temp > min_extrude_temp %}
G91
G1 E{E} F2100
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
RESUME_BASE {get_params}
[gcode_macro PRESSURE_ADVANCE_CALIBRATION]
description: Adjust velocity & pressure advance parameters for bowden extruder
gcode:
SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY=1 ACCEL=500
TUNING_TOWER COMMAND=SET_PRESSURE_ADVANCE PARAMETER=ADVANCE START=0 FACTOR=.020