-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcncjs.cfg
248 lines (231 loc) · 6.88 KB
/
cncjs.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
[include klippy-cnc/klipper/macros_base/respond.cfg]
[gcode_arcs]
resolution: 1.0
# CNC.js expects firmware report to start with FIRMWARE_NAME, but klipper starts with FIRMWARE_VERSION
# also, when using prefix="" you still get space at the start of the message
[gcode_macro M115]
rename_existing: M00115
gcode:
RESPOND PREFIX="FIRMWARE_NAME:Klipper" MSG="EXTRUDER_COUNT:0"
[gcode_macro G28.2]
gcode:
{% set do="" %}
{% if params.X is defined %}
{% set do=do~" X="~params.X %}
{% endif %}
{% if params.Y is defined %}
{% set do=do~" Y="~params.Y %}
{% endif %}
{% if params.Z is defined %}
{% set do=do~" Z="~params.Z %}
{% endif %}
G53
G28 {do}
SET_GCODE_VARIABLE MACRO=G10 VARIABLE=0 VALUE=True
SAVE_GCODE_STATE NAME=P0
M114
[gcode_macro M84]
rename_existing: M0084
gcode:
# ignore this, we will not disable steppers using gcode
[gcode_macro G10]
variable_cwcs: 0
variable_0: False
variable_1: False
variable_2: False
variable_3: False
variable_4: False
variable_5: False
variable_6: False
gcode:
{% set do="" %}
{% if params.X is defined %}
{% set do=do~" X"~params.X %}
{% endif %}
{% if params.Y is defined %}
{% set do=do~" Y"~params.Y %}
{% endif %}
{% if params.Z is defined %}
{% set do=do~" Z"~params.Z %}
{% endif %}
G92 {do}
SET_GCODE_VARIABLE MACRO=G10 VARIABLE={params.P} VALUE=True
SET_GCODE_VARIABLE MACRO=G10 VARIABLE=cwcs VALUE={params.P}
SAVE_GCODE_STATE NAME=P{params.P}
# Define G53-G59 (all calls internaly G500)
[gcode_macro G500]
gcode:
{% set move="" %}
{% if params.G is defined and params.G != '500' %}
{% set move=move~" G"~params.G %}
{% endif %}
{% if params.X is defined %}
{% set move=move~" X"~params.X %}
{% endif %}
{% if params.Y is defined %}
{% set move=move~" Y"~params.Y %}
{% endif %}
{% if params.Z is defined %}
{% set move=move~" Z"~params.Z %}
{% endif %}
{% if params.F is defined %}
{% set move=move~" F"~params.F %}
{% endif %}
#RESPOND MSG="params={params} move={move} exists={printer["gcode_macro G10"][params.P]}"
{% if move != "" %}
{% if printer["gcode_macro G10"][params.P] %}
#RESPOND MSG="Restoring WCS P{params.P} before move"
RESTORE_GCODE_STATE NAME=P{params.P}
{% endif %}
{move}
#RESPOND MSG="restoring cwcs {printer["gcode_macro G10"].cwcs} {printer["gcode_macro G10"]}"
RESTORE_GCODE_STATE NAME=P{printer["gcode_macro G10"].cwcs}
{% else %}
#RESPOND MSG="setting gcode variable P{params.P}"
SET_GCODE_VARIABLE MACRO=G10 VARIABLE=cwcs VALUE={params.P}
{% if printer["gcode_macro G10"][params.P] %}
#RESPOND MSG="Restoring WCS P{params.P}"
RESTORE_GCODE_STATE NAME=P{params.P}
{% endif %}
{% endif %}
M114
#
[gcode_macro G53]
gcode:
{% set do="" %}
{% if params.G|int < 4 %}
{% set do=do~" G"~params.G %}
{% if params.X is defined %}
{% set do=do~" X"~params.X %}
{% endif %}
{% if params.Y is defined %}
{% set do=do~" Y"~params.Y %}
{% endif %}
{% if params.Z is defined %}
{% set do=do~" Z"~params.Z %}
{% endif %}
{% if params.F is defined %}
{% set do=do~" F"~params.F %}
{% endif %}
{% endif %}
G500 P0 {do}
[gcode_macro G54]
gcode:
G53
{% set do="" %}
{% if params.G|int < 4 %}
{% set do=do~" G"~params.G %}
{% if params.X is defined %}
{% set do=do~" X"~params.X %}
{% endif %}
{% if params.Y is defined %}
{% set do=do~" Y"~params.Y %}
{% endif %}
{% if params.Z is defined %}
{% set do=do~" Z"~params.Z %}
{% endif %}
{% if params.F is defined %}
{% set do=do~" F"~params.F %}
{% endif %}
{% endif %}
G500 P1 {do}
[gcode_macro G55]
gcode:
{% set do="" %}
{% if params.G|int < 4 %}
{% set do=do~" G"~params.G %}
{% if params.X is defined %}
{% set do=do~" X"~params.X %}
{% endif %}
{% if params.Y is defined %}
{% set do=do~" Y"~params.Y %}
{% endif %}
{% if params.Z is defined %}
{% set do=do~" Z"~params.Z %}
{% endif %}
{% if params.F is defined %}
{% set do=do~" F"~params.F %}
{% endif %}
{% endif %}
G53
G500 P2 {do}
[gcode_macro G56]
gcode:
G53
{% set do="" %}
{% if params.G|int < 4 %}
{% set do=do~" G"~params.G %}
{% if params.X is defined %}
{% set do=do~" X"~params.X %}
{% endif %}
{% if params.Y is defined %}
{% set do=do~" Y"~params.Y %}
{% endif %}
{% if params.Z is defined %}
{% set do=do~" Z"~params.Z %}
{% endif %}
{% if params.F is defined %}
{% set do=do~" F"~params.F %}
{% endif %}
{% endif %}
G500 P3 {do}
[gcode_macro G57]
gcode:
G53
{% set do="" %}
{% if params.G|int < 4 %}
{% set do=do~" G"~params.G %}
{% if params.X is defined %}
{% set do=do~" X"~params.X %}
{% endif %}
{% if params.Y is defined %}
{% set do=do~" Y"~params.Y %}
{% endif %}
{% if params.Z is defined %}
{% set do=do~" Z"~params.Z %}
{% endif %}
{% if params.F is defined %}
{% set do=do~" F"~params.F %}
{% endif %}
{% endif %}
G500 P4 {do}
[gcode_macro G58]
gcode:
G53
{% set do="" %}
{% if params.G|int < 4 %}
{% set do=do~" G"~params.G %}
{% if params.X is defined %}
{% set do=do~" X"~params.X %}
{% endif %}
{% if params.Y is defined %}
{% set do=do~" Y"~params.Y %}
{% endif %}
{% if params.Z is defined %}
{% set do=do~" Z"~params.Z %}
{% endif %}
{% if params.F is defined %}
{% set do=do~" F"~params.F %}
{% endif %}
{% endif %}
G500 P5 {do}
[gcode_macro G59]
gcode:
G53
{% set do="" %}
{% if params.G|int < 4 %}
{% set do=do~" G"~params.G %}
{% if params.X is defined %}
{% set do=do~" X"~params.X %}
{% endif %}
{% if params.Y is defined %}
{% set do=do~" Y"~params.Y %}
{% endif %}
{% if params.Z is defined %}
{% set do=do~" Z"~params.Z %}
{% endif %}
{% if params.F is defined %}
{% set do=do~" F"~params.F %}
{% endif %}
{% endif %}
G500 P6 {do}