-
Notifications
You must be signed in to change notification settings - Fork 18
/
G3201
109 lines (100 loc) · 4.64 KB
/
G3201
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
#.................................................................................................................
# G3201 - No additional options / Usage: G3201
# Homes the toolhead, performs quad gantry leveling, homes Z, applies HOTMESH, homes Z again, then
# probes four-bed center points. The four probing resultant median values are then averaged and
# compared to [variable_euclidZCompensation]. The difference between the probe findings and this variable is
# applied to the current Z height (Z25), defined as NEW_CURRENT_Z and then set with SET_KINEMATIC_POSITION.
# *If [variable_euclidZCompensation] is set to 0, compensation will not be applied. Additionally, once
# the Z-axis is homed, any existing compensation from G3201 will be discarded.
# To figure ZCompensation, do the following: Check nozzle clean and free of debris, same for bed. Run a G3201
# and then place a sheet of paper over the bed center. Then slowly, using the -1mm button, move the nozzle
# toward the bed. Once the nozzle is close, shift to the 0.1mm button and continue until the nozzle touches
# a piece of paper on top of the build plate. If the current Z position is greater than 0, subtract the
# current Z position from the currently set [variable_euclidZCompensation]. If the current Z position is less
# than 0, a negative number, then take that number and add it to the current [variable_euclidZCompensation].
#-------------------------------------------- Z Compensation Setting ---------------------------------------------
[gcode_macro configvars]
variable_euclidZCompensation: 9.41 # Z0 Compensation based off probe height, set to 0 to disable (Testing)
gcode:
#................................................ G3201 MACRO .....................................................
[force_move]
enable_force_move: true
[gcode_macro G3201]
gcode:
{% set X_MID = printer.configfile.config["stepper_x"]["position_max"]|float / 2.0 %}
{% set Y_MID = printer.configfile.config["stepper_y"]["position_max"]|float / 2.0 %}
BED_MESH_CLEAR
G28
QUERY_PROBE
{% if printer.probe.last_query %}
M118 Fetching Euclid Probe.
_PROBE_DEPLOY
G28 Z
{% endif %}
QUAD_GANTRY_LEVEL_ORIGINIAL
BED_MESH_PROFILE LOAD=HOTMESH # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< CHANGE THIS TO YOUR MESH PROFILE !!!
G28 Z
G90
G0 X{X_MID} Y{Y_MID} F3500
G91
G0 X-10 Y-10 F2500
PROBE samples_result=median samples=7 speed=5.0 samples_tolerance=0.050 samples_tolerance_retries=3 sample_retract_dist=2.0
_CHECK_PROBE2
[gcode_macro _CHECK_PROBE2]
gcode:
{% set PROBE_PASS = printer.probe.last_z_result %}
G0 Z2 F500
G0 X20 F2500
PROBE samples_result=median samples=7 speed=5.0 samples_tolerance=0.050 samples_tolerance_retries=3 sample_retract_dist=2.0
_CHECK_PROBE3 PASS={PROBE_PASS}
[gcode_macro _CHECK_PROBE3]
gcode:
{% set PASS = params.PASS|float %}
{% set PROBE_PASS = printer.probe.last_z_result %}
G0 Z2 F500
G0 Y20 F2500
PROBE samples_result=median samples=7 speed=5.0 samples_tolerance=0.050 samples_tolerance_retries=3 sample_retract_dist=2.0
_CHECK_PROBE4 PASS={PROBE_PASS + PASS}
[gcode_macro _CHECK_PROBE4]
gcode:
{% set PASS = params.PASS|float %}
{% set PROBE_PASS = printer.probe.last_z_result %}
G0 Z2 F500
G0 X-20 F2500
PROBE samples_result=median samples=7 speed=5.0 samples_tolerance=0.050 samples_tolerance_retries=3 sample_retract_dist=2.0
_CHECK_PROBE5 PASS={PROBE_PASS + PASS}
[gcode_macro _CHECK_PROBE5]
gcode:
{% set PASS = params.PASS|float %}
{% set PROBE_PASS = printer.probe.last_z_result %}
G90
G0 Z25 F3500
_CHECK_PROBE6 PASS={(PROBE_PASS + PASS)/4}
[gcode_macro _CHECK_PROBE6]
gcode:
{% set ZP_CAL = printer["gcode_macro configvars"].euclidzcompensation|float %}
{% set PASS = params.PASS|float %}
{% set Z_POS = printer.toolhead.position.z|float %}
{% set Z_OFFSET = PASS - ZP_CAL|float %}
{% set NEW_CURRENT_Z = (Z_POS - Z_OFFSET) %}
M118 Current Average is: {PASS}
M118 Z-Probe calibration is: {ZP_CAL}
M118 Offset: {Z_OFFSET}
{% if Z_OFFSET|abs > 1 %}
M118 ! ! ! Z-OFFSET is > 1mm, check nozzle cleanliness and printer ! ! !
M118 Not applying calculated offset to Z.
{% else %}
M118 Setting current Z_Height of {Z_POS} to {NEW_CURRENT_Z}
SET_KINEMATIC_POSITION Z={NEW_CURRENT_Z}
G4 P1000
M118 Moving nozzle to newly adjusted Z25.
G0 Z25 F3500
G4 P1000
{% endif %}
QUERY_PROBE
{% if not printer.probe.last_query %}
M118 Stowing Euclid Probe.
_PROBE_STOW
{% else %}
M118 ?!Probe is not attached.
{% endif %}