-
Notifications
You must be signed in to change notification settings - Fork 0
/
macros.cfg
320 lines (277 loc) · 9.11 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
[virtual_sdcard]
path: /home/pi/gcode_files
[pause_resume]
[display_status]
[exclude_object]
[gcode_macro M486]
gcode:
# Parameters known to M486 are as follows:
# [C<flag>] Cancel the current object
# [P<index>] Cancel the object with the given index
# [S<index>] Set the index of the current object.
# If the object with the given index has been canceled, this will cause
# the firmware to skip to the next object. The value -1 is used to
# indicate something that isn’t an object and shouldn’t be skipped.
# [T<count>] Reset the state and set the number of objects
# [U<index>] Un-cancel the object with the given index. This command will be
# ignored if the object has already been skipped
{% if 'exclude_object' not in printer %}
{action_raise_error("[exclude_object] is not enabled")}
{% endif %}
{% if 'T' in params %}
EXCLUDE_OBJECT RESET=1
{% for i in range(params.T | int) %}
EXCLUDE_OBJECT_DEFINE NAME={i}
{% endfor %}
{% endif %}
{% if 'C' in params %}
EXCLUDE_OBJECT CURRENT=1
{% endif %}
{% if 'P' in params %}
EXCLUDE_OBJECT NAME={params.P}
{% endif %}
{% if 'S' in params %}
{% if params.S == '-1' %}
{% if printer.exclude_object.current_object %}
EXCLUDE_OBJECT_END NAME={printer.exclude_object.current_object}
{% endif %}
{% else %}
EXCLUDE_OBJECT_START NAME={params.S}
{% endif %}
{% endif %}
{% if 'U' in params %}
EXCLUDE_OBJECT RESET=1 NAME={params.U}
{% endif %}
[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
variable_park: True
gcode:
NEOPIXEL_RED
## Move head and retract only if not already in the pause state and park set to true
{% if printer.pause_resume.is_paused|lower == 'false' and park|lower == 'true'%}
_TOOLHEAD_PARK_PAUSE_CANCEL
{% endif %}
TURN_OFF_HEATERS
CANCEL_PRINT_BASE
[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
gcode:
PAUSE_BASE
_TOOLHEAD_PARK_PAUSE_CANCEL
[gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL]
description: Helper: park toolhead used in PAUSE and CANCEL_PRINT
variable_extrude: 1.0
gcode:
##### 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 %}
{% set z_park_delta = 2.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 - z_park_delta) %}
{% set z_safe = z_park_delta %}
{% else %}
{% set z_safe = max_z - act_z %}
{% endif %}
##### end of definitions #####
{% if printer.extruder.can_extrude|lower == 'true' %}
M83
G1 E-{extrude} F2100
{% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
{% if "xyz" in printer.toolhead.homed_axes %}
G91
G1 Z{z_safe} F900
G90
G1 X{x_park} Y{y_park} F6000
{% if printer.gcode_move.absolute_coordinates|lower == 'false' %} G91 {% endif %}
{% else %}
{action_respond_info("Printer not homed")}
{% endif %}
[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
gcode:
##### read extrude from _TOOLHEAD_PARK_PAUSE_CANCEL macro #####
{% set extrude = printer['gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL'].extrude %}
#### 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 printer.extruder.can_extrude|lower == 'true' %}
M83
G1 E{extrude} F2100
{% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
RESUME_BASE {get_params}
[firmware_retraction]
retract_length: 1.2
# The length of filament (in mm) to retract when G10 is activated,
# and to unretract when G11 is activated (but see
# unretract_extra_length below). The default is 0 mm.
retract_speed: 30
# The speed of retraction, in mm/s. The default is 20 mm/s.
#unretract_extra_length: 0
# The length (in mm) of *additional* filament to add when
# unretracting.
unretract_speed: 20
# The speed of unretraction, in mm/s. The default is 10 mm/s.
[gcode_macro PRINT_END]
# Use PRINT_END for the slicer ending script - please customise for your slicer of choice
gcode:
M400 ; wait for buffer to clear
G92 E0 ; zero the extruder
G1 E-4.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 Z20 F3000 ; move nozzle up 2mm
G90 ; absolute positioning
G0 X240 Y240 F3600 ; park nozzle at center rear
[pause_resume]
recover_velocity: 50.0
[gcode_macro M600]
########### Gcode ############
gcode:
{% set X = params.X|default(printer.configfile.config["stepper_x"]["position_endstop"]|string)|int %}
{% set Y = params.Y|default(printer.configfile.config["stepper_y"]["position_endstop"]|string)|int %}
{% set Z = params.Z|default(10)|int %}
{% set E = params.E|default(-20)|int %}
{% set tool = params.tool|default(0)|int %}
SAVE_GCODE_STATE NAME=M600_state
PAUSE
G91
G1 E-5 F4000
G1 Z{Z}
G90
G1 X{X} Y{Y} F3000 ;park position
G0 E10 F500 ;extrude filament to get better blob on end
G0 E{E} F600 ;retract additional filament to move out of melt zone
G92 E0
SET_FILAMENT_SENSOR SENSOR=e{TOOL}_runout ENABLE=0
# Use this command resume during a mid print filament swap (DONT USE OCTO/MAINSAIL/DWC RESUME)
[gcode_macro SWAP_RESUME]
gcode:
RESTORE_GCODE_STATE NAME=M600_state
SET_FILAMENT_SENSOR SENSOR=e0_runout ENABLE=1
SET_FILAMENT_SENSOR SENSOR=e1_runout ENABLE=1
resume
[gcode_macro PURGE]
gcode:
M117 PURGING..
G91
G1 E45.0 F250
G90
[gcode_macro UNLOAD_FILAMENT]
gcode:
M83
G1 E10 F300
G1 E-100 F1800
M82
[gcode_macro LOAD_FILAMENT]
gcode:
M83
G1 E70 F1800
G1 E30 F300
G1 E15 F150
G1 E-3
M82
[gcode_macro TIMELAPSE_TAKE_FRAME]
gcode:
{action_call_remote_method("timelapse_newframe")}
[gcode_macro TIMELAPSE_RENDER]
gcode:
{action_call_remote_method("timelapse_render")}
[gcode_macro PID_BED_65]
description: Start Bed PID
gcode:
BED_PROGRESS
{% if printer.idle_timeout.state == "Printing" %}
RESPOND TYPE=error MSG="This macro cannot be used while printing!"
{% else %}
{% if printer.toolhead.homed_axes != "xyz" %}
G28
{% endif %}
M106
G1 Z50 F1500
RESPOND MSG="Bed PID in progress..."
PID_CALIBRATE HEATER=heater_bed TARGET={params.TEMP|default(65)}
G28
SAVE_CONFIG
{% endif %}
[gcode_macro PID_HOTEND_220]
description: Start Hotend PID
gcode:
HOTEND_PROGRESS
{% if printer.idle_timeout.state == "Printing" %}
RESPOND TYPE=error MSG="This macro cannot be used while printing!"
{% else %}
{% if printer.toolhead.homed_axes != "xyz" %}
G28
{% endif %}
M106
G1 Z50 F1500
RESPOND MSG="Hotend PID in progress..."
PID_CALIBRATE HEATER=extruder TARGET={params.TEMP|default(220)}
G28
SAVE_CONFIG
{% endif %}
# KEEP HEATERS ON DURING PAUSE
[idle_timeout]
#gcode:
# A list of G-Code commands to execute on an idle timeout. See
# docs/Command_Templates.md for G-Code format. The default is to run
# "TURN_OFF_HEATERS" and "M84".
timeout: 20000 # 5.5 hours heaters will remain on before time out
# Idle time (in seconds) to wait before running the above G-Code
# commands. The default is 600 seconds.
[gcode_macro PRINT_STARTPLA]
# Use PRINT_START for the slicer starting script - please customise for your slicer of choice
gcode:
#G90 ; use absolute coordinates
#BED_PROGRESS
#M140 S{first_layer_bed_temperature[0]} ; set final bed temp
#M104 S120 ; set temporary nozzle temp to prevent oozing during homing
#M190 S{first_layer_bed_temperature}
#NEOPIXEL_GREEN
#G28 ; home all axis
#NEOPIXEL_VIOLET
#Z_TILT_ADJUST
#NEOPIXEL_GREEN
#G28 ; home all axis
#G1 Z10 F240
#G1 X2 Y10 F3000
#HOTEND_PROGRESS
#M104 S{first_layer_temperature[0]} ; set final nozzle temp
#M190 S{first_layer_bed_temperature[0]} ; wait for bed temp to stabilize
#M109 S{first_layer_temperature[0]} ; wait for nozzle temp to stabilize
#NEOPIXEL_RED
#BED_MESH_PROFILE LOAD=default
SET_PRESSURE_ADVANCE ADVANCE=0.0962
G1 Z0.28 F240
G92 E0
G1 Y140 E10 F1500 ; prime the nozzle
G1 X2.3 F5000
G92 E0
G1 Y10 E10 F1200 ; prime the nozzle
G92 E0
NEOPIXEL_ON
[gcode_macro END_PRINT]
gcode:
NEOPIXEL_YELLOW
M140 S0 ; turn off heatbed
M104 S0 ; turn off temperature
M107 ; turn off fan
M84 X Y E ; disable motors