-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmacros_dual_extruder.cfg
454 lines (432 loc) · 26.3 KB
/
macros_dual_extruder.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
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
###################################################################
# Script Name : "macros_dual_extruder.cfg"
# Description : Adds print macros for Dual Extruders.
# With
# -Unload Distance in mm for Y-Adapeter (1 Hot-End with 1 Nozzle and 2 Extruders)
# -filament Sensor controle case
# -load/unload status with save over power lose (in {klipper_config}/variables.cfg)
# -Case for controle Pause by Extruder switch event
#
# Author : Alexander Koehler
# Email : [email protected]
# Date : 22.01.2022
###################################################################
# Receive Call for first extruder
[gcode_macro T0]
description: Receive Call for first extruder - LOAD: 1 # Value of 1 will Unload other extruders and load this one
#default_parameter_LOAD: 1 # Value of 1 will Unload other extruders and load this one
gcode:
{% set LOAD = params.LOAD|default(1)|int %} # Value of 1 will Unload other extruders and load this one
{ action_respond_info("T0 %s" % (LOAD)) }
{% if 'SKIP_PAUSE' not in params and printer["gcode_macro EXTRUDER_VARS"].pause_change_all == 1 %}
FILAMENT_CHANGE TOOL=0
{% else %}
{% if (printer["gcode_macro EXTRUDER_VARS"].extr0_sensor == 1) %}
SET_FILAMENT_SENSOR SENSOR=fsensor0 ENABLE=1 # enable filament sensor
{% endif %}
{% if (printer["gcode_macro EXTRUDER_VARS"].extr1_sensor == 1) %}
SET_FILAMENT_SENSOR SENSOR=fsensor1 ENABLE=0 # disable filament sensor
{% endif %}
{% if (LOAD|int) == 0 %}
ACTIVATE_EXTRUDER EXTRUDER=extruder # Else just select extruder
{% else %}
SWAP_EXTRUDER EXTR=extruder # Unload active and load this extruder
{% endif %}
M117 T0 Active
EXTRUDER_CONFIG ACTIVE_EXTRUDER=0
UPDATE_DELAYED_GCODE ID=CLEAR_MSG DURATION=30
{% endif %}
# Receive Call for second extruder
[gcode_macro T1]
description: Receive Call for second extruder - LOAD: 1 # Value of 1 will Unload other extruders and load this one
#default_parameter_LOAD: 1 # Value of 1 will Unload other extruders and load this one
gcode:
{% set LOAD = params.LOAD|default(1)|int %} # Value of 1 will Unload other extruders and load this one
{ action_respond_info("T1 %s" % (LOAD)) }
{% if 'SKIP_PAUSE' not in params and printer["gcode_macro EXTRUDER_VARS"].pause_change_all == 1 %}
FILAMENT_CHANGE TOOL=1
{% else %}
{% if (printer["gcode_macro EXTRUDER_VARS"].extr1_sensor == 1) %}
SET_FILAMENT_SENSOR SENSOR=fsensor1 ENABLE=1 # enable filament sensor
{% endif %}
{% if (printer["gcode_macro EXTRUDER_VARS"].extr0_sensor == 1) %}
SET_FILAMENT_SENSOR SENSOR=fsensor0 ENABLE=0 # disable filament sensor
{% endif %}
{% if (LOAD|int) == 0 %}
ACTIVATE_EXTRUDER EXTRUDER=extruder1 # Else just select extruder
{% else %}
SWAP_EXTRUDER EXTR=extruder1 # Unload active and load this extruder
{% endif %}
M117 T1 active
EXTRUDER_CONFIG ACTIVE_EXTRUDER=1
UPDATE_DELAYED_GCODE ID=CLEAR_MSG DURATION=30
{% endif %}
# Swap Extruders
[gcode_macro SWAP_EXTRUDER]
description: Swap Extruders with "Extruder" to switch to - params.EXTR|default("extruder") ["extruder","extruder1"]
#default_parameter_EXTR: extruder # Extruder to switch to
gcode:
{% set EXTR = params.EXTR|default("extruder")|string %} # Extruder to switch to
{ action_respond_info("SWAP_EXTRUDER params.EXTR=%s" % (EXTR)) }
{% if (printer.toolhead.extruder) != (EXTR) %}
SAVE_GCODE_STATE NAME=swap_state
# if axes are homed and we don't want to swap middle of print
{% if (printer.toolhead.homed_axes) and (printer["gcode_macro EXTRUDER_VARS"].swap_move == 1) %}
G90
G1 X2 Y2 F2000 # Move to down right corner
{% elif (printer.toolhead.homed_axes) and (printer["gcode_macro EXTRUDER_VARS"].swap_move == 2) %}
G90 X2 F2000 # just move right
{% endif %}
M117 Unloading
Unload_{printer.toolhead.extruder}
M117 Loading
LOAD_{EXTR}
RESTORE_GCODE_STATE NAME=swap_state
{% endif %}
[gcode_macro UNLOAD_extruder]
description: Unload Extruder(0)
gcode:
{ action_respond_info("UNLOAD_extruder ev.extr0_unload=%s" % (printer["gcode_macro EXTRUDER_VARS"].extr0_unload)) }
{% if not printer["gcode_macro EXTRUDER_VARS"].extr0_unload == 1 %}
RESPOND MSG="Unloading Extruder0"
UNLOAD_EXTR
EXTRUDER_CONFIG UNLOAD_EXT0=1
EXTRUDER_CONFIG LOAD_EXT0=0
{% else %}
RESPOND MSG="Extruder0 already unloaded"
{% endif %}
[gcode_macro UNLOAD_extruder1]
description: Unload Extruder1
gcode:
{ action_respond_info("UNLOAD_extruder1 ev.extr1_unload=%s" % (printer["gcode_macro EXTRUDER_VARS"].extr1_unload)) }
{% if not printer["gcode_macro EXTRUDER_VARS"].extr1_unload == 1 %}
RESPOND MSG="Unloading Extruder1"
UNLOAD_EXTR
EXTRUDER_CONFIG UNLOAD_EXT1=1
EXTRUDER_CONFIG LOAD_EXT1=0
{% else %}
RESPOND MSG="Extruder1 already unloaded"
{% endif %}
[gcode_macro LOAD_extruder]
description: Load Extruder(0)
gcode:
{ action_respond_info("LOAD_extruder ev.extr0_unload=%s ev.extr1_unload=%s" % (printer["gcode_macro EXTRUDER_VARS"].extr0_unload, printer["gcode_macro EXTRUDER_VARS"].extr1_unload)) }
{% if printer["gcode_macro EXTRUDER_VARS"].extr0_unload == 1 %}
{% if printer["gcode_macro EXTRUDER_VARS"].extr1_unload == 0 %}
ACTIVATE_EXTRUDER EXTRUDER=extruder1
UNLOAD_extruder1
{% endif %}
ACTIVATE_EXTRUDER EXTRUDER=extruder
RESPOND MSG="Loading Extruder0"
LOAD_EXTR
EXTRUDER_CONFIG ACTIVE_EXTRUDER=0
EXTRUDER_CONFIG UNLOAD_EXT0=0
EXTRUDER_CONFIG LOAD_EXT0=1
{% else %}
RESPOND MSG="Extruder0 already Loaded"
{% endif %}
[gcode_macro LOAD_extruder1]
description: Load Extruder1
gcode:
{ action_respond_info("LOAD_extruder1 ev.extr0_unload=%s ev.extr1_unload=%s" % (printer["gcode_macro EXTRUDER_VARS"].extr0_unload, printer["gcode_macro EXTRUDER_VARS"].extr1_unload)) }
{% if printer["gcode_macro EXTRUDER_VARS"].extr1_unload == 1 %}
{% if printer["gcode_macro EXTRUDER_VARS"].extr0_unload == 0 %}
ACTIVATE_EXTRUDER EXTRUDER=extruder
UNLOAD_extruder
{% endif %}
ACTIVATE_EXTRUDER EXTRUDER=extruder1
RESPOND MSG="Loading Extruder1"
LOAD_EXTR
EXTRUDER_CONFIG ACTIVE_EXTRUDER=1
EXTRUDER_CONFIG UNLOAD_EXT1=0
EXTRUDER_CONFIG LOAD_EXT1=1
{% else %}
RESPOND MSG="Extruder1 already Loaded"
{% endif %}
# Load active Extruder
[gcode_macro LOAD_EXTR]
description: Load active Extruder with filament
gcode:
{ action_respond_info("LOAD_EXTR UD.dist=%s" % (printer["gcode_macro UNLOAD_DISTANCE"].dist)) }
SAVE_GCODE_STATE NAME=load_state
M117 LOAD_EXTR UNLOAD_DISTANCE={((printer["gcode_macro UNLOAD_DISTANCE"].dist)|int)}
G92 E0
M83
# Using this variable makes sure load and unload move the same amount
# last 50mm going in are slowed down (reason they are subtracted)
# Change unload position amount in variables_user.cfg
{% for i in range(((((printer["gcode_macro UNLOAD_DISTANCE"].dist)|int)-50)/100)|int) %}
G1 E100 F3000
RESPOND MSG={(((((printer["gcode_macro UNLOAD_DISTANCE"].dist)|int)-50)/100)|int)}
{% endfor %}
G1 E{(((printer["gcode_macro UNLOAD_DISTANCE"].dist)|int)-50)%100} F5000
RESPOND MSG={(((printer["gcode_macro UNLOAD_DISTANCE"].dist)|int)-50)%100}
G1 E30 F1000
G1 E20 F300
RESPOND MSG="50"
M82
RESTORE_GCODE_STATE NAME=load_state
# Call to pull filament to unload position
[gcode_macro UNLOAD_EXTR]
description: Call to pull filament to unload position
#default_parameter_RAM: 10
gcode:
{% set RAM = params.RAM|default(10)|float %}
{ action_respond_info("UNLOAD_EXTR params.RAM=%s UD.dist=%s" % (RAM, printer["gcode_macro UNLOAD_DISTANCE"].dist)) }
SAVE_GCODE_STATE NAME=unload_state
M117 UNLOAD_EXTR RAM={RAM} UNLOAD_DISTANCE={((printer["gcode_macro UNLOAD_DISTANCE"].dist)|int)}
G92 E0
G91 # relative positioning
M83
#G1 E{RAM} F300 # Ramming to help shape end
# See LOAD_EXTR for details of this segment
{% for i in range((((printer["gcode_macro UNLOAD_DISTANCE"].dist)|int)/100)|int) %}
G1 E-100 F3000
{% endfor %}
{% if (((printer["gcode_macro UNLOAD_DISTANCE"].dist)|int)%100) > 0 %}
G1 E{(((printer["gcode_macro UNLOAD_DISTANCE"].dist)|int)%100)*(-1)} F5000
{% endif %}
#G1 E-{RAM} F5000 #to account for the ramming filament
M82
G90 # absolute positioning
RESTORE_GCODE_STATE NAME=unload_state
[gcode_macro PURGE_EXTRUDER]
description: PURGE EXTRUDER
gcode:
{ action_respond_info("PURGE_EXTRUDER ") }
SAVE_GCODE_STATE NAME=purge_ext
M117 PURGE_EXTRUDER
M83
G1 E10 F200
RESTORE_GCODE_STATE NAME=purge_ext
# Call at beginning of print to setup extruders
[gcode_macro PREP_EXTRUDERS]
description: Call at beginning of print to setup extruders
gcode:
{ action_respond_info("PREP_EXTRUDERS Prep_Extruders=%s EV.num_extruders=%s toolhead.homed_axes=%s" % (printer["gcode_macro EXTRUDER_VARS"].start_prep_extruders, printer["gcode_macro EXTRUDER_VARS"].num_extruders, printer.toolhead.homed_axes)) }
{% if printer["gcode_macro EXTRUDER_VARS"].start_prep_extruders == 1 %} # If start with prep_extruders macro
M117 Prep Extruder(s)
M117 Anzahl Extruder: {((printer["gcode_macro EXTRUDER_VARS"].num_extruders)|int)}
SAVE_GCODE_STATE NAME=prep_extruders # restore any states
{% if (printer.toolhead.homed_axes) %}
G90
G1 X1 Y1 F2000 # G1 X235 Y-5 F2000
{% endif %}
{% if printer["gcode_macro EXTRUDER_VARS"].num_extruders > 1 %} # If second extruder present
M117 Multi Extruder erkannt!
{% if (printer["gcode_macro EXTRUDER_VARS"].extr1_sensor == 1) %}
SET_FILAMENT_SENSOR SENSOR=fsensor1 ENABLE=1 # enable filament sensor
{% endif %}
T1 LOAD=0 SKIP_PAUSE=1 # activate extruder1 without moving extruder0
M117 Extruder1 active
LOAD_EXTR
PURGE_EXTRUDER # Purge a little, clean out old color
UNLOAD_EXTR
EXTRUDER_CONFIG UNLOAD_EXT1=1
{% endif %}
{% if (printer["gcode_macro EXTRUDER_VARS"].extr0_sensor == 1) %}
SET_FILAMENT_SENSOR SENSOR=fsensor0 ENABLE=1 # enable filament sensor
{% endif %}
T0 LOAD=0 SKIP_PAUSE=1 # activate extruder without event triggers
M117 extruder active
LOAD_EXTR
PURGE_EXTRUDER
EXTRUDER_CONFIG UNLOAD_EXT0=0
RESTORE_GCODE_STATE NAME=prep_extruders
{% else %} # If start without prep_extruders macro
M117 NO Prep Extruder(s)
{% endif %}
# Variables responsible for maintaining extruder states
[gcode_macro EXTRUDER_VARS]
description: Variables responsible for maintaining extruder states
variable_num_extruders: 1
variable_ext1_bkup: 0
variable_swap_move: 0
variable_extr0_unload: 0
variable_extr1_unload: 1
variable_extr0_load: 1
variable_extr1_load: 0
variable_extr0_sensor: 0
variable_extr1_sensor: 0
variable_pause_change_all: 0
variable_extr_active: 0
variable_start_prep_extruders: 0
gcode:
{ action_respond_info("EXTRUDER_VARS") }
RESPOND TYPE=echo MSG="NUM Extruders = {num_extruders}"
RESPOND TYPE=echo MSG="EXT1 as Backup = {ext1_bkup}"
RESPOND TYPE=echo MSG="Pause on Tool change = {pause_change_all}"
RESPOND TYPE=echo MSG="Swap move set to = {swap_move}"
RESPOND TYPE=echo MSG="Extr0 unload State = {extr0_unload}"
RESPOND TYPE=echo MSG="Extr1 unload State = {extr1_unload}"
RESPOND TYPE=echo MSG="Extr0 Fila-Sensor = {extr0_sensor}"
RESPOND TYPE=echo MSG="Extr1 Fila-Sensor = {extr1_sensor}"
RESPOND TYPE=echo MSG="Extr active = {extr_active}"
RESPOND TYPE=echo MSG="Extr Start with prep_extruders = {start_prep_extruders}"
# Nozzle length 13mm, White PTFE tube length is 27mm, Blue PTFE is 38mm long to split
[gcode_macro UNLOAD_DISTANCE]
description: Unload Distance - Nozzle length 13mm, White PTFE tube length is 27mm, Blue PTFE is 38mm long to split
variable_dist: 80
gcode:
{% set ULDIST = params.ULDIST|default(80)|float %}
{ action_respond_info("UNLOAD_DISTANCE params.ULDIST=%s" % (ULDIST)) }
#SET_GCODE_VARIABLE MACRO=EXTRUDER_VARS VARIABLE=unload_dist VALUE={ULDIST}
SET_GCODE_VARIABLE MACRO=UNLOAD_DISTANCE VARIABLE=dist VALUE={ULDIST}
SAVE_VARIABLE VARIABLE=unload_distance VALUE={ULDIST}
RESPOND MSG="UNLOAD_DISTANCE: {ULDIST}"
#RESPOND MSG="UNLOAD_DISTANCE.dist: {(printer["gcode_macro UNLOAD_DISTANCE"].dist)}"
#RESPOND MSG="EXTRUDER_VARS.unload_dist: {((printer["gcode_macro EXTRUDER_VARS"].unload_dist)|float)}"
# NOT REQUIRED Get extruder values from slicer, set in custom G-code. Also used to set unload states
[gcode_macro EXTRUDER_CONFIG]
description: NOT REQUIRED Get extruder values from slicer, set in custom G-code. Also used to set unload states
gcode:
{% set EXTRUDERS = params.EXTRUDERS|default(2)|int %} # Slicer declares num extruders
{% set RUNOUT_BACKUP = params.RUNOUT_BACKUP|default(0)|int %} # Slicer declares if T1 is runout backup for T0
{% set SWAP_MOVE = params.SWAP_MOVE|default(1)|int %} # Slicer declares if swap happens within print
{% set PAUSE_CHANGE_ALL = params.PAUSE_CHANGE_ALL|default(0)|int %} # Slicer declares pausing for filament changes
{% set UNLOAD_EXT0 = params.UNLOAD_EXT0|default(0)|int %} # Load/Unload status from Extruder0
{% set UNLOAD_EXT1 = params.UNLOAD_EXT1|default(1)|int %} # Load/Unload status from Extruder1
{% set LOAD_EXT0 = params.LOAD_EXT0|default(1)|int %} # Load/Unload status from Extruder0
{% set LOAD_EXT1 = params.LOAD_EXT1|default(0)|int %} # Load/Unload status from Extruder1
{% set SENSOR_EXT0 = params.SENSOR_EXT0|default(0)|int %} # Extruder0 Fila Sensor (Enable) 0=false, 1=true
{% set SENSOR_EXT1 = params.SENSOR_EXT1|default(0)|int %} # Extruder1 Fila Sensor (Enable) 0=false, 1=true
{% set UNLOAD_DISTANCE = params.UNLOAD_DISTANCE|default(80)|int %} # Unload Distance in mm for Y-Adapeter (1 Hot-End with 1 Nozzle and 2 Extruders)
{% set ACTIVE_EXTRUDER = params.ACTIVE_EXTRUDER|default(0)|int %} # Status from active Extruder
{% set START_PREP_EXTRUDERS = params.START_PREP_EXTRUDERS|default(0)|int %} # START with PREP_EXTRUDERS macro
{ action_respond_info("EXTRUDER_CONFIG EXTRUDERS=%s RUNOUT_BACKUP=%s SWAP_MOVE=%s PAUSE_CHANGE_ALL=%s UNLOAD_EXT0=%s UNLOAD_EXT1=%s LOAD_EXT0=%s LOAD_EXT1=%s UNLOAD_DISTANCE=%s SENSOR_EXT0=%s SENSOR_EXT1=%s ACTIVE_EXTRUDER=%s START_PREP_EXTRUDERS=%s" % (EXTRUDERS, RUNOUT_BACKUP, SWAP_MOVE, PAUSE_CHANGE_ALL, UNLOAD_EXT0, UNLOAD_EXT1, LOAD_EXT0, LOAD_EXT1, UNLOAD_DISTANCE, SENSOR_EXT0, SENSOR_EXT1, ACTIVE_EXTRUDER, START_PREP_EXTRUDERS)) }
{% if 'EXTRUDERS' in params %}
RESPOND TYPE=echo MSG="NUM Extruders = {params.EXTRUDERS|int}"
SET_GCODE_VARIABLE MACRO=EXTRUDER_VARS VARIABLE=num_extruders VALUE={params.EXTRUDERS|int}
SAVE_VARIABLE VARIABLE=num_extruders VALUE={params.EXTRUDERS|int}
{% endif %}
{% if 'RUNOUT_BACKUP' in params %}
RESPOND TYPE=echo MSG="EXT1 as Backup = {params.RUNOUT_BACKUP|int}"
SET_GCODE_VARIABLE MACRO=EXTRUDER_VARS VARIABLE=ext1_bkup VALUE={params.RUNOUT_BACKUP|int}
SAVE_VARIABLE VARIABLE=ext1_bkup VALUE={params.RUNOUT_BACKUP|int}
{% endif %}
{% if 'SWAP_MOVE' in params %}
RESPOND TYPE=echo MSG="Swap move set to = {params.SWAP_MOVE|int}"
SET_GCODE_VARIABLE MACRO=EXTRUDER_VARS VARIABLE=swap_move VALUE={params.SWAP_MOVE|int}
SAVE_VARIABLE VARIABLE=swap_move VALUE={params.SWAP_MOVE|int}
{% endif %}
{% if 'UNLOAD_EXT0' in params %}
RESPOND TYPE=echo MSG="EXT0 unload = {params.UNLOAD_EXT0|int}"
SET_GCODE_VARIABLE MACRO=EXTRUDER_VARS VARIABLE=extr0_unload VALUE={params.UNLOAD_EXT0|int}
SAVE_VARIABLE VARIABLE=extr0_unload VALUE={params.UNLOAD_EXT0|int}
{% endif %}
{% if 'UNLOAD_EXT1' in params %}
RESPOND TYPE=echo MSG="EXT1 unload = {params.UNLOAD_EXT1|int}"
SET_GCODE_VARIABLE MACRO=EXTRUDER_VARS VARIABLE=extr1_unload VALUE={params.UNLOAD_EXT1|int}
SAVE_VARIABLE VARIABLE=extr1_unload VALUE={params.UNLOAD_EXT1|int}
{% endif %}
{% if 'LOAD_EXT0' in params %}
RESPOND TYPE=echo MSG="EXT0 load = {params.LOAD_EXT0|int}"
SET_GCODE_VARIABLE MACRO=EXTRUDER_VARS VARIABLE=extr0_load VALUE={params.LOAD_EXT0|int}
SAVE_VARIABLE VARIABLE=extr0_load VALUE={params.LOAD_EXT0|int}
{% endif %}
{% if 'LOAD_EXT1' in params %}
RESPOND TYPE=echo MSG="EXT1 load = {params.LOAD_EXT1|int}"
SET_GCODE_VARIABLE MACRO=EXTRUDER_VARS VARIABLE=extr1_load VALUE={params.LOAD_EXT1|int}
SAVE_VARIABLE VARIABLE=extr1_load VALUE={params.LOAD_EXT1|int}
{% endif %}
{% if 'PAUSE_CHANGE_ALL' in params %}
RESPOND TYPE=echo MSG="Pause Tool Change = {params.PAUSE_CHANGE_ALL|int}"
SET_GCODE_VARIABLE MACRO=EXTRUDER_VARS VARIABLE=pause_change_all VALUE={params.PAUSE_CHANGE_ALL|int}
SAVE_VARIABLE VARIABLE=pause_change_all VALUE={params.PAUSE_CHANGE_ALL|int}
{% endif %}
{% if 'UNLOAD_DISTANCE' in params %}
RESPOND TYPE=echo MSG="UNLOAD_DISTANCE move set to = {params.UNLOAD_DISTANCE|float}"
SET_GCODE_VARIABLE MACRO=UNLOAD_DISTANCE VARIABLE=dist VALUE={params.UNLOAD_DISTANCE|float}
SAVE_VARIABLE VARIABLE=unload_distance VALUE={params.UNLOAD_DISTANCE|int}
{% endif %}
{% if 'SENSOR_EXT0' in params %}
RESPOND TYPE=echo MSG="EXT0 Sensor Enable set to = {params.SENSOR_EXT0|int}"
SET_GCODE_VARIABLE MACRO=EXTRUDER_VARS VARIABLE=extr0_sensor VALUE={params.SENSOR_EXT0|int}
SAVE_VARIABLE VARIABLE=extr0_sensor VALUE={params.SENSOR_EXT0|int}
{% endif %}
{% if 'SENSOR_EXT1' in params %}
RESPOND TYPE=echo MSG="EXT1 Sensor Enable set to = {params.SENSOR_EXT1|int}"
SET_GCODE_VARIABLE MACRO=EXTRUDER_VARS VARIABLE=extr1_sensor VALUE={params.SENSOR_EXT1|int}
SAVE_VARIABLE VARIABLE=extr1_sensor VALUE={params.SENSOR_EXT1|int}
{% endif %}
{% if 'ACTIVE_EXTRUDER' in params %}
RESPOND TYPE=echo MSG="Active Extruder Change = {params.ACTIVE_EXTRUDER|int}"
SET_GCODE_VARIABLE MACRO=EXTRUDER_VARS VARIABLE=extr_active VALUE={params.ACTIVE_EXTRUDER|int}
SAVE_VARIABLE VARIABLE=extr_active VALUE={params.ACTIVE_EXTRUDER|int}
{% endif %}
{% if 'START_PREP_EXTRUDERS' in params %}
RESPOND TYPE=echo MSG="Start with PREP_EXTRUDERS = {params.START_PREP_EXTRUDERS|int}"
SET_GCODE_VARIABLE MACRO=EXTRUDER_VARS VARIABLE=start_prep_extruders VALUE={params.START_PREP_EXTRUDERS|int}
SAVE_VARIABLE VARIABLE=start_prep_extruders VALUE={params.START_PREP_EXTRUDERS|int}
{% endif %}
#SAVE_CONFIG
# Set DEFAULT / Basic Parameters
[gcode_macro SET_DEFAULT]
description: Set DEFAULT / Basic Parameters
gcode:
{% set EXTRUDERS = params.EXTRUDERS|default(2)|int %} # Slicer declares num extruders
{% set RUNOUT_BACKUP = params.RUNOUT_BACKUP|default(0)|int %} # Slicer declares if T1 is runout backup for T0
{% set SWAP_MOVE = params.SWAP_MOVE|default(1)|int %} # Slicer declares if swap happens within print
{% set PAUSE_CHANGE_ALL = params.PAUSE_CHANGE_ALL|default(0)|int %} # Slicer declares pausing for filament changes
{% set UNLOAD_DISTANCE = params.UNLOAD_DISTANCE|default(80)|float %}# Unload Distance
{% set EXTR0_UNLOAD = params.EXTR0_UNLOAD|default(0)|int %} # Status Extruder 0=geladen, 1=ungeladen
{% set EXTR1_UNLOAD = params.EXTR1_UNLOAD|default(1)|int %} # Status Extruder1 0=geladen, 1=ungeladen
{% set EXTR0_SENSOR = params.EXTR0_SENSOR|default(0)|int %} # Extruder Fila Sensor (Enable) 0=false, 1=true
{% set EXTR1_SENSOR = params.EXTR1_SENSOR|default(0)|int %} # Extruder Fila Sensor (Enable) 0=false, 1=true
{% set EXTR_ACTIVE = params.EXTR_ACTIVE|default(0)|int %} # Extruder active (0, 1)
{% set START_PREP_EXTRUDERS = params.START_PREP_EXTRUDERS|default(0)|int %} # start with PREP_EXTRUDERS macros (0, 1)
{% set EXTR0_LOAD = params.EXTR0_LOAD|default(1)|int %} # Status Extruder 1=geladen, 0=ungeladen
{% set EXTR1_LOAD = params.EXTR1_LOAD|default(0)|int %} # Status Extruder1 1=geladen, 0=ungeladen
{ action_respond_info("SET_DEFAULT EXTRUDERS=%s RUNOUT_BACKUP=%s SWAP_MOVE=%s PAUSE_CHANGE_ALL=%s UNLOAD_DISTANCE=%s EXTR0_UNLOAD=%s EXTR1_UNLOAD=%s EXTR0_LOAD=%s EXTR1_LOAD=%s EXTR0_SENSOR=%s SENSOR_EXT1=%s EXTR_ACTIVE=%s START_PREP_EXTRUDERS=%s" % (EXTRUDERS, RUNOUT_BACKUP, SWAP_MOVE, PAUSE_CHANGE_ALL, UNLOAD_DISTANCE, EXTR0_UNLOAD, EXTR1_UNLOAD, EXTR0_LOAD, EXTR1_LOAD, EXTR0_SENSOR, EXTR1_SENSOR, EXTR_ACTIVE, START_PREP_EXTRUDERS)) }
SET_FILAMENT_SENSOR SENSOR=fsensor0 ENABLE={EXTR0_SENSOR} # enable/disable filament sensor ! commended with # if you don't use !
SET_FILAMENT_SENSOR SENSOR=fsensor1 ENABLE={EXTR1_SENSOR} # enable/disable filament sensor ! commended with # if you don't use !
#UNLOAD_DISTANCE ULDIST={UNLOAD_DISTANCE}
{ action_respond_info("--EXTRUDER_CONFIG EXTRUDERS=%s RUNOUT_BACKUP=%s SWAP_MOVE=%s PAUSE_CHANGE_ALL=%s UNLOAD_EXT0=%s UNLOAD_EXT1=%s EXTR0_LOAD=%s EXTR1_LOAD=%s UNLOAD_DISTANCE=%s SENSOR_EXT0=%s SENSOR_EXT1=%s ACTIVE_EXTRUDER=%s START_PREP_EXTRUDERS=%s" % (EXTRUDERS, RUNOUT_BACKUP, SWAP_MOVE, PAUSE_CHANGE_ALL, EXTR0_UNLOAD, EXTR1_UNLOAD, EXTR0_LOAD, EXTR1_LOAD, UNLOAD_DISTANCE, EXTR0_SENSOR, EXTR1_SENSOR, EXTR_ACTIVE, START_PREP_EXTRUDERS)) }
EXTRUDER_CONFIG EXTRUDERS={EXTRUDERS} RUNOUT_BACKUP={RUNOUT_BACKUP} SWAP_MOVE={SWAP_MOVE} PAUSE_CHANGE_ALL={PAUSE_CHANGE_ALL} UNLOAD_EXT0={EXTR0_UNLOAD} UNLOAD_EXT1={EXTR1_UNLOAD} LOAD_EXT0={EXTR0_LOAD} LOAD_EXT1={EXTR1_LOAD} UNLOAD_DISTANCE={UNLOAD_DISTANCE} SENSOR_EXT0={EXTR0_SENSOR} SENSOR_EXT1={EXTR1_SENSOR} ACTIVE_EXTRUDER={EXTR_ACTIVE} START_PREP_EXTRUDERS={START_PREP_EXTRUDERS}
#STATUS_EXTRUDER
# Load DEFAULT / Basic Parameters
[gcode_macro LOAD_DUAL_DEFAULT]
description: LOAD DUAL Extruders DEFAULT / Basic Parameters
gcode:
# load save_vars and set as new default (for Dual Extruders!!!)
{% set svv = printer.save_variables.variables %}
{action_respond_info("--SET_DEFAULT EXTRUDERS=%s RUNOUT_BACKUP=%s SWAP_MOVE=%s PAUSE_CHANGE_ALL=%s UNLOAD_DISTANCE=%s extr0_unload=%s extr1_unload=%s extr0_load=%s extr1_load=%s extr0_sensor=%s extr1_sensor=%s extr_active=%s start_prep_extruders=%s" % (svv.num_extruders, svv.ext1_bkup, svv.swap_move, svv.pause_change_all, svv.unload_distance, svv.extr0_unload, svv.extr1_unload, svv.extr0_load, svv.extr1_load, svv.extr0_sensor, svv.extr1_sensor, svv.extr_active, svv.start_prep_extruders)) }
SET_DEFAULT EXTRUDERS={svv.num_extruders} RUNOUT_BACKUP={svv.ext1_bkup} SWAP_MOVE={svv.swap_move} PAUSE_CHANGE_ALL={svv.pause_change_all} UNLOAD_DISTANCE={svv.unload_distance} extr0_unload={svv.extr0_unload} extr1_unload={svv.extr1_unload} extr0_load={svv.extr0_load} extr1_load={svv.extr1_load} extr0_sensor={svv.extr0_sensor} extr1_sensor={svv.extr1_sensor} extr_active={svv.extr_active} start_prep_extruders={svv.start_prep_extruders}
[gcode_macro STATUS_EXTRUDER_VAR]
description: Status EXTRUDER_VARS printer["gcode_macro EXTRUDER_VARS"] Variablen
gcode:
{% set ev = printer["gcode_macro EXTRUDER_VARS"] %}
RESPOND TYPE=echo MSG="NUM Extruders = {ev.num_extruders}"
RESPOND TYPE=echo MSG="EXT1 as Backup = {ev.ext1_bkup}"
RESPOND TYPE=echo MSG="Swap move set to = {ev.swap_move}"
RESPOND TYPE=echo MSG="Extr0 unload State = {ev.extr0_unload}"
RESPOND TYPE=echo MSG="Extr1 unload State = {ev.extr1_unload}"
RESPOND TYPE=echo MSG="Extr0 load State = {ev.extr0_load}"
RESPOND TYPE=echo MSG="Extr1 load State = {ev.extr1_load}"
RESPOND TYPE=echo MSG="Pause on Tool change = {ev.pause_change_all}"
RESPOND TYPE=echo MSG="Extr0 Sensor = {ev.extr0_sensor}"
RESPOND TYPE=echo MSG="Extr1 Sensor = {ev.extr1_sensor}"
RESPOND TYPE=echo MSG="UNLOAD_DISTANCE.dist = {printer["gcode_macro UNLOAD_DISTANCE"].dist}"
RESPOND TYPE=echo MSG="Extruder active = {ev.extr_active}"
RESPOND TYPE=echo MSG="start with prep_extruders = {ev.start_prep_extruders}"
[gcode_macro STATUS_SAVE_VAR]
description: Status Save Variables
gcode:
{% set svv = printer.save_variables.variables %}
RESPOND TYPE=echo MSG="NUM Extruders = {svv.num_extruders}"
RESPOND TYPE=echo MSG="EXT1 as Backup = {svv.ext1_bkup}"
RESPOND TYPE=echo MSG="Swap move set to = {svv.swap_move}"
RESPOND TYPE=echo MSG="Extr0 unload State = {svv.extr0_unload}"
RESPOND TYPE=echo MSG="Extr1 unload State = {svv.extr1_unload}"
RESPOND TYPE=echo MSG="Extr0 load State = {svv.extr0_load}"
RESPOND TYPE=echo MSG="Extr1 load State = {svv.extr1_load}"
RESPOND TYPE=echo MSG="Pause on Tool change = {svv.pause_change_all}"
RESPOND TYPE=echo MSG="Extr0 Sensor = {svv.extr0_sensor}"
RESPOND TYPE=echo MSG="Extr1 Sensor = {svv.extr1_sensor}"
RESPOND TYPE=echo MSG="Unload Dinstance = {svv.unload_distance}"
RESPOND TYPE=echo MSG="Extruder active = {svv.extr_active}"
RESPOND TYPE=echo MSG="start with prep_extruders = {svv.start_prep_extruders}"
[gcode_macro STATUS_PRINTER]
description: Status Printer Variables
gcode:
RESPOND TYPE=echo MSG="printer.toolhead.extruder = {printer.toolhead.extruder}"