forked from gritsenko-konstantin/DoomConfig
-
Notifications
You must be signed in to change notification settings - Fork 0
/
probe.cfg
574 lines (453 loc) · 17.2 KB
/
probe.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
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
#######################
###### Probe.cfg ######
#######################
[probe]
## Inductive Probe
## This probe is not used for Z height, only Quad Gantry Leveling
## Z_MAX on mcu_z
## If your probe is NO instead of NC, add change pin to !z:P0.10
pin: ^z:P1.24
x_offset: 0
y_offset: 19.75
#z_offset: 8
speed: 10
samples: 3
samples_result: median
sample_retract_dist: 3.0
samples_tolerance: 0.01
samples_tolerance_retries: 5
drop_first_result: true
#####################################################################
# Homing and Gantry Adjustment Routines
#####################################################################
[idle_timeout]
timeout: 7200
[quad_gantry_level]
gantry_corners:
-60,-10
360,370
# Probe points
points:
50,25
50,225
250,225
250,25
speed: 100
horizontal_move_z: 10
retries: 5
retry_tolerance: 0.0075
max_adjust: 10
[gcode_macro User_Variables]
variable_verbose: True # Enable verbose output
variable_travel_speed: 200 # how fast all other travel moves will be performed when running these macros
variable_dock_speed: 50 # how fast should the toolhead move when docking the probe for the final movement
variable_release_speed: 100 # how fast should the toolhead move to release the hold of the magnets after docking
variable_z_drop_speed: 20 # how fast the z will lower when moving to the z location to clear the probe
variable_home_z_height: 15 # Z when homing
# if a separate Z endstop switch is in
# use, specify the coordinates of the switch here (Voron).
# Set to 0 to have the probe move to center of bed
variable_z_endstop_x: 205
variable_z_endstop_y: 305
# location to park the toolhead
variable_park_toolhead: False # Enable toolhead parking
variable_parkposition_x: 150
variable_parkposition_y: 150
variable_parkposition_z: 30
#dock location
variable_docklocation_x: 240 # X Dock position
variable_docklocation_y: 303 # Y Dock position
variable_docklocation_z: 15 # Z dock position
variable_dockarmslenght: 30 # Dock arms lenght, toolhead movement necessary to clear the dock arms
#Umbilical to help untangle the umbilical in difficult situations
variable_umbilical_x: 240 #X umbilical position
variable_umbilical_y: 200 #Y umbilical position
variable_umbilical: True #should we untabgle the umbilical
# Do not modify below
gcode:
{% set Mx = printer['configfile'].config["stepper_x"]["position_max"]|float %}
{% set My = printer['configfile'].config["stepper_y"]["position_max"]|float %}
{% set Ox = printer['configfile'].config["probe"]["x_offset"]|float %}
{% set Oy = printer['configfile'].config["probe"]["y_offset"]|float %}
{% set Oz = printer['configfile'].config["probe"]["z_offset"]|float %}
# if docklocation_z is zero, use Home Z height for safety
{% if docklocation_z == 0 %}
SET_GCODE_VARIABLE MACRO=Probe_Variables VARIABLE=docklocation_z VALUE={ home_z_height }
{% endif %}
# If x, y coordinates are set for z endstop, assign them
{% if z_endstop_x != 0 or z_endstop_y != 0 %}
SET_GCODE_VARIABLE MACRO=Probe_Variables VARIABLE=z_endstop_x VALUE={ z_endstop_x }
SET_GCODE_VARIABLE MACRO=Probe_Variables VARIABLE=z_endstop_y VALUE={ z_endstop_y }
# if no x, y coordinates for z endstop, assume probe is endstop and move toolhead to center of bed
{% else %}
SET_GCODE_VARIABLE MACRO=Probe_Variables VARIABLE=z_endstop_x VALUE={ (Mx * 0.5) - Ox }
SET_GCODE_VARIABLE MACRO=Probe_Variables VARIABLE=z_endstop_y VALUE={ (My * 0.5) - Oy }
{% endif %}
[gcode_macro Probe_Variables]
variable_probe_attached: False
variable_probe_state: False
variable_probe_lock: False
variable_z_endstop_x: 0
variable_z_endstop_y: 0
gcode:
[gcode_macro Homing_Variables]
default_parameter_reset: 0
gcode:
{% set R = params.RESET %}
{% if R %}
SET_GCODE_VARIABLE MACRO=Probe_Variables VARIABLE=probe_lock VALUE={ False }
{% endif %}
# Attach probe and lock it
[gcode_macro Attach_Probe_Lock]
gcode:
Attach_Probe
SET_GCODE_VARIABLE MACRO=Probe_Variables VARIABLE=probe_lock VALUE={ True }
# Attach probe and lock it
[gcode_macro Dock_Probe_Unlock]
gcode:
SET_GCODE_VARIABLE MACRO=Probe_Variables VARIABLE=probe_lock VALUE={ False }
Dock_Probe
# Attach Probe Routine
[gcode_macro Attach_Probe]
gcode:
# Get probe attach status
{% set P = printer["gcode_macro Probe_Variables"].probe_attached %}
{% set L = printer["gcode_macro Probe_Variables"].probe_lock %}
{% set V = printer["gcode_macro User_Variables"].verbose %}
# Get Docking location
{% set Dx = printer["gcode_macro User_Variables"].docklocation_x %}
{% set Dy = printer["gcode_macro User_Variables"].docklocation_y %}
{% set Dz = printer["gcode_macro User_Variables"].docklocation_z %}
{% set Da = printer["gcode_macro User_Variables"].dockarmslenght %}
# Safe Z for travel
{% set Hzh = printer["gcode_macro User_Variables"].home_z_height|float %}
#Set speed
{% set St = printer["gcode_macro User_Variables"].travel_speed * 60 %}
#prior to saving actual position, check if its necessary to move to a safe Z
#that has enought overhead for the attached probe
{% if (printer.toolhead.position.z < Hzh) %}
G1 Z{Hzh} F1200
{% endif %}
M400 # mandatory to save the new safe position
#allows the docking position to be independent of the Z offset, necessary for bed mounted probes
SAVE_GCODE_STATE name=_attachProbe
SET_GCODE_OFFSET Z=0
# if x and y are not homed
{% if not 'xy' in printer.toolhead.homed_axes %}
{ action_raise_error("Must Home X and Y Axis First!") }
# If probe not attached and locked
{% elif not P and not L %}
{% if V %}
{ action_respond_info("Attaching Probe") }
{% endif %}
G90
{% if (not 'z' in printer.toolhead.homed_axes) %}
{% if V %}
{ action_respond_info("Resetting Z position to zero") }
{% endif %}
SET_KINEMATIC_POSITION Z=0
{% endif %}
{% if (printer.toolhead.position.z < Hzh) %}
G1 Z{Hzh} F1200
{% endif %}
Umbilical_Path
# Probe entry location
G1 X{Dx} Y{Dy|int - Da|int} Z{Hzh} F{St}
#lower to Z dock
G1 Z{Dz} F600
# pickup from Probe location
G1 X{Dx} Y{Dy} F1800
# Probe entry location
G1 X{Dx} Y{Dy|int - Da|int} F6000
#Go to Z safe distance
G1 Z{Hzh} F600
Park_Toolhead
CheckProbe action=attach
{% elif L %}
{% if V %}
{ action_respond_info("Probe locked!") }
{% endif %}
# Probe attached, do nothing
CheckProbe action=query
{% else %}
{% if V %}
{ action_respond_info("Probe already attached!") }
{% endif %}
# Probe attached, do nothing
CheckProbe action=query
{% endif %}
#reverts to the original Z offset
RESTORE_GCODE_STATE name=_attachProbe
# Dock Probe Routine
[gcode_macro Dock_Probe]
gcode:
# Get probe attach status
{% set P = printer["gcode_macro Probe_Variables"].probe_attached %}
{% set L = printer["gcode_macro Probe_Variables"].probe_lock %}
{% set V = printer["gcode_macro User_Variables"].verbose %}
# Get Docking location
{% set Dx = printer["gcode_macro User_Variables"].docklocation_x %}
{% set Dy = printer["gcode_macro User_Variables"].docklocation_y %}
{% set Dz = printer["gcode_macro User_Variables"].docklocation_z %}
{% set Da = printer["gcode_macro User_Variables"].dockarmslenght %}
# Safe Z for travel
{% set Hzh = printer["gcode_macro User_Variables"].home_z_height|float %}
# Set speed
{% set St = printer["gcode_macro User_Variables"].travel_speed * 60 %}
{% set Sd = printer["gcode_macro User_Variables"].dock_speed * 60 %}
{% set Sr = printer["gcode_macro User_Variables"].release_speed * 60 %}
{% set Sz = printer["gcode_macro User_Variables"].z_drop_speed * 60 %}
M400 # mandatory to save the new safe position
#allows the docking position to be independent of the Z offset, necessary for bed mounted probes
SAVE_GCODE_STATE name=_dockProbe
SET_GCODE_OFFSET Z=0
{% if not 'xyz' in printer.toolhead.homed_axes %}
{ action_raise_error("Must Home X, Y and Z Axis First!") }
# If probe not attached and not locked
{% elif P and not L %}
{% if V %}
{ action_respond_info("Docking Probe") }
{% endif %}
G90
{% if (printer.toolhead.position.z < Hzh) %}
G1 Z{Hzh} F{Sz}
{% endif %}
Umbilical_Path
# Probe entry location
G1 X{Dx} Y{Dy|int - Da|int} Z{Hzh} F{St}
#lower to Z dock
G1 Z{Dz} F{Sz}
# Drop Probe to Probe location
G1 X{Dx} Y{Dy} F{Sd}
# Probe decoupling
G1 X{Dx|int - 40} Y{Dy} F{Sr}
#Go to Z safe distance
G1 X{Dx|int - 40} Y{Dy|int - 5} Z{Hzh} F{St}
Park_Toolhead
CheckProbe action=dock
{% elif L %}
{% if V %}
{ action_respond_info("Probe locked!") }
{% endif %}
# Probe docked, do nothing
CheckProbe action=query
{% else %}
{% if V %}
{ action_respond_info("Probe already docked!") }
{% endif %}
# Probe docked, do nothing
CheckProbe action=query
{% endif %}
#reverts to the original Z offset
RESTORE_GCODE_STATE name=_dockProbe
# Quad Gantry Level
[gcode_macro QUAD_GANTRY_LEVEL]
rename_existing: _QUAD_GANTRY_LEVEL
gcode:
Attach_Probe
{% set V = printer["gcode_macro User_Variables"].verbose %}
{% if V %}
{ action_respond_info("QG Level") }
{% endif %}
CheckProbe action=query
_QUAD_GANTRY_LEVEL {% for p in params
%}{'%s=%s ' % (p, params[p])}{%
endfor %}
Dock_Probe
# Bed Mesh Calibrate
[gcode_macro BED_MESH_CALIBRATE]
rename_existing: _BED_MESH_CALIBRATE
gcode:
Attach_Probe
{% set V = printer["gcode_macro User_Variables"].verbose %}
{% if V %}
{ action_respond_info("Bed Mesh Calibrate") }
{% endif %}
CheckProbe action=query
_BED_MESH_CALIBRATE {% for p in params
%}{'%s=%s ' % (p, params[p])}{%
endfor %}
Dock_Probe
# Probe Accuracy
[gcode_macro PROBE_ACCURACY]
rename_existing: _PROBE_ACCURACY
gcode:
{% set Hzh = printer["gcode_macro User_Variables"].home_z_height|float %}
{% set Sz = printer["gcode_macro User_Variables"].z_drop_speed * 60 %}
{% set St = printer["gcode_macro User_Variables"].travel_speed %}
# Go to Z safe distance before saving location in order to
# avoid crashing the probe on the bed when coming back
G1 Z{Hzh} F{Sz}
M400 # mandatory to save the new safe position
SAVE_GCODE_STATE NAME=_original_nozzle_location
CheckProbe action=query
Attach_Probe
# Restore nozzle location to probe the right place
RESTORE_GCODE_STATE NAME=_original_nozzle_location MOVE=1 MOVE_SPEED={St}
_PROBE_ACCURACY {% for p in params
%}{'%s=%s ' % (p, params[p])}{%
endfor %}
Dock_Probe
# Restore nozzle location again at the end
RESTORE_GCODE_STATE NAME=_original_nozzle_location MOVE=1 MOVE_SPEED={St}
# enable to SET_KINEMATIC_POSITION for Z hop
[force_move]
enable_force_move: True
# Homeing Override
[homing_override]
axes: xyz
gcode:
# collect user state variables
User_Variables
{% set V = printer["gcode_macro User_Variables"].verbose %}
{% set Hzh = printer["gcode_macro User_Variables"].home_z_height|float %}
{% if (not 'z' in printer.toolhead.homed_axes) %}
SET_KINEMATIC_POSITION Z=0
G90
G0 Z{Hzh} F600
{% endif %}
CheckProbe action=query
# reset parameters
{% set X, Y, Z = False, False, False %}
# which axes have been requested for homing
{% if not 'X' in params
and not 'Y' in params
and not 'Z' in params %}
{% set X, Y, Z = True, True, True %}
{% else %}
{% if 'X' in params %}
{% set X = True %}
{% endif %}
{% if 'Y' in params %}
{% set Y = True %}
{% endif %}
{% if 'Z' in params %}
{% set Z = True %}
{% endif %}
{% if 'X' in params
and 'Y' in params
and 'Z' in params %}
# reset homing state variables
# if homing all axes
Homing_Variables reset=1
{% endif %}
{% endif %}
# Home x
{% if X %}
{% if V %}
{ action_respond_info("Homing X") }
{% endif %}
G28 X0
{% endif %}
# Home y
{% if Y %}
{% if V %}
{ action_respond_info("Homing Y") }
{% endif %}
G28 Y0
{% endif %}
# Home z
{% if Z %}
{% if V %}
{ action_respond_info("Homing Z") }
{% endif %}
# if probe is configured as endstop, attach it
{% if printer['configfile'].config["stepper_z"]["endstop_pin"] == 'probe:z_virtual_endstop' %}
Attach_Probe
{% endif %}
Home_Z
# if probe is configured as endstop, dock it
{% if printer['configfile'].config["stepper_z"]["endstop_pin"] == 'probe:z_virtual_endstop' %}
Dock_Probe
{% endif %}
{% endif %}
CheckProbe action=query
# park the toolhead
#Park_Toolhead
# umbilical path setup
[gcode_macro Umbilical_Path]
gcode:
{% set Ux = printer["gcode_macro User_Variables"].umbilical_x %}
{% set Uy = printer["gcode_macro User_Variables"].umbilical_y %}
{% set U = printer["gcode_macro User_Variables"].umbilical %}
{% set Hzh = printer["gcode_macro User_Variables"].home_z_height|float %}
{% set St = printer["gcode_macro User_Variables"].travel_speed * 60 %}
{% if U %}
# Used to give the umbilical a better path to follow and coil properly if dock is tight in space
G1 X{Ux} Y{Uy} Z{Hzh} F{St}
{% endif %}
# Home Z Routine
[gcode_macro Home_Z]
gcode:
{% set Zx = printer["gcode_macro Probe_Variables"].z_endstop_x %}
{% set Zy = printer["gcode_macro Probe_Variables"].z_endstop_y %}
{% set Hzh = printer["gcode_macro User_Variables"].home_z_height|float %}
{% set St = printer["gcode_macro User_Variables"].travel_speed * 60 %}
{% set Sz = printer["gcode_macro User_Variables"].z_drop_speed * 60 %}
# if x and y are not homed yet, raise error
{% if not 'xy' in printer.toolhead.homed_axes %}
{ action_raise_error("Must Home X and Y Axis First!") }
{% else %}
{% if (not 'z' in printer.toolhead.homed_axes) %}
{% if V %}
{ action_respond_info("Resetting Z position to zero") }
{% endif %}
SET_KINEMATIC_POSITION Z=0
{% endif %}
# move tool to safe homing position and home Z axis
# location of z endstop
G1 X{Zx} Y{Zy} Z{Hzh} F{St}
G28 Z
G1 Z{Hzh} F{Sz}
Park_Toolhead
{% endif %}
# check to see if probe is where it is supposed to be after
# attaching/docking maneuver and set homing error or shutdown
[gcode_macro CheckProbe]
variable_probe_state: 0
default_parameter_action:
gcode:
Query_Probe
SetProbeState action={ ACTION }
# due to how templates are evaluated, we have query endstops in one
# macro and call another macro to make decisions based on the result
[gcode_macro SetProbeState]
default_parameter_action:
gcode:
{% set P = printer.probe.last_query %}
{% set V = printer["gcode_macro User_Variables"].verbose %}
# If triggered (true), probe not attached
{% if P %}
SET_GCODE_VARIABLE MACRO=Probe_Variables VARIABLE=probe_attached VALUE={ False }
# If not triggered (false), probe attached
{% else %}
SET_GCODE_VARIABLE MACRO=Probe_Variables VARIABLE=probe_attached VALUE={ True }
{% endif %}
{% if params.ACTION == 'query' %}
SET_GCODE_VARIABLE MACRO=Probe_Variables VARIABLE=probe_state VALUE={ P }
{% endif %}
# if probe fails to attach/detach
# if not docked
{% if (not P and params.ACTION == 'dock') %}
{ action_raise_error("Probe dock failed!") }
{% endif %}
# if not attached
{% if P and params.ACTION == 'attach' %}
{ action_raise_error("Probe attach failed!") }
{% endif %}
# Park Toolhead Routine
[gcode_macro Park_Toolhead]
gcode:
{% set P = printer["gcode_macro User_Variables"].park_toolhead %}
{% set Px = printer["gcode_macro User_Variables"].parkposition_x %}
{% set Py = printer["gcode_macro User_Variables"].parkposition_y %}
{% set Pz = printer["gcode_macro User_Variables"].parkposition_z %}
{% set St = printer["gcode_macro User_Variables"].travel_speed * 60 %}
{% set V = printer["gcode_macro User_Variables"].verbose %}
{% if (P and 'xyz' in printer.toolhead.homed_axes) %}
{% if V %}
{ action_respond_info("Parking Toolhead") }
{% endif %}
G90
G1 X{Px} Y{Py} Z{Pz} F{St}
{% endif %}