|
@@ -257,25 +257,30 @@ xyze_int8_t Stepper::count_direction{0};
|
257
|
257
|
};
|
258
|
258
|
#endif
|
259
|
259
|
|
260
|
|
-#define DUAL_ENDSTOP_APPLY_STEP(A,V) \
|
261
|
|
- if (separate_multi_axis) { \
|
262
|
|
- if (ENABLED(A##_HOME_TO_MIN)) { \
|
263
|
|
- if (TERN0(HAS_##A##_MIN, !(TEST(endstops.state(), A##_MIN) && count_direction[_AXIS(A)] < 0) && !locked_##A##_motor)) A##_STEP_WRITE(V); \
|
264
|
|
- if (TERN0(HAS_##A##2_MIN, !(TEST(endstops.state(), A##2_MIN) && count_direction[_AXIS(A)] < 0) && !locked_##A##2_motor)) A##2_STEP_WRITE(V); \
|
265
|
|
- } \
|
266
|
|
- else { \
|
267
|
|
- if (TERN0(HAS_##A##_MAX, !(TEST(endstops.state(), A##_MAX) && count_direction[_AXIS(A)] > 0) && !locked_##A##_motor)) A##_STEP_WRITE(V); \
|
268
|
|
- if (TERN0(HAS_##A##2_MAX, !(TEST(endstops.state(), A##2_MAX) && count_direction[_AXIS(A)] > 0) && !locked_##A##2_motor)) A##2_STEP_WRITE(V); \
|
269
|
|
- } \
|
270
|
|
- } \
|
271
|
|
- else { \
|
272
|
|
- A##_STEP_WRITE(V); \
|
273
|
|
- A##2_STEP_WRITE(V); \
|
|
260
|
+#define MINDIR(A) (count_direction[_AXIS(A)] < 0)
|
|
261
|
+#define MAXDIR(A) (count_direction[_AXIS(A)] > 0)
|
|
262
|
+
|
|
263
|
+#define STEPTEST(A,M,I) TERN0(HAS_ ##A## ##I## _ ##M, !(TEST(endstops.state(), A## ##I## _ ##M) && M## DIR(A)) && !locked_ ##A## ##I## _motor)
|
|
264
|
+
|
|
265
|
+#define DUAL_ENDSTOP_APPLY_STEP(A,V) \
|
|
266
|
+ if (separate_multi_axis) { \
|
|
267
|
+ if (ENABLED(A##_HOME_TO_MIN)) { \
|
|
268
|
+ if (STEPTEST(A,MIN, )) A## _STEP_WRITE(V); \
|
|
269
|
+ if (STEPTEST(A,MIN,2)) A##2_STEP_WRITE(V); \
|
|
270
|
+ } \
|
|
271
|
+ else if (ENABLED(A##_HOME_TO_MAX)) { \
|
|
272
|
+ if (STEPTEST(A,MAX, )) A## _STEP_WRITE(V); \
|
|
273
|
+ if (STEPTEST(A,MAX,2)) A##2_STEP_WRITE(V); \
|
|
274
|
+ } \
|
|
275
|
+ } \
|
|
276
|
+ else { \
|
|
277
|
+ A##_STEP_WRITE(V); \
|
|
278
|
+ A##2_STEP_WRITE(V); \
|
274
|
279
|
}
|
275
|
280
|
|
276
|
281
|
#define DUAL_SEPARATE_APPLY_STEP(A,V) \
|
277
|
282
|
if (separate_multi_axis) { \
|
278
|
|
- if (!locked_##A##_motor) A##_STEP_WRITE(V); \
|
|
283
|
+ if (!locked_##A## _motor) A## _STEP_WRITE(V); \
|
279
|
284
|
if (!locked_##A##2_motor) A##2_STEP_WRITE(V); \
|
280
|
285
|
} \
|
281
|
286
|
else { \
|
|
@@ -283,60 +288,68 @@ xyze_int8_t Stepper::count_direction{0};
|
283
|
288
|
A##2_STEP_WRITE(V); \
|
284
|
289
|
}
|
285
|
290
|
|
286
|
|
-#define TRIPLE_ENDSTOP_APPLY_STEP(A,V) \
|
287
|
|
- if (separate_multi_axis) { \
|
288
|
|
- if (ENABLED(A##_HOME_TO_MIN)) { \
|
289
|
|
- if (!(TEST(endstops.state(), A##_MIN) && count_direction[_AXIS(A)] < 0) && !locked_##A##_motor) A##_STEP_WRITE(V); \
|
290
|
|
- if (!(TEST(endstops.state(), A##2_MIN) && count_direction[_AXIS(A)] < 0) && !locked_##A##2_motor) A##2_STEP_WRITE(V); \
|
291
|
|
- if (!(TEST(endstops.state(), A##3_MIN) && count_direction[_AXIS(A)] < 0) && !locked_##A##3_motor) A##3_STEP_WRITE(V); \
|
292
|
|
- } \
|
293
|
|
- else { \
|
294
|
|
- if (!(TEST(endstops.state(), A##_MAX) && count_direction[_AXIS(A)] > 0) && !locked_##A##_motor) A##_STEP_WRITE(V); \
|
295
|
|
- if (!(TEST(endstops.state(), A##2_MAX) && count_direction[_AXIS(A)] > 0) && !locked_##A##2_motor) A##2_STEP_WRITE(V); \
|
296
|
|
- if (!(TEST(endstops.state(), A##3_MAX) && count_direction[_AXIS(A)] > 0) && !locked_##A##3_motor) A##3_STEP_WRITE(V); \
|
297
|
|
- } \
|
298
|
|
- } \
|
299
|
|
- else { \
|
300
|
|
- A##_STEP_WRITE(V); \
|
301
|
|
- A##2_STEP_WRITE(V); \
|
302
|
|
- A##3_STEP_WRITE(V); \
|
|
291
|
+#define TRIPLE_ENDSTOP_APPLY_STEP(A,V) \
|
|
292
|
+ if (separate_multi_axis) { \
|
|
293
|
+ if (ENABLED(A##_HOME_TO_MIN)) { \
|
|
294
|
+ if (STEPTEST(A,MIN, )) A## _STEP_WRITE(V); \
|
|
295
|
+ if (STEPTEST(A,MIN,2)) A##2_STEP_WRITE(V); \
|
|
296
|
+ if (STEPTEST(A,MIN,3)) A##3_STEP_WRITE(V); \
|
|
297
|
+ } \
|
|
298
|
+ else if (ENABLED(A##_HOME_TO_MAX)) { \
|
|
299
|
+ if (STEPTEST(A,MAX, )) A## _STEP_WRITE(V); \
|
|
300
|
+ if (STEPTEST(A,MAX,2)) A##2_STEP_WRITE(V); \
|
|
301
|
+ if (STEPTEST(A,MAX,3)) A##3_STEP_WRITE(V); \
|
|
302
|
+ } \
|
|
303
|
+ } \
|
|
304
|
+ else { \
|
|
305
|
+ A##_STEP_WRITE(V); \
|
|
306
|
+ A##2_STEP_WRITE(V); \
|
|
307
|
+ A##3_STEP_WRITE(V); \
|
303
|
308
|
}
|
304
|
309
|
|
305
|
310
|
#define TRIPLE_SEPARATE_APPLY_STEP(A,V) \
|
306
|
311
|
if (separate_multi_axis) { \
|
307
|
|
- if (!locked_##A##_motor) A##_STEP_WRITE(V); \
|
|
312
|
+ if (!locked_##A## _motor) A## _STEP_WRITE(V); \
|
308
|
313
|
if (!locked_##A##2_motor) A##2_STEP_WRITE(V); \
|
309
|
314
|
if (!locked_##A##3_motor) A##3_STEP_WRITE(V); \
|
310
|
315
|
} \
|
311
|
316
|
else { \
|
312
|
|
- A##_STEP_WRITE(V); \
|
|
317
|
+ A## _STEP_WRITE(V); \
|
313
|
318
|
A##2_STEP_WRITE(V); \
|
314
|
319
|
A##3_STEP_WRITE(V); \
|
315
|
320
|
}
|
316
|
321
|
|
317
|
|
-#define QUAD_ENDSTOP_APPLY_STEP(A,V) \
|
318
|
|
- if (separate_multi_axis) { \
|
319
|
|
- if (!(TEST(endstops.state(), (TERN(A##_HOME_TO_MIN, A##_MIN, A##_MAX))) && count_direction[_AXIS(A)] < 0) && !locked_##A##_motor) A##_STEP_WRITE(V); \
|
320
|
|
- if (!(TEST(endstops.state(), (TERN(A##_HOME_TO_MIN, A##2_MIN, A##2_MAX))) && count_direction[_AXIS(A)] < 0) && !locked_##A##2_motor) A##2_STEP_WRITE(V); \
|
321
|
|
- if (!(TEST(endstops.state(), (TERN(A##_HOME_TO_MIN, A##3_MIN, A##3_MAX))) && count_direction[_AXIS(A)] < 0) && !locked_##A##3_motor) A##3_STEP_WRITE(V); \
|
322
|
|
- if (!(TEST(endstops.state(), (TERN(A##_HOME_TO_MIN, A##4_MIN, A##4_MAX))) && count_direction[_AXIS(A)] < 0) && !locked_##A##4_motor) A##4_STEP_WRITE(V); \
|
323
|
|
- } \
|
324
|
|
- else { \
|
325
|
|
- A##_STEP_WRITE(V); \
|
326
|
|
- A##2_STEP_WRITE(V); \
|
327
|
|
- A##3_STEP_WRITE(V); \
|
328
|
|
- A##4_STEP_WRITE(V); \
|
|
322
|
+#define QUAD_ENDSTOP_APPLY_STEP(A,V) \
|
|
323
|
+ if (separate_multi_axis) { \
|
|
324
|
+ if (ENABLED(A##_HOME_TO_MIN)) { \
|
|
325
|
+ if (STEPTEST(A,MIN, )) A## _STEP_WRITE(V); \
|
|
326
|
+ if (STEPTEST(A,MIN,2)) A##2_STEP_WRITE(V); \
|
|
327
|
+ if (STEPTEST(A,MIN,3)) A##3_STEP_WRITE(V); \
|
|
328
|
+ if (STEPTEST(A,MIN,4)) A##4_STEP_WRITE(V); \
|
|
329
|
+ } \
|
|
330
|
+ else if (ENABLED(A##_HOME_TO_MAX)) { \
|
|
331
|
+ if (STEPTEST(A,MAX, )) A## _STEP_WRITE(V); \
|
|
332
|
+ if (STEPTEST(A,MAX,2)) A##2_STEP_WRITE(V); \
|
|
333
|
+ if (STEPTEST(A,MAX,3)) A##3_STEP_WRITE(V); \
|
|
334
|
+ if (STEPTEST(A,MAX,4)) A##4_STEP_WRITE(V); \
|
|
335
|
+ } \
|
|
336
|
+ } \
|
|
337
|
+ else { \
|
|
338
|
+ A## _STEP_WRITE(V); \
|
|
339
|
+ A##2_STEP_WRITE(V); \
|
|
340
|
+ A##3_STEP_WRITE(V); \
|
|
341
|
+ A##4_STEP_WRITE(V); \
|
329
|
342
|
}
|
330
|
343
|
|
331
|
344
|
#define QUAD_SEPARATE_APPLY_STEP(A,V) \
|
332
|
345
|
if (separate_multi_axis) { \
|
333
|
|
- if (!locked_##A##_motor) A##_STEP_WRITE(V); \
|
|
346
|
+ if (!locked_##A## _motor) A## _STEP_WRITE(V); \
|
334
|
347
|
if (!locked_##A##2_motor) A##2_STEP_WRITE(V); \
|
335
|
348
|
if (!locked_##A##3_motor) A##3_STEP_WRITE(V); \
|
336
|
349
|
if (!locked_##A##4_motor) A##4_STEP_WRITE(V); \
|
337
|
350
|
} \
|
338
|
351
|
else { \
|
339
|
|
- A##_STEP_WRITE(V); \
|
|
352
|
+ A## _STEP_WRITE(V); \
|
340
|
353
|
A##2_STEP_WRITE(V); \
|
341
|
354
|
A##3_STEP_WRITE(V); \
|
342
|
355
|
A##4_STEP_WRITE(V); \
|