forked from zellneralex/klipper_config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfilament.cfg
289 lines (282 loc) · 12.8 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
# SET_RETRACTION [RETRACT_LENGTH=<mm>] [RETRACT_SPEED=<mm/s>] [UNRETRACT_EXTRA_LENGTH=<mm>] [UNRETRACT_SPEED=<mm/s>]
# SET_RETRACTION is commonly set as part of slicer per-filament configuration, as different filaments require different
# parameter settings.
# GET_RETRACTION Queries the current parameters used by firmware retraction and displays them on
[firmware_retraction]
# The length of filament (in mm) to retract when G10 is activated,
# and to unretract when G11 is activated
retract_length: 0.75
# The length (in mm) of *additional* filament to add when
# unretracting.
unretract_extra_length: 0
retract_speed: 70
unretract_speed: 40
#####################################################################
# Macro
#####################################################################
[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 FILAMENT_LOAD]
description: Load filament and disable rounout while running
gcode:
##### get user defines #####
{% set add_temp = printer['gcode_macro _USER_VARIABLE'].extruder_min_add|int %}
{% set load = printer['gcode_macro _USER_VARIABLE'].load_distance %}
{% set extrude = printer['gcode_macro _USER_VARIABLE'].load_extrude %}
{% set retreact = printer['gcode_macro _USER_VARIABLE'].retreact_end|float * -1 %}
{% set purge_pos = printer['gcode_macro _USER_VARIABLE'].purge %}
{% set z_hop = printer['gcode_macro _USER_VARIABLE'].z_hop %}
##### get hardware enables #####
{% set ena_neo = printer['gcode_macro _USER_VARIABLE'].neo_display|lower %}
{% set ena_runout = printer['gcode_macro _USER_VARIABLE'].runout|lower %}
##### get toolhead position #####
{% set act_z = printer.toolhead.position.z|float %}
##### store extruder temps #####
{% set minTemp = printer.configfile.settings.extruder.min_extrude_temp|int + add_temp %}
{% set extruder_target = printer.extruder.target %}
##### calc movement high #####
{% if act_z < z_hop %}
{% set move_z = z_hop %}
{% else %}
{% set move_z = act_z %}
{% 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
{% if ena_runout == 'motion' %}
SET_FILAMENT_SENSOR SENSOR=runout ENABLE=0
{% endif %}
## Move to waste bin
_CG28 ; home if not already homed
G90 ; absolute positioning
G1 Z{move_z} F1800 ; move head to minimum
G1 X{purge_pos[0]} Y{purge_pos[1]} F9000 ; move to purge bucket location
{% if ena_neo == 'true' %} _LCD_KNOB COLOR=BLUE {% endif %}
{% if printer.extruder.can_extrude|lower == 'false' %}
{action_respond_info("Extruder Temp to low heat to %2dC" % minTemp)}
M109 S{minTemp} ; heat extruder and wait
{% endif %}
{% if ena_neo == 'true' %} _LCD_KNOB COLOR=RESTORE {% endif %}
G1 Z{purge_pos[2]} F1800
M83 ; set extruder to relative
G1 E{load} F1800 ; quickly load 90mm filament
G1 E{extrude} F300 ; slower extrusion for hotend path
G1 E{retreact} F1000 ; retract
SAVE_VARIABLE VARIABLE=filament_loaded VALUE='"true"'
# clean nozzle
_WIPE
G1 Z{move_z} F1800
G1 X{purge_pos[0]} Y{purge_pos[1]} F9000 ; move to purge bucket location
# restore old extruder temperature
M109 S{extruder_target}
{% if ena_runout == 'motion' %}
_PRINT_AR T="RUNOUT Motion Sensor Enable: true"
SET_FILAMENT_SENSOR SENSOR=runout ENABLE=1
{% endif %}
_PRINT_AR T="Filament loaded"
RESTORE_GCODE_STATE NAME=STATE_LOAD_FILAMENT
{% else %}
_PRINT_AR T="Filament loading disabled while printing!"
{% endif %}
[gcode_macro FILAMENT_UNLOAD]
description: Unload filament and disable rounout while running
gcode:
##### get user defines #####
{% set add_temp = printer['gcode_macro _USER_VARIABLE'].extruder_min_add|int %}
{% set unload = printer['gcode_macro _USER_VARIABLE'].unload_distance %}
##### get hardware enables #####
{% set ena_neo = printer['gcode_macro _USER_VARIABLE'].neo_display|lower %}
{% set ena_runout = printer['gcode_macro _USER_VARIABLE'].runout|lower %}
##### store extruder temps #####
{% set minTemp = printer.configfile.settings.extruder.min_extrude_temp|int + add_temp %}
{% set extruder_target = printer.extruder.target %}
##### end of definitions #####
{% if printer.idle_timeout.state != "Printing" or printer.pause_resume.is_paused|lower == "true" %}
SAVE_GCODE_STATE NAME=STATE_UNLOAD_FILAMENT
{% if ena_runout == 'motion' %}
_PRINT_AR T="RUNOUT Motion Sensor Enable: false"
SET_FILAMENT_SENSOR SENSOR=runout ENABLE=0
{% endif %}
{% if ena_neo == 'true' %} _LCD_KNOB COLOR=BLUE {% endif %}
{% if printer.extruder.can_extrude|lower == 'false' %}
{action_respond_info("Extruder Temp to low heat to %2dC" % minTemp)}
M109 S{minTemp} ; heat extruder and wait
{% endif %}
# Ball up the filament tip and retract out past the extruder gears
{% if ena_neo == 'true' %} _LCD_KNOB COLOR=RESTORE {% endif %}
_FILAMENT_BALL WAIT=3
M83 ; Relative extrusion
G1 E-{unload} F3000
M400
SAVE_VARIABLE VARIABLE=filament_loaded VALUE='"false"'
# restore old extruder temperature
M109 S{extruder_target}
_PRINT_AR T="Filament unloaded"
RESTORE_GCODE_STATE NAME=STATE_UNLOAD_FILAMENT
{% else %}
_PRINT_AR T="Filament unloading disabled while printing!"
{% endif %}
## purge and clean the nozzle in prep for printing
[gcode_macro NOZZLECLEAN]
description: Move to bucket and scrub nozzle
gcode:
##### get user defines #####
{% set add_temp = printer['gcode_macro _USER_VARIABLE'].extruder_min_add|int %}
{% set purge_pos = printer['gcode_macro _USER_VARIABLE'].purge %}
{% set z_hop = printer['gcode_macro _USER_VARIABLE'].z_hop %}
##### store extruder temps #####
{% set minTemp = printer.configfile.settings.extruder.min_extrude_temp|int + add_temp %}
{% set extruder_target = printer.extruder.target %}
##### get toolhead position #####
{% set act_z = printer.toolhead.position.z|float %}
##### end of definitions #####
SAVE_GCODE_STATE Name=STATE_NOZZLECLEAN
_PRINT_AR T="Clean Nozzle" SHOW_LCD=true
_CG28 ; home if not already homed
G90 ; absolute positioning
{% if act_z < z_hop %}
G1 Z{z_hop} F900 ; move head up
{% endif %}
G1 X{purge_pos[0]} Y{purge_pos[1]} F9000 ; move to purge bucket location
{% if printer.extruder.can_extrude|lower == 'false' %}
{action_respond_info("Extruder Temp to low heat to %2dC" % minTemp)}
M109 S{minTemp} ; heat extruder and wait
{% endif %}
G1 Z{purge_pos[2]} F900 ; lower Z
G92 E0 ; reset Extruder
M83 ; relative extrusion
G1 E5.00 F500 ; purge filament (5mm)
G1 E5.00 F800 ; purge filament (5mm)
G1 E-0.5 F800 ; retract filament (0.5)
G4 P500
_WIPE
# restore old extruder temperature
M109 S{extruder_target}
UPDATE_DELAYED_GCODE ID=_CLEAR_DISPLAY DURATION=1
RESTORE_GCODE_STATE Name=STATE_NOZZLECLEAN
[gcode_macro _WIPE]
description: Helper: Wipe nozzle at bucket
gcode:
##### get user defines #####
{% set wipe_cnt = printer['gcode_macro _USER_VARIABLE'].wipe_cnt|int %}
{% set wipe_start_pos = printer['gcode_macro _USER_VARIABLE'].wipe_start %}
{% set wipe_end_pos = printer['gcode_macro _USER_VARIABLE'].wipe_end %}
{% set wipe_offset = printer['gcode_macro _USER_VARIABLE'].wipe_offset|float %}
##### end of definitions #####
G90 ; absolute positioning
G0 X{wipe_start_pos[0]} Y{wipe_start_pos[1]} Z{wipe_start_pos[2]} F4000
# move head diagonal to brush
{% for wipe in range(0, wipe_cnt) %}
{% for coordinate in [wipe_start_pos[0], wipe_end_pos[0]] %}
G0 X{coordinate} Y{wipe_start_pos[1] + wipe_offset * wipe} F4000
{% endfor %}
{% endfor %}
G0 X{wipe_end_pos[0]} Y{wipe_end_pos[1]} Z{wipe_end_pos[2]} F4000
[gcode_macro PRIME_LINE]
description: Purge nozzle front left
gcode:
##### get user defines #####
{% set start_xy = printer['gcode_macro _USER_VARIABLE'].prime_start_xy %}
{% set dir = printer['gcode_macro _USER_VARIABLE'].prime_dir|string %}
{% set lenght = printer['gcode_macro _USER_VARIABLE'].prime_lenght|float %}
{% set seg = printer['gcode_macro _USER_VARIABLE'].prime_seg|int %}
{% set extrude_per_seg = printer['gcode_macro _USER_VARIABLE'].prime_extrude_per_seg|float %}
{% set prime_z = printer['gcode_macro _USER_VARIABLE'].prime_z|float %}
{% set move_between_lines = printer['gcode_macro _USER_VARIABLE'].prime_dist|float %}
{% set z_hop = printer['gcode_macro _USER_VARIABLE'].z_hop|float %}
##### get parameter and set default #####
{% set prime_height = params.PRIME_HEIGHT|default(prime_z)|float %}
##### get toolhead position #####
{% set act_z = printer.toolhead.position.z|float %}
##### calculate prime line moves #####
{% set seg_delta = lenght / seg %}
{% if dir == 'X+' %}
{% set first_line = 'X%s E%s F1500' % (seg_delta, extrude_per_seg) %}
{% set second_line = 'X-%s E%s F1500' % (seg_delta, extrude_per_seg) %}
{% set move_to_side = 'Y%s' % (move_between_lines) %}
{% elif dir == 'X-' %}
{% set first_line = 'X-%s E%s F1500' % (seg_delta, extrude_per_seg) %}
{% set second_line = 'X%s E%s F1500' % (seg_delta, extrude_per_seg) %}
{% set move_to_side = 'Y%s' % (move_between_lines) %}
{% elif dir == 'Y+' %}
{% set first_line = 'Y%s E%s F1500' % (seg_delta, extrude_per_seg) %}
{% set second_line = 'Y-%s E%s F1500' % (seg_delta, extrude_per_seg) %}
{% set move_to_side = 'X%s' % (move_between_lines) %}
{% elif dir == 'Y-' %}
{% set first_line = 'Y-%s E%s F1500' % (seg_delta, extrude_per_seg) %}
{% set second_line = 'Y%s E%s F1500' % (seg_delta, extrude_per_seg) %}
{% set move_to_side = 'X%s' % (move_between_lines) %}
{% else %}
{action_raise_error("_USER_VARIABLE.prime_dir is not spezified as X+, X-, Y+ or Y-")}
{% endif %}
##### end of definitions #####
_PRINT_AR T="Prime Line" SHOW_LCD=true
_CG28 ; home if not already homed
G92 E0 ; reset Extruder
G90 ; absolute positioning
{% if act_z < z_hop %}
G1 Z{z_hop} F900 ; move head up
{% endif %}
G1 X{start_xy[0]} Y{start_xy[1]} F18000 ; move to start position
G1 Z{prime_height} F900 ; move Z Axis down
G91 ; relative positioning
{% for segment in range(seg) %} ; draw the first line
G1 {first_line}
{% endfor %}
G1 {move_to_side} ; move to side
{% for segment in range(seg) %} ; draw the second line
G1 {second_line}
{% endfor %}
G1 Z{z_hop} F1500 ; move Z Axis up
G92 E0 ; reset Extruder
UPDATE_DELAYED_GCODE ID=_CLEAR_DISPLAY DURATION=1
[gcode_macro SELECT_PA]
description: Set PA depending on nozzle and filament
gcode:
##### set default parameter values #####
{% set nozzle = params.NOZZLE|default(0.4)|float %}
{% set filament = params.FILAMENT|default('None')|string %}
##### Pressure Advance values for different filaments & nozzles #####
{% set pa_def = [('ESUN_ABS+_Black', 0.4, 0.05),
('KVP_ABS_FL_Blue', 0.4, 0.05)] %}
#######################################################################
{% set elem_cnt = pa_def|length %}
{% set ns = namespace(index = elem_cnt) %}
{% for index in range(elem_cnt) %}
{% if pa_def[index][0]|lower == filament|lower and pa_def[index][1]|float == nozzle %}
{% set ns.index = index %}
{% endif %}
{% endfor %}
{% if ns.index < elem_cnt %}
{% set elem_filament = pa_def[ns.index][0]|string %}
{% set elem_nozzle = pa_def[ns.index][1]|float %}
{% set elem_pa = pa_def[ns.index][2]|float %}
{% else %}
{% set elem_filament = 'default' %}
{% set elem_nozzle = 0.4 %}
{% set elem_pa = printer.configfile.settings['extruder'].pressure_advance|float %}
{% endif %}
##### end of definitions #####
SET_PRESSURE_ADVANCE ADVANCE={elem_pa}
{action_respond_info("PRESSURE_ADVANCE:
FILAMENT: %s
NOZZLE: %1.1f
VALUE: %.4f" % (elem_filament, elem_nozzle, elem_pa))}