-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfilament.cfg
405 lines (352 loc) · 12.7 KB
/
filament.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
[firmware_retraction]
# The length of filament (in mm) to retract when G10 is activated,
# and to unretract when G11 is activated
retract_length: 0.55
# The length (in mm) of *additional* filament to add when
# unretracting.
unretract_extra_length: 0
retract_speed: 50
unretract_speed: 30
[gcode_macro _FILAMENT_BALL]
description: Helper: Round the filament tip
gcode:
##### set default parameter value #####
{% set wait = params.WAIT|default(0) %}
##### end of definitions #####
SAVE_GCODE_STATE NAME=STATE_FILAMENT_BALL
# Ball up the filament tip
G92 E0 ; zero the extruder
M82 ; absolute extrusion
G1 E2 F3600
G1 E0 F3600
G1 E4 F3600
G1 E0 F3600
G1 E8 F3600
G1 E0 F3600
M83 ; relative extrusion
G1 E-25 F3600
G4 P{wait|int * 1000}
RESTORE_GCODE_STATE NAME=STATE_FILAMENT_BALL
[gcode_macro LOAD_FILAMENT]
description: Load macro alias for KlipperScreen
gcode:
{% set get_params = [] %}
{% for key in params %}
{% set get_params = get_params.append(key + "=" + params[key]) %}
{% endfor %}
FILAMENT_LOAD {get_params|join(" ")}
[gcode_macro FILAMENT_LOAD]
description: Load filament and disable rounout while running
variable_load_distance: 50
variable_load_extrude: 30
variable_retract_end: 1.5
gcode:
##### get user defines #####
{% set load = load_distance %}
{% set extrude = load_extrude %}
{% set retract = retract_end|float * -1 %}
##### store extruder temps #####
{% set extruder_target = printer.extruder.target %}
{% set loadTemp = params.TEMP|default(0) %}
{% if loadTemp == 0 %}
{% set loadTemp = extruder_target%}
{% endif %}
##### end of definitions #####
{% if printer.idle_timeout.state != "Printing" or printer.pause_resume.is_paused|lower == "true" %}
SAVE_GCODE_STATE NAME=STATE_LOAD_FILAMENT
## Move to waste bin
_CG28 ; home if not already homed
G90 ; absolute positioning
{% if printer.toolhead.position.z|float == printer.configfile.config["stepper_z"]["position_max"]|float %} #if z position = z max do the following
# do nothing
{% elif printer.toolhead.position.z|float >= 50|float %} #if z position >= 50mnm do the following
#do nothing
{% else %} #if you dont meet any of the criteria
G90 #absolute positioning
G1 Z50 F3000 #move z to 50mm
{% endif %}
Go_To_Purge_Location
{% if printer.extruder.can_extrude|lower == 'false' %}
{action_respond_info("Extruder Temp to low heat to %2dC" % minTemp)}
{% else %}
M83 ; set extruder to relative
G1 E{load} F600 ; quickly load 90mm filament
G1 E{extrude} F600 ; slower extrusion for hotend path
G1 E{retract} F1000 ; retract
# clean nozzle
nozzle_clean
{% endif %}
RESTORE_GCODE_STATE NAME=STATE_LOAD_FILAMENT
UPDATE_DELAYED_GCODE ID=notify_extruder_load DURATION=2
{% if 'filament_motion_sensor runout' in printer.configfile.settings %}
SET_FILAMENT_SENSOR SENSOR=runout ENABLE=1
{% endif %}
#{action_respond_info("Filament loaded")}
{% else %}
{action_respond_info("Filament loading disabled while printing!")}
{% endif %}
# Notify when filament is loaded
[delayed_gcode notify_extruder_load]
initial_duration: 0
gcode:
{action_respond_info("action:prompt_begin FIlament is Loaded")}
{action_respond_info("action:prompt_choice OK")}
{action_respond_info("action:prompt_show")}
# Macro to Unload Filament
[gcode_macro unload_filament]
# params:
# EXTRUDER
gcode:
{% set EXTRUDER = params.EXTRUDER|default(260) %}
SAVE_GCODE_STATE NAME=STATE_UNLOAD_FILAMENT
turn_fans_off #turn part cooling fans off
_CG28
Go_To_Purge_Location
{% if 'filament_motion_sensor runout' in printer.configfile.settings %}
SET_FILAMENT_SENSOR SENSOR=runout ENABLE=0
{% endif %}
{% if printer.toolhead.position.z|float == printer.configfile.config["stepper_z"]["position_max"]|float %} #if z position = z max do the following
# do nothing
{% elif printer.toolhead.position.z|float >= 50|float %} #if z position >= 50mnm do the following
#do nothing
{% else %} #if you dont meet any of the criteria
G90 #absolute positioning
G1 Z50 F3000 #move z to 50mm
{% endif %}
M83 #relative positioning on extruder
#G0 E5 F400 #extrude filament to get better blob on end
Shape_Tip
G0 E-100 F1800 #retract additional filament to move out of melt zone
RESTORE_GCODE_STATE NAME=STATE_UNLOAD_FILAMENT
UPDATE_DELAYED_GCODE ID=notify_extruder_reload DURATION=10
# Notify when filament is unloaded and ready to reload
[delayed_gcode notify_extruder_reload]
initial_duration: 0
gcode:
{action_respond_info("action:prompt_begin Ready to Load Filament")}
{action_respond_info("action:prompt_choice OK")}
{action_respond_info("action:prompt_show")}
# Scrubs the nozzle on the brass brush or silicone wiper located in the build chamber
[gcode_macro nozzle_clean]
gcode:
SAVE_GCODE_STATE NAME=clean_nozzle_state #store current nozzle location
Wipe_Nozzle
RESTORE_GCODE_STATE NAME=clean_nozzle_state MOVE=1 #restore current nozzle location
# Settings for the nozzle wiper
[gcode_macro Nozzle_Wiper_Variables]
# the values below are for a wiper located at (-8, 121)
variable_purge_x: -8 # x purge location
variable_purge_y: 110 # y purge location
variable_purge_x_entry: 0 # x entry location before going to the purge location
variable_purge_y_entry: 110 # y entry location before going to the purge location
variable_wipe_dx: 0 # distance to move in x from the purge position in order to wipe
variable_wipe_dy: 16 # distance to move in y from the purge position in order to wipe
variable_wipe_count: 4 # number of wipe cycles
variable_travel_speed: 300 # how fast travel speeds will be performed
variable_entry_speed: 100 # how fast to move from the entry location to the purge location
variable_wipe_speed: 50 # how fast to move when wiping
variable_purge_speed: 8 # how fast to extrude in mm/s when purging
variable_purge_fan: 0 # default fan speed out of 255 when purging
variable_wipe_fan: 0 # default fan speed out of 255 when wiping
gcode:
# Move above the purge bucket
[gcode_macro Go_To_Purge_Location]
gcode:
{% set Px = printer["gcode_macro Nozzle_Wiper_Variables"].purge_x|float %}
{% set Py = printer["gcode_macro Nozzle_Wiper_Variables"].purge_y|float %}
{% set Pxe = printer["gcode_macro Nozzle_Wiper_Variables"].purge_x_entry|float %}
{% set Pye = printer["gcode_macro Nozzle_Wiper_Variables"].purge_y_entry|float %}
{% set St = printer["gcode_macro Nozzle_Wiper_Variables"].travel_speed * 60 %}
{% set Se = printer["gcode_macro Nozzle_Wiper_Variables"].entry_speed * 60 %}
SAVE_GCODE_STATE NAME=Go_To_Purge_Location_state
G90
{% if not (printer.toolhead.position.x == Px and printer.toolhead.position.y == Py) %}
G1 X{Pxe} Y{Pye} F{St}
G1 X{Px} Y{Py} F{Se}
{% endif %}
RESTORE_GCODE_STATE NAME=Go_To_Purge_Location_state
# Wipe the nozzle on the brass brush or silicone wiper
[gcode_macro Wipe_Nozzle]
# params:
# OLD_FAN_SPEED
gcode:
{% set OLD_FAN_SPEED = params.OLD_FAN_SPEED|default(-1)|int %}
{% set Px = printer["gcode_macro Nozzle_Wiper_Variables"].purge_x|float %}
{% set Py = printer["gcode_macro Nozzle_Wiper_Variables"].purge_y|float %}
{% set Pxe = printer["gcode_macro Nozzle_Wiper_Variables"].purge_x_entry|float %}
{% set Pye = printer["gcode_macro Nozzle_Wiper_Variables"].purge_y_entry|float %}
{% set Wdx = printer["gcode_macro Nozzle_Wiper_Variables"].wipe_dx|float %}
{% set Wdy = printer["gcode_macro Nozzle_Wiper_Variables"].wipe_dy|float %}
{% set Wc = printer["gcode_macro Nozzle_Wiper_Variables"].wipe_count|int %}
{% set Se = printer["gcode_macro Nozzle_Wiper_Variables"].entry_speed * 60 %}
{% set Sw = printer["gcode_macro Nozzle_Wiper_Variables"].wipe_speed * 60 %}
{% set Sf = printer["gcode_macro Nozzle_Wiper_Variables"].wipe_fan %}
# {% if OLD_FAN_SPEED == -1 %}
# {% set old_Sf = printer.fan.speed %}
# {% else %}
# {% set old_Sf = OLD_FAN_SPEED %}
# {% endif %}
# {% if printer.fan.speed < Sf %}
# {% set wait_for_fan = True %}
# {% else %}
# {% set wait_for_fan = False %}
# {% endif %}
SAVE_GCODE_STATE NAME=Wipe_Nozzle_state
G90
# go to purge location
Go_To_Purge_Location
# set fan speed for wiping
# M106 S{Sf}
# wait for fan to cool filament if needed
# {% if wait_for_fan %}
# G4 P800
# {% endif %}
# wipe nozzle
G1 X{Px + Wdx} Y{Py + Wdy} F12000
{% for i in range(Wc) %}
G1 X{Px} Y{Py} F{Sw}
G1 X{Px + Wdx} Y{Py + Wdy} F{Sw}
{% endfor %}
# move away from wiper
G1 X{Pxe + Wdx} Y{Pye + Wdy} F{Se}
# restore fan speed
# M106 S{old_Sf}
RESTORE_GCODE_STATE NAME=Wipe_Nozzle_state
# Purge material into the bucket
[gcode_macro Purge]
description: Extrude into the purge bucket and wipe the nozzle
# params:
# FEED_AMOUNT: length of material in mm to purge
# MAX_FEED: max extrude length for a single purge strip. Set to -1 to disable length limit.
gcode:
{% set FEED_AMOUNT = params.FEED_AMOUNT|default(50.0)|float %}
{% set MAX_FEED = params.MAX_FEED|default(20.0)|float %}
{% set Sp = printer["gcode_macro Nozzle_Wiper_Variables"].purge_speed * 60 %}
SAVE_GCODE_STATE NAME=Purge_state
# make sure FEED_AMOUNT is at least 3 to avoid negative E movements
{% if FEED_AMOUNT < 3 %}
{% set FEED_AMOUNT = 3 %}
{% endif %}
# go to purge location
Go_To_Purge_Location
# relative extrusion
M83
# if extrude length is unlimited, purge a single strip
{% if MAX_FEED == -1 %}
# extrude
G1 E{FEED_AMOUNT - 3} F{Sp}
G1 E3 F100
# else purge multiple smaller strips
{% else %}
{% for i in range(((FEED_AMOUNT - 3) / MAX_FEED)|int) %}
# go to purge location
Go_To_Purge_Location
# extrude
G1 E{MAX_FEED - 3} F{Sp}
G1 E3 F100
# wait
G4 P800
# wipe the nozzle
Wipe_Nozzle
{% endfor %}
# purge remainder
{% set remainder = (FEED_AMOUNT - 3)|int % MAX_FEED|int %}
Go_To_Purge_Location
G1 E{remainder} F{Sp}
G1 E3 F100
{% endif %}
# reset E position
G92 E0.0
# wait
G4 P800
# wipe the nozzle
Wipe_Nozzle
RESTORE_GCODE_STATE NAME=Purge_state
[gcode_macro Save_Pressure_Advance]
# call this in your print start gcode after setting PA for the print
# (only necessary if the slicer inserts ramming gcode that sets PA to 0)
description: Save the current pressure advance value
# don't change any of the variables below this line
variable_pa: -1
gcode:
# save PA if it is not 0
{% set pa = printer.extruder.pressure_advance %}
{% if pa > 0 %}
SET_GCODE_VARIABLE MACRO=Save_Pressure_Advance VARIABLE=pa VALUE={pa}
{% endif %}
[gcode_macro Restore_Pressure_Advance]
description: Restore saved pressure advance value
gcode:
# restore PA if a previous value was saved
{% if not (printer["gcode_macro Save_Pressure_Advance"].pa == -1) %}
SET_PRESSURE_ADVANCE ADVANCE={printer["gcode_macro Save_Pressure_Advance"].pa}
{% endif %}
[gcode_macro Shape_Tip]
description: Perform tip-shaping, retraction, and cooling moves
gcode:
SAVE_GCODE_STATE NAME=Shape_Tip_state
Save_Pressure_Advance
M83 # extruder relative mode
# gcode generated by SuperSlicer, with XY moves removed
;--------------------
; CP TOOLCHANGE START
; toolchange #1
; material : PLA -> PLA
;--------------------
M220 S100
; CP TOOLCHANGE UNLOAD
;WIDTH:0.65
# G1 X66.273 Y170.819
SET_PRESSURE_ADVANCE ADVANCE=0
G1 F68
G1 E0.2816
G1 F73
G1 E0.3051
G1 F83
G1 E0.3453
G1 F96
G1 E0.399
G1 F114
G1 E0.4761
G1 F138
G1 E0.5767
G1 F163
G1 E0.5691
# G1 Y170.039 F7200
G1 F162
G1 E0.1081
G1 F196
G1 E0.7644
G1 F186
G1 E0.8248
G1 F203
G1 E0.8483
;WIDTH:0.5
G1 E-15 F6000
G1 E-15.4 F5400
G1 E-4.4 F2700
G1 E-2.2 F1620
# G1 Y169.259
G1 E14 F1200
G1 E-14
G1 E14
G1 E-14
G1 E14
G1 E-14
G1 E14
G1 E-14
; SKINNYDIP START
G1 E24 F1980
G4 P0
G1 E-24 F4200
G4 P0
; SKINNYDIP END
G1 F2000
# G1 Y169.399 F2400
G4 S0
; custom gcode: end_filament_gcode
; Filament-specific end gcode
;END gcode for filament
; custom gcode end: end_filament_gcode
Restore_Pressure_Advance
RESTORE_GCODE_STATE NAME=Shape_Tip_state