-
Notifications
You must be signed in to change notification settings - Fork 0
/
Euclid.cfg
365 lines (278 loc) · 11.7 KB
/
Euclid.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
[probe]
pin:^PG10
x_offset: 5 # offset for microswitch x direction off nozzle
y_offset: -66 # offset for microswitch y direction off nozzle
#Z_offset: 4.00 # offset for microswitch in z height
samples: 2
sample_retract_dist: 2 # this is so the machine has time for the switch to reset properly, especially with a higher retract speed
samples_result: average
samples_tolerance: 0.04
samples_tolerance_retries: 2
speed: 7 # do not go higher than 10mm/s, you will destroy the switch
lift_speed: 35
#########################################################
[homing_override]
gcode: SET_KINEMATIC_POSITION X=0 Y=0 Z=0
G0 Z8 F500 ; raise bed to 8
G28 X Y ; home X & Y
M401 ; deploy Euclid Probe
G0 X245 Y184 F6000 ; move to X200 Y250
G28 Z ; home Z
M402 ; retract Euclid Probe
axes: z
set_position_z:-15
###########################################################
[bed_mesh]
speed = 200
horizontal_move_z = 10
mesh_min = 20,20
mesh_max = 490,490
probe_count = 7,7
mesh_pps: 3,3
fade_start: 1
fade_end: 10
algorithm: bicubic
bicubic_tension: 0.4
#relative_reference_index: 24
###########################################################
[z_tilt]
z_positions:
15,55
485,55
255,455
#0,250
#493,15
#493,370
points:
45,5
455,5
255,395
#70,215
#470,7
#470,365
speed: 180
horizontal_move_z: 15
retries: 10
retry_tolerance: 0.0075
###########################################################################
#movement for euclid dock and undock
[gcode_macro preflight]
gcode:
G90
G1 X250 Y430 Z8 ; Step 1, Pre-flight location X30 Y480
###########################################################################
[gcode_macro preflight_2]
gcode:
G90
G1 X0 Y0 Z8
[gcode_macro move_to_dockside]
# Move to location adjacent to dock X30 Y0
gcode:
G90 ; absolute coordinate system
G0 X220 Y502 Z8 ; Step 2, Dock Adjacent move to X30 Y0
############################################################################
[gcode_macro move_to_dock]
gcode:
# Move over dock for probe pickup X-30 movement
G90 ; absolute coordinate system
G0 X250 Y502 Z8 ; Step 3, move to dock over probe at X0 Y0
############################################################################
[gcode_macro move_outof_dock]
# Location adjacent to dock for exit Y+40 movement
gcode:
G90 ; absolute coordinate system
# the following line may need a G91 to preceed it depending on overides
G0 X250 Y480 Z8 ; Step 4, mouve out of dock move to X0 Y40 Z15
############################################################################
[gcode_macro second_move]
gcode:
G90
G0 X220 Y502 Z8 ; Step 1, Pre-flight location X100 Y20
#############################################################################
[gcode_macro GO_HOME]
gcode:
G91
G1 Z15
G90
G1 X1 Y500 f4800
# actually check if probe is deplyed and error out. Needs to be called by routine which does QUERY_PROBE due to the way klipper does expansion of macros
[gcode_macro do_error_if_probe_deployed]
gcode:
{% if not printer.probe.last_query %}
#{action_raise_error("probe already stowed - remove and return to dock")}
{% endif %}
[gcode_macro error_if_probe_deployed]
gcode:
G4 P300
QUERY_PROBE
do_error_if_probe_deployed
[gcode_macro do_error_if_probe_not_deployed]
gcode:
{% if printer.probe.last_query %}
{action_raise_error("probe unsuccessfully deployed")}
{% endif %}
[gcode_macro error_if_probe_not_deployed]
gcode:
G4 P300
QUERY_PROBE
do_error_if_probe_not_deployed
######################################################################################################
# Macro to Deploy Bed Probe
[gcode_macro M401]
gcode:
{action_respond_info("Entering M401")}
error_if_probe_deployed
G90
#{% if printer.probe.last_query %}
G0 Z8 F10000 ; set approach elevation of Z15
preflight ; set carraige to safe position
M400 ; wait for moves to finish
G4 P250
move_to_dockside
M400 ; wait for moves to finish
G4 P250
move_to_dock ; translate over probe pickup location
M400 ; wait for moves to finish
G4 P250 ; pause 1/4 sec for detection
move_outof_dock ; translate out of dock
G0 Z8 F10000 ; raise to elevation of Z20
error_if_probe_not_deployed
{action_respond_info("Exit M401")}
################################################################################
######################################################################################
# Macro to Stow Bed Leveling Probe
[gcode_macro M402]
gcode:
{action_respond_info("Entering M402")}
error_if_probe_deployed
G90
#{% if not printer.probe.last_query %} #this might be reveersed in order
G0 Z8 F10000 ; set approach elevation of Z20
preflight
M400 ; wait for moves to finish
G4 P250
move_to_dock ; move probe into to dock
M400 ; wait for moves to finish
G4 P250
#move_to_dockside ; swipe probe off
second_move ; move away from dock area
G0 Z8 F10000 ; move up to elevation of Z20
G0 X245 Y175 ; move probe to center of bed in ready position
error_if_probe_deployed
{action_respond_info("Exit M402")}
#{% endif %}
#################################################################################
####################################
###################################################################################
[gcode_macro BED_MESH_CALIBRATE]
rename_existing: BED_MESH_CALIBRATE_ORIG
variable_buffer: 10
gcode:
{% set start_print = printer["gcode_macro START_PRINT"] %}
{% set bed_mesh = printer.configfile.settings.bed_mesh %}
{% set probe_config = printer.configfile.settings.probe %}
{% if start_print.first_layer_min_xy and start_print.first_layer_max_xy %}
{ action_respond_info("print_min: {}".format(start_print.first_layer_min_xy)) }
{ action_respond_info("print_max: {}".format(start_print.first_layer_max_xy)) }
{% set print_min_x = (start_print.first_layer_min_xy[0] | float) + probe_config.x_offset %}
{% set print_min_y = (start_print.first_layer_min_xy[1] | float) + probe_config.y_offset %}
{% set print_max_x = (start_print.first_layer_max_xy[0] | float) + probe_config.x_offset %}
{% set print_max_y = (start_print.first_layer_max_xy[1] | float) + probe_config.y_offset %}
#DEPLOY_PROBE
M401
{% if (print_min_x < print_max_x) and (print_min_y < print_max_y) %}
{% set minimum_probe_count = 5 if bed_mesh.algorithm == "bicubic" else 3 %}
# bed_mesh.probe_count is a tuple
{% set probe_count = bed_mesh.probe_count %}
{% set probe_count_x = probe_count[0] %}
{% set probe_count_y = probe_count[1] if (probe_count | length) == 2 else probe_count_x %}
# -1 is the effective, undocumented default
{% set relative_reference_index = bed_mesh.relative_reference_index | default(-1, true) %}
{% set mesh_min_x, mesh_min_y = bed_mesh.mesh_min %}
{% set mesh_max_x, mesh_max_y = bed_mesh.mesh_max %}
# If print area X is smaller than 50% of the bed size, use the
# minimum probe count for X instead of the default
{% if (print_max_x - print_min_x) < (mesh_max_x - mesh_min_x)/2 %}
{% set probe_count_x = minimum_probe_count %}
{% endif %}
# If print area Y is smaller than 50% of the bed size, use the
# minimum probe count for Y instead of the default
{% if (print_max_y - print_min_y) < (mesh_max_y - mesh_min_y)/2 %}
{% set probe_count_y = minimum_probe_count %}
{% endif %}
{% if relative_reference_index > 0 %}
{% set relative_reference_index = ((probe_count_x * probe_count_y - 1) / 2)|int %}
{% endif %}
{% set mesh_min_x = [print_min_x - buffer, mesh_min_x] | max %}
{% set mesh_min_y = [print_min_y - buffer, mesh_min_y] | max %}
{% set mesh_max_x = [print_max_x + buffer, mesh_max_x] | min %}
{% set mesh_max_y = [print_max_y + buffer, mesh_max_y] | min %}
{ action_respond_info("mesh_min: ({}, {})".format(mesh_min_x, mesh_min_y)) }
{ action_respond_info("mesh_max: ({}, {})".format(mesh_max_x, mesh_max_y)) }
{ action_respond_info("probe_count: ({}, {})".format(probe_count_x,probe_count_y)) }
{ action_respond_info("relative_reference_index: {}".format(relative_reference_index)) }
BED_MESH_CALIBRATE_ORIG mesh_min={mesh_min_x},{mesh_min_y} mesh_max={mesh_max_x},{mesh_max_y} probe_count={probe_count_x},{probe_count_y} relative_reference_index={relative_reference_index}
{% else %}
BED_MESH_CALIBRATE_ORIG
{% endif %}
#STOW_PROBE
M402
{% else %}
#DEPLOY_PROBE
M401
BED_MESH_CALIBRATE_ORIG
#STOW_PROBE
M402
{% endif %}
#################################################################################################################
[gcode_macro START_PRINT]
## support PRINT_MIN={first_layer_print_min[0]},{first_layer_print_min[1]} PRINT_MAX={first_layer_print_max[0]},{first_layer_print_max[1]}
variable_first_layer_min_xy: None
variable_first_layer_max_xy: None
gcode:
{% set extruder_temp = params.EXTRUDER_TEMP | default(printer.extruder.target, true) %}
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(0)|float %}
;{% endif %}
G90 ; Force coordinates to be absolute relative to the origin
G28 ; Home X/Y/Z axis
#QUAD_GANTRY_LEVEL
Z_TILT_ADJUST
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=first_layer_min_xy VALUE="{ params.PRINT_MIN | default(None, true) }"
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=first_layer_max_xy VALUE="{ params.PRINT_MAX | default(None, true) }"
BED_MESH_CALIBRATE PRINT_MIN={params.PRINT_MIN} PRINT_MAX={params.PRINT_MAX}
;BED_MESH_PROFILE LOAD="default"
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=first_layer_min_xy VALUE=None
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=first_layer_max_xy VALUE=None
M104 S{EXTRUDER_TEMP} ; set extruder temp
M109 S{EXTRUDER_TEMP} ; wait for extruder temp
G1 X3 Y10 Z4 F5000 ; Move safe Z height to shear strings
G0 X5 Y10 Z0.1 F5000 ; Move in 1mm from edge and up [z] 0.2mm
G92 E0 ; Set extruder to [0] zero
G1 X200 E40 F800 ; Extrude 30mm filiment along X axis 200mm long to prime and clean the nozzle
G92 E0 ; Reset extruder to [0] zero end of cleaning run
G1 X205 F10000 ; quick wipe away from the filament line / purge
#####################################################################################################################
[gcode_macro END_PRINT]
variable_machine_depth:0
gcode:
# Turn off extruder, and fan
M104 S0
M106 S0
# Absolute positionning
G90
# Present print
G1 X0 Y{machine_depth}
# Disable steppers
M84
QUERY_PROBE
POWER_OFF_BED
# Print message on LCD
M117 That's All Folks
[gcode_macro Z_TILT_ADJUST]
rename_existing: Z_TILT_ADJUST_ORIGINAL
gcode:
QUERY_PROBE
M401 ; deploy #Euclid Probe if needed
Z_TILT_ADJUST_ORIGINAL ; check #bed level
M402 ; dock #Euclid Probe
####################################################################