-
Notifications
You must be signed in to change notification settings - Fork 2
/
smuff.cfg
313 lines (278 loc) · 9.93 KB
/
smuff.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
#
# SMuFF configuration file for Klipper
#
# Copyright (C) 2022-2023 Technik Gegg <technik.gegg@gmail.com>
# Version 1.14
#
# This file may be distributed under the terms of the GNU GPLv3 license
#
# Add [include smuff.cfg] to your printer.cfg
#
# uncomment the next line if you have a display defined in your printer.cfg
#[include smuff_menu.cfg]
# ----------------------------------------
# Main configuration
# ----------------------------------------
[smuff]
serial=/dev/ttySMuFF ; better: use device id from /dev/serial/by-id/ folder
hasIDEX=no ; if you enable this option, you also need to enable the SMuFF_B settings down below!
debug=no
ignoreDebug=yes ; don't print "echo:debug" messages coming from SMuFF in the console
baudrate=115200 ; from here on, settings apply to "main" SMuFF (a.k.a. SMuFF_A on an IDEX machine)
autoConnectSerial=yes
serialTimeout=5
commandTimeout=20
toolchangeTimeout=90
watchdogTimeout=30
hasCutter=yes
hasWiper=no ; assign this parameter manually
# The following settings are only valid if this is an IDEX machine running two SMuFFs (see hasIDEX - caution, this is yet experimental!).
# To enable this feature, remove the # (hash sign) in front of each line and assign the values accordingly.
#serialB=/dev/serial/by-id/
#baudrateB=115200
#serialTimeoutB=5
#autoConnectSerialB=yes
#commandTimeoutB=20
#toolchangeTimeoutB=90
#hasCutterB=yes
#hasWiperB=no
#watchdogTimeoutB=30
# -----------------------------------------------------
# PRE_TOOLCHANGE and POST_TOOLCHANGE will be called from within
# the module in order to prepare the printer for a tool change /
# resume printing.
#
# Basically it's pausing/resuming the print but you can put in
# different commands, such like wiping, purging or ramming,
# if needed.
# -----------------------------------------------------
[gcode_macro PRE_TOOLCHANGE]
description: Macro called from SMUFF_TOOL_CHANGE for pre-processing. Do not call it via console or script!
gcode:
# the SMuFF module will provide a parameter T for the current tool in case
# you want to evalute those before pausing the print
# { action_respond_info("Tool change to 'T%s' pending" % params.T|int) }
# pause the print first
PAUSE_BASE
PARK_TOOLHEAD
# then switch off extruder motor (it's mandatory!)
SET_STEPPER_ENABLE STEPPER=extruder ENABLE=0
#SET_STEPPER_ENABLE STEPPER=extruder1 ENABLE=0 ; enable (uncomment) this on an IDEX machine as well
[gcode_macro POST_TOOLCHANGE]
description: Macro called from SMUFF_TOOL_CHANGE for post-processing. Do not call it via console or script!
gcode:
# the SMuFF module will provide two parameters, P for the previous tool, T for the current tool
# in case you want to evalute those before resuming
# { action_respond_info("Tool change from 'T%s' to 'T%s' done" % params.P|int, params.T|int) }
# switch extruder motor back on
SET_STEPPER_ENABLE STEPPER=extruder ENABLE=1
#SET_STEPPER_ENABLE STEPPER=extruder1 ENABLE=1 ; enable (uncomment) this on an IDEX machine as well
# then resume printing
RESUME_BASE
[gcode_macro PARK_TOOLHEAD]
description: Parks the toolhead before a tool change.
gcode:
# set park position for x and y; default is the max. position
# taken 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 %}
# z position is 10 mm above the print
{% set z_park_lift = 10.0 %}
# validate the lift position
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_z = printer.toolhead.position.z|float %}
{% if (act_z + z_park_lift) <= max_z %}
{% set z_safe = act_z + z_park_lift %}
{% else %}
{% set z_safe = max_z %}
{% endif %}
# park the toolhead at the calculated positions (if all axes are homed)
{% if "xyz" in printer.toolhead.homed_axes %}
# move in absolute coordinates
G90
G1 Z{z_safe} F2000
G1 X{x_park} Y{y_park} F12000
{% if printer.gcode_move.absolute_coordinates|lower == 'false' %}
G91
{% endif %}
{% else %}
{action_respond_info("Printer is not homed!")}
{% endif %}
# -----------------------------------------------------
# GCode macros for tool changes.
# This is the max. configuration of tools on the SMuFF.
# Most probably you'll need only T0-4 for the standard build.
# However, it doesn't hurt having them all defined.
#
# Keep in mind: On an IDEX machine with two SMuFFs, you
# need to switch the IDEX extruder by calling GCodes
# T0_IDEX or T1_IDEX accordingly before switching the
# tool on the SMuFF!
# Additionally, enable the 'rename_existing' line in T0 and T1
# in order to reuse the (existing) IDEX tool change GCodes.
#
# The GCodes below show how you'd use them. In this example,
# even tool numbers will switch to IDEX extruder 1, whereas
# odd tool numbers will switch to IDEX extruder 2.
# To be able to use them, remove the hash sign and assign the
# SMuFF instance to SMUFF_TOOL_CHANGE accordingly.
# -----------------------------------------------------
# Toff means T-1, but 'T-1' isn't a valid name...
[gcode_macro Toff]
description: Unload all tools a.k.a. T-1 (SMuFF)
gcode:
SMUFF_SEND GCODE="G28"
[gcode_macro T0]
description: Change tool to T0 (SMuFF)
#rename_existing: T0_IDEX ; rename T0 to avoid confusion with existing IDEX configurations
gcode:
#T0_IDEX ; switch extuder on an IDEX machine before changing the tool on SMuFF
#SMUFF_TOOL_CHANGE T=0 DEV="A" ; call SMuFF tool change with explicitly defining the SMuFF instance A (comment out the line below)
SMUFF_TOOL_CHANGE T=0
[gcode_macro T1]
description: Change tool to T1 (SMuFF)
#rename_existing: T1_IDEX ; rename T0 to avoid confusion with existing IDEX configurations
gcode:
#T1_IDEX ; switch extuder on an IDEX machine before changing the tool on SMuFF
#SMUFF_TOOL_CHANGE T=0 DEV="B" ; call SMuFF tool change with explicitly defining the SMuFF instance B (comment out the line below)
SMUFF_TOOL_CHANGE T=1
[gcode_macro T2]
description: Change tool to T2 (SMuFF)
gcode:
#T0_IDEX ; see macro T0
#SMUFF_TOOL_CHANGE T=1 DEV="A"
SMUFF_TOOL_CHANGE T=2
[gcode_macro T3]
description: Change tool to T3 (SMuFF)
gcode:
#T1_IDEX ; see macro T1
#SMUFF_TOOL_CHANGE T=1 DEV="B"
SMUFF_TOOL_CHANGE T=3
[gcode_macro T4]
description: Change tool to T4 (SMuFF)
gcode:
#T0_IDEX ; see macro T0
#SMUFF_TOOL_CHANGE T=2 DEV="A"
SMUFF_TOOL_CHANGE T=4
[gcode_macro T5]
description: Change tool to T5 (SMuFF)
gcode:
#T1_IDEX ; see macro T1
#SMUFF_TOOL_CHANGE T=2 DEV="B"
SMUFF_TOOL_CHANGE T=5
[gcode_macro T6]
description: Change tool to T6 (SMuFF)
gcode:
#T0_IDEX ; see macro T0
#SMUFF_TOOL_CHANGE T=3 DEV="A"
SMUFF_TOOL_CHANGE T=6
[gcode_macro T7]
description: Change tool to T7 (SMuFF)
gcode:
#T1_IDEX ; see macro T1
#SMUFF_TOOL_CHANGE T=3 DEV="B"
SMUFF_TOOL_CHANGE T=7
[gcode_macro T8]
description: Change tool to T8 (SMuFF)
gcode:
#T0_IDEX ; see macro T0
#SMUFF_TOOL_CHANGE T=4 DEV="A"
SMUFF_TOOL_CHANGE T=8
[gcode_macro T9]
description: Change tool to T9 (SMuFF)
gcode:
#T1_IDEX ; see macro T1
#SMUFF_TOOL_CHANGE T=4 DEV="B"
SMUFF_TOOL_CHANGE T=9
[gcode_macro T10]
description: Change tool to T10 (SMuFF)
gcode:
#T0_IDEX ; see macro T0
#SMUFF_TOOL_CHANGE T=5 DEV="A"
SMUFF_TOOL_CHANGE T=10
[gcode_macro T11]
description: Change tool to T11 (SMuFF)
gcode:
#T1_IDEX ; see macro T1
#SMUFF_TOOL_CHANGE T=5 DEV="B"
SMUFF_TOOL_CHANGE T=11
# ----------------------------------------
# Convenience GCode macros
# i.e. for embedding them into the Dashboard.
# ----------------------------------------
[gcode_macro LID_OPEN]
description: Open the Lid on the SMuFF
gcode:
SMUFF_LID_OPEN
[gcode_macro LID_CLOSE]
description: Close the Lid on the SMuFF
gcode:
SMUFF_LID_CLOSE
[gcode_macro SHOW_STATUS]
description: Show SMuFF status
gcode:
SMUFF_STATUS
[gcode_macro CUT_FILAMENT]
description: Cut filament (SMuFF)
gcode:
{% if printer.smuff.hascutter %}
SMUFF_CUT
{% endif %}
[gcode_macro WIPE_NOZZLE]
description: Wipe the nozzle (SMuFF)
gcode:
{% if printer.smuff.haswiper %}
SMUFF_WIPE
{% endif %}
[gcode_macro TOOL]
description: Query active tool (SMuFF)
gcode:
{ action_respond_info("Active tool is T%s" % (printer.smuff.activetool)) }
[gcode_macro LOAD_TOOL]
description: Load filament in active tool (SMuFF)
gcode:
SMUFF_LOAD
[gcode_macro UNLOAD_TOOL]
description: Unload filament from active tool (SMuFF)
gcode:
SMUFF_UNLOAD
[gcode_macro HOME_SMUFF]
description: Home Selector (and Revolver if configured) (SMuFF)
gcode:
SMUFF_HOME
[gcode_macro RESET_SMUFF]
description: Reset device (SMuFF)
gcode:
SMUFF_RESET
[gcode_macro MOTORS_OFF]
description: Turn all motors off (SMuFF)
gcode:
SMUFF_MOTORS_OFF
[gcode_macro CLEAR_JAM]
description: Resets the Feeder jammed flag (SMuFF)
gcode:
SMUFF_CLEAR_JAM
[gcode_macro GET_VERSION]
description: Queries the current module version (SMuFF)
gcode:
SMUFF_VERSION
# ----------------------------------------
# Other GCodes for testing smuff properties
# and to show how to access them
# ----------------------------------------
[gcode_macro PRINT_SMUFF_MATERIALS]
description: Test Tool Materials (SMuFF)
gcode:
{% for i in range(printer.smuff.tools) %}
{% if printer.smuff.materials[i] -%}
{ action_respond_info("Tool %s: '%s %s', Purge factor is %s%%\n" % (i, printer.smuff.materials[i][1], printer.smuff.materials[i][0], printer.smuff.materials[i][2])) }
{%- else %}
{ action_respond_info("No materials loaded. Use SMUFF_MATERIALS first!") }
{%- endif %}
{% endfor %}
[gcode_macro PRINT_SMUFF_SWAPS]
description: Test Tool Swaps (SMuFF)
gcode:
{% for i in range(printer.smuff.tools) %}
{ action_respond_info("Tool %s is located in tray %s\n" % (i, printer.smuff.swaps[i])) }
{% endfor %}