forked from 3DPrintDemon/Demon_Klipper_Essentials_Unified
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemon_clean_load_v1.6.cfg
363 lines (258 loc) · 11.2 KB
/
demon_clean_load_v1.6.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
###################################################
#######>>>>>>>>>> 3DPrintDemon <<<<<<<<<<<#######
####### https://github.com/3DPrintDemon #######
# IF YOU USE & LIKE THESE MACROS PLEASE CONSIDER SUPPORTING MY EFFORTS AT
# https://www.https://ko-fi.com/3dprintdemon
# Macro set includes all NEW fully automated LOAD/UNLOAD_CLEAN macros for one click loading & unloading followed
# by nozzle cleaning & cooldown, customise all macros via variables, plus selectable temps & load speeds!
# CHECK YOUR VALUES ARE CORRECT BEFORE USE, THIS IS VITAL & TOTALLY ON YOU!
# DO NOT BLINDLY USE THESE DEFAULTS!!
# USE THESE MACROS AT OWN RISK!
# DONT CRY TO ME IF YOU DIDN'T CHECK/CHANGE VALUES & YOU BREAK THINGS!
[gcode_macro LOAD_FILAMENT]
gcode:
{% set start_vars = printer["gcode_macro _START_VARIABLES"] %}
{% set speed = params.SPEED_MMsec|default(7)|float * 60 %}
{% set max_velocity = printer.configfile.settings['extruder'].max_extrude_only_velocity * 60 %}
_MAX_EXTRUDE_CHECK
SAVE_GCODE_STATE NAME=load_state
_ENCODER_FEED_CHECK_PREP
M400
M83
G92 E0
G1 E{start_vars.load_length} F{max_velocity}
M400
_ENCODER_FEED_CHECK
G1 E{start_vars.load_purge_length} F{speed}
RESTORE_GCODE_STATE NAME=load_state
[gcode_macro UNLOAD_FILAMENT]
gcode:
{% set start_vars = printer["gcode_macro _START_VARIABLES"] %}
{% set speed = params.SPEED_MMsec|default(7)|float * 60 %}
{% set max_velocity = printer.configfile.settings['extruder'].max_extrude_only_velocity * 60 %}
_MAX_EXTRUDE_CHECK
SAVE_GCODE_STATE NAME=unload_state
_ENCODER_FEED_CHECK_PREP
M400
M83
G92 E0
G1 E{start_vars.unload_purge_length} F{speed}
M400
_ENCODER_FEED_CHECK
G1 E-5 F{max_velocity}
G4 P8000
G1 E-{start_vars.unload_length} F{max_velocity}
RESTORE_GCODE_STATE NAME=unload_state
[gcode_macro CLEAN_NOZZLE]
gcode:
{% set start_vars = printer["gcode_macro _START_VARIABLES"] %}
{% set clean_vars = printer["gcode_macro _CLEAN_VARIABLES"] %}
{% if clean_vars.have_you_set_this_up != True %}
{action_raise_error("This error is caused by you not setting up this feature before first use. Check demon_user_settings file & set this feature up correctly for your printer!")}
{% else %}
{% if start_vars.nozzle_cleaner == True %}
G90
M83
_CONDITIONAL_HOME
SET_DISPLAY_TEXT MSG="Cleaning Nozzle"
RESPOND TYPE=COMMAND MSG="Cleaning Nozzle"
G0 X{clean_vars.start_x} Y{clean_vars.start_y} F10000
G0 Z{clean_vars.start_z}
{% if start_vars.neopixel_led == True %}
STATUS_CLEANING
{% endif %}
M400
{% for passes in range(1, (clean_vars.pass_count)) %}
_step_control
{% endfor %}
G0 Z{clean_vars.park_z} F10000
{% if printer.print_stats.state != 'printing' %}
G0 X{clean_vars.end_position_x} Y{clean_vars.end_position_y}
G0 X{clean_vars.park_x} Y{clean_vars.park_y} Z{clean_vars.park_z} F10000
{% endif %}
M117
M400
{% if start_vars.neopixel_led == True %}
STATUS_READY
{% endif %}
{% else %}
{action_raise_error("This error is caused by the nozzle_cleaner variable not being enabled, check the demon_user_settings file!")}
{% endif %}
{% endif %}
[gcode_macro LOAD_CLEAN]
gcode:
{% set start_vars = printer["gcode_macro _START_VARIABLES"] %}
{% set clean_vars = printer["gcode_macro _CLEAN_VARIABLES"] %}
{% set temp = params.TEMP|default(250)|float %}
{% set speed = params.SPEED_MMsec|default(7)|float * 60 %}
{% set max_velocity = printer.configfile.settings['extruder'].max_extrude_only_velocity * 60 %}
_MAX_EXTRUDE_CHECK
{% if clean_vars.have_you_set_this_up != True %}
{action_raise_error("This error is caused by you not setting up this feature before first use. Check demon_user_settings file & set this feature up correctly for your printer!")}
{% elif printer.print_stats.state in ['printing', 'paused'] %}
RESPOND TYPE=error MSG="Request denied, current printer state is printing/paused"
{% else %}
{% if start_vars.nozzle_cleaner == True and start_vars.purge_bucket == True %}
SAVE_GCODE_STATE NAME=load_clean_state
_RUNOUT_SENSOR_CHECK
{% if start_vars.neopixel_led == True %}
STATUS_HEATING
{% endif %}
M117 HEATING...
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={clean_vars.nozzle_pre_temp}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={clean_vars.nozzle_pre_temp - 5} MAXIMUM={clean_vars.nozzle_pre_temp + 5}
_CONDITIONAL_HOME
G90
M83
{% if start_vars.neopixel_led == True %}
STATUS_READY
{% endif %}
{% if printer.toolhead.position.z|float < 20 %}
G0 Z20 F3600
{% endif %}
_random_spot
G0 Z{clean_vars.purge_z_park} F3000 # park to purge
M400
M117 Heating to Load...
{% if start_vars.neopixel_led == True %}
STATUS_HEATING
{% endif %}
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={temp}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={temp - 2} MAXIMUM={temp + 5}
M106 S255 # Fans to max.
M117 LOADING.....
{% if start_vars.neopixel_led == True %}
STATUS_PRINTING
{% endif %}
_ENCODER_FEED_CHECK_PREP
G92 E0 # reset extruder
G1 E{clean_vars.load_clean_load_dist} F{max_velocity} # Max extrude only speed
M400
_ENCODER_FEED_CHECK
G1 E{clean_vars.load_clean_purge_dist} F{speed} # fast purge
G4 P10000
_random_spot
M107 # fans off
# M106 S255 # Fans to max.
G1 E-5 F300 # slow retract
G4 P10000
_random_spot
M106 S255 # Fans to max.
M400 # wait for all moves to complete
M117 Post Load Cooling...
{% if start_vars.neopixel_led == True %}
STATUS_HEATING
{% endif %}
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={clean_vars.nozzle_post_temp}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={clean_vars.nozzle_post_temp - 5} MAXIMUM={clean_vars.nozzle_post_temp + 5}
_random_spot
M107 # fans off
M118 WARNING Nozzle Cleaning 5 Seconds...
M117 WARNING Nozzle Cleaning 5 Seconds...
G4 P5000 # 5 second wait
M118 Nozzle Cleaning...
M117 Nozzle Cleaning...
CLEAN_NOZZLE
M400
M117
SET_HEATER_TEMPERATURE HEATER=extruder TARGET=0
{% if start_vars.neopixel_led == True %}
STATUS_READY
{% endif %}
{% if start_vars.runout_sensor == True %}
SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=1
{% endif %}
RESTORE_GCODE_STATE NAME=load_clean_state
{% else %}
{action_raise_error("This error is caused by the nozzle_cleaner & purge_bucket both not being enabled Check demon_user_settings file!")}
{% endif %}
{% endif %}
[gcode_macro UNLOAD_CLEAN]
gcode:
{% set start_vars = printer["gcode_macro _START_VARIABLES"] %}
{% set clean_vars = printer["gcode_macro _CLEAN_VARIABLES"] %}
{% set temp = params.TEMP|default(250)|float %}
{% set speed = params.SPEED_MMsec|default(7)|float * 60 %}
{% set max_velocity = printer.configfile.settings['extruder'].max_extrude_only_velocity * 60 %}
_MAX_EXTRUDE_CHECK
{% if clean_vars.have_you_set_this_up != True %}
{action_raise_error("This error is caused by you not setting up this feature before first use. Check demon_user_settings file & set this feature up correctly for your printer!")}
{% elif printer.print_stats.state in ['printing', 'paused'] %}
RESPOND TYPE=error MSG="Request denied, current printer state is printing/paused"
{% else %}
{% if start_vars.nozzle_cleaner == True and start_vars.purge_bucket == True %}
SAVE_GCODE_STATE NAME=unload_clean_state
_RUNOUT_SENSOR_CHECK
{% if start_vars.neopixel_led == True %}
STATUS_HEATING
{% endif %}
M117 HEATING...
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={clean_vars.nozzle_pre_temp}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={clean_vars.nozzle_pre_temp - 5} MAXIMUM={clean_vars.nozzle_pre_temp + 5}
_CONDITIONAL_HOME
{% if start_vars.runout_sensor == True %}
SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=0
{% endif %}
G90
M83
{% if start_vars.neopixel_led == True %}
STATUS_READY
{% endif %}
{% if printer.toolhead.position.z|float < 20 %}
G0 Z20 F3600
{% endif %}
_random_spot
G0 Z{clean_vars.purge_z_park} F3000 # park to purge
M400
M117 Heating to Unload...
{% if start_vars.neopixel_led == True %}
STATUS_HEATING
{% endif %}
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={temp}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={temp - 2} MAXIMUM={temp + 5}
M117 UNLOADING.....
{% if start_vars.neopixel_led == True %}
STATUS_PRINTING
{% endif %}
_ENCODER_FEED_CHECK_PREP
G92 E0 # reset extruder
G1 E{clean_vars.unload_clean_purge_dist} F{speed} # fast purge
M400
_ENCODER_FEED_CHECK
G4 P5000
_random_spot
G1 E-{clean_vars.unload_clean_unload_dist} F{max_velocity} # Max extrude only speed
M106 S255 # Fans to max.
G4 P5000
_random_spot
M400 # wait for all moves to complete
M117 Post Unload Cooling...
{% if start_vars.neopixel_led == True %}
STATUS_HEATING
{% endif %}
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={clean_vars.nozzle_post_temp}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={clean_vars.nozzle_post_temp - 5} MAXIMUM={clean_vars.nozzle_post_temp + 5}
M107 # fans off
M118 WARNING Nozzle Cleaning 5 Seconds...
M117 WARNING Nozzle Cleaning 5 Seconds...
G4 P5000 # 5 second wait
M118 Nozzle Cleaning...
M117 Nozzle Cleaning...
CLEAN_NOZZLE
M400
M117
TURN_OFF_HEATERS
{% if start_vars.neopixel_led == True %}
STATUS_READY
{% endif %}
{% if start_vars.runout_sensor == True %}
SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=1
{% endif %}
RESTORE_GCODE_STATE NAME=unload_clean_state
{% else %}
{action_raise_error("This error is caused by the nozzle_cleaner & purge_bucket both not being enabled. Check demon_user_settings file!")}
{% endif %}
{% endif %}
[gcode_macro _CLEAN_LOAD_VERSION]
variable_demon_clean_load: 1.6
gcode: