-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlazy_home.cfg
More file actions
164 lines (147 loc) · 5.29 KB
/
Copy pathlazy_home.cfg
File metadata and controls
164 lines (147 loc) · 5.29 KB
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
## Copyright (C) 2023 Chris Laprade
##
## This file is part of zippy_config.
##
## zippy_config is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## zippy_config is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with zippy_config. If not, see <http://www.gnu.org/licenses/>.
#####################################
## Lazy Homing ##
## Version 2.0 2023-4-2 ##
#####################################
## Use in place of a normal G28 command to
## only home the axes not already homed
## Only home if not homed
[gcode_macro CG28]
variable_output: 118 ; Output method for status feedback
gcode:
{% if "x" in rawparams|string|lower %} ; if x is in rawparams
{% set X = True %} ; set x flag
{% endif %}
{% if "y" in rawparams|string|lower %} ; if y is in rawparams
{% set Y = True %} ; set y flag
{% endif %}
{% if "z" in rawparams|string|lower %} ; if z is in rawparams
{% set Z = True %} ; set z flag
{% endif %}
{% if rawparams|string|lower == "" %} ; if no parameters are defined
{% set ALL = True %} ; set all flag
{% set X = True %} ; set x flag
{% set Y = True %} ; set y flag
{% set Z = True %} ; set z flag
{% endif %}
{% if printer.toolhead.homed_axes != "xyz" %} ; if not homed
{% if "x" not in printer.toolhead.homed_axes %} ; if x is not homed
{% set home_x = True %} ; set home_x flag
{% endif %}
{% if "y" not in printer.toolhead.homed_axes %} ; if y is not homed
{% set home_y = True %} ; set home_y flag
{% endif %}
{% if "z" not in printer.toolhead.homed_axes %} ; if z is not homed
{% set home_z = True %} ; set home_z flag
{% endif %}
{% if home_x == True and home_y == True and home_z == True %} ; if all axes need to be homed
{% if ALL == True %} ; if all axes are being homed
M{output} Homing all axes
G28 ; Home all axes
{% else %} ; if only some axes are being homed
{% if X == True %} ; if x is being homed
M{output} Homing X axis
G28 X ; Home x axis
{% endif %}
{% if Y == True %} ; if y is being homed
M{output} Homing Y axis
G28 Y ; Home y axis
{% endif %}
{% if Z == True %} ; if z is being homed
M{output} Homing Z axis
G28 Z ; Home z axis
{% endif %}
{% endif %}
{% else %} ; if only some axes need to be homed
{% if home_x == True %} ; if x needs to be homed
{% if X == True %} ; if x is being homed
M{output} Homing X axis
G28 X ; Home x axis
{% endif %}
{% endif %}
{% if home_y == True %} ; if y needs to be homed
{% if Y == True %} ; if y is being homed
M{output} Homing Y axis
G28 Y ; Home y axis
{% endif %}
{% endif %}
{% if home_z == True %} ; if z needs to be homed
{% if Z == True %} ; if z is being homed
M{output} Homing Z axis
G28 Z ; Home z axis
{% endif %}
{% endif %}
{% endif %}
{% else %} ; if already homed
M{output} All axes are homed
{% endif %}
## Only QGL if not QGL'd
[gcode_macro CQGL]
gcode:
{% set output = printer['gcode_macro CG28'].output %}
{% if printer.quad_gantry_level.applied == False %} ; if not QGL'd
CG28 ; Home all axes if not homed
M{output} Leveling gantry
QUAD_GANTRY_LEVEL ; QGL
G28 Z
{% endif %}
## Only Z-tilt if not Z-tilted
[gcode_macro CZ_TILT_ADJUST]
gcode:
{% set output = printer['gcode_macro CG28'].output %}
{% if printer.z_tilt.applied == False %} ; if not QGL'd
CG28 ; Home all axes if not homed
M{output} Leveling gantry
Z_TILT_ADJUST ; Z-tilt adjustment
{% endif %}
################################
############ ALIASES ###########
################################
[gcode_macro HOME_IF_NEEDED]
gcode:
CG28 { rawparams }
[gcode_macro LAZY_HOME]
gcode:
CG28 { rawparams }
[gcode_macro CHECK_HOME]
gcode:
CG28 { rawparams }
################################
############ EXTRAS ############
################################
# Console output
# Use variable_output: 118
[respond]
# Display output
# Use variable_output: 117
[display_status]
# Silence output
# Use variable_output: 116
[gcode_macro M116]
description: Silent status feedback
gcode:
# Dual output
# Use variable_output: 1187 or 1178
[gcode_macro M1187]
description: Dual status feedback
gcode:
M117 {rawparams}
M118 {rawparams}
[gcode_macro M1178]
gcode:
M1187 {rawparams}