浏览代码

CoreYX/YZ/ZX needs different endstop logic than CoreXY/YZ/XZ

In the endstop testing section, add the "reverse" logic in addition to "normal" core handling.

In CoreXY/YZ/XZ steppers rotating the same direction gives X movement. Opposing directions produces Y movement.

In CoreYX/ZY/ZX this is reversed. Same = Y, Opposite = X.

----

Fixes the issue where the Y endstop was being checked when moving in the X direction, etc.
Bob-the-Kuhn 8 年前
父节点
当前提交
c5e08e8761
共有 2 个文件被更改,包括 30 次插入14 次删除
  1. 2
    2
      .travis.yml
  2. 28
    12
      Marlin/endstops.cpp

+ 2
- 2
.travis.yml 查看文件

226
   - opt_enable COREXY
226
   - opt_enable COREXY
227
   - build_marlin
227
   - build_marlin
228
   #
228
   #
229
-  # Enable COREXZ
229
+  # Enable COREYX (swapped)
230
   #
230
   #
231
   - restore_configs
231
   - restore_configs
232
-  - opt_enable COREXZ
232
+  - opt_enable COREYX
233
   - build_marlin
233
   - build_marlin
234
   #
234
   #
235
   # Enable Z_DUAL_STEPPER_DRIVERS, Z_DUAL_ENDSTOPS
235
   # Enable Z_DUAL_STEPPER_DRIVERS, Z_DUAL_ENDSTOPS

+ 28
- 12
Marlin/endstops.cpp 查看文件

274
 
274
 
275
   #if CORE_IS_XY || CORE_IS_XZ
275
   #if CORE_IS_XY || CORE_IS_XZ
276
     // Head direction in -X axis for CoreXY and CoreXZ bots.
276
     // Head direction in -X axis for CoreXY and CoreXZ bots.
277
-    // If DeltaA == -DeltaB, the movement is only in Y or Z axis
278
-    if ((stepper.current_block->steps[CORE_AXIS_1] != stepper.current_block->steps[CORE_AXIS_2]) || (stepper.motor_direction(CORE_AXIS_1) == stepper.motor_direction(CORE_AXIS_2))) {
279
-      if (stepper.motor_direction(X_HEAD))
277
+    // If DeltaA == -DeltaB, the movement is only in only one axis
278
+    #if ENABLED(COREYX) || ENABLED(COREZX)
279
+      #define CORE_X_CMP !=
280
+      #define CORE_X_NOT !
281
+    #else
282
+      #define CORE_X_CMP ==
283
+      #define CORE_X_NOT
284
+    #endif
285
+    if (stepper.current_block->steps[CORE_AXIS_1] != stepper.current_block->steps[CORE_AXIS_2] || stepper.motor_direction(CORE_AXIS_1) CORE_X_CMP stepper.motor_direction(CORE_AXIS_2)) {
286
+      if (CORE_X_NOT stepper.motor_direction(X_HEAD))
280
   #else
287
   #else
281
-    if (stepper.motor_direction(X_AXIS))   // stepping along -X axis (regular Cartesian bot)
288
+      if (stepper.motor_direction(X_AXIS))   // stepping along -X axis (regular Cartesian bot)
282
   #endif
289
   #endif
283
       { // -direction
290
       { // -direction
284
         #if ENABLED(DUAL_X_CARRIAGE)
291
         #if ENABLED(DUAL_X_CARRIAGE)
285
           // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
292
           // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
286
-          if ((stepper.current_block->active_extruder == 0 && X_HOME_DIR == -1) || (stepper.current_block->active_extruder != 0 && X2_HOME_DIR == -1))
293
+          if ((stepper.current_block->active_extruder == 0 && X_HOME_DIR < 0) || (stepper.current_block->active_extruder != 0 && X2_HOME_DIR < 0))
287
         #endif
294
         #endif
288
           {
295
           {
289
             #if HAS_X_MIN
296
             #if HAS_X_MIN
294
       else { // +direction
301
       else { // +direction
295
         #if ENABLED(DUAL_X_CARRIAGE)
302
         #if ENABLED(DUAL_X_CARRIAGE)
296
           // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
303
           // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
297
-          if ((stepper.current_block->active_extruder == 0 && X_HOME_DIR == 1) || (stepper.current_block->active_extruder != 0 && X2_HOME_DIR == 1))
304
+          if ((stepper.current_block->active_extruder == 0 && X_HOME_DIR > 0) || (stepper.current_block->active_extruder != 0 && X2_HOME_DIR > 0))
298
         #endif
305
         #endif
299
           {
306
           {
300
             #if HAS_X_MAX
307
             #if HAS_X_MAX
306
     }
313
     }
307
   #endif
314
   #endif
308
 
315
 
316
+  // Handle swapped vs. typical Core axis order
317
+  #if ENABLED(COREYX) || ENABLED(COREZY) || ENABLED(COREZX)
318
+    #define CORE_YZ_CMP ==
319
+    #define CORE_YZ_NOT !
320
+  #elif CORE_IS_XY || CORE_IS_YZ || CORE_IS_XZ
321
+    #define CORE_YZ_CMP !=
322
+    #define CORE_YZ_NOT
323
+  #endif
324
+
309
   #if CORE_IS_XY || CORE_IS_YZ
325
   #if CORE_IS_XY || CORE_IS_YZ
310
     // Head direction in -Y axis for CoreXY / CoreYZ bots.
326
     // Head direction in -Y axis for CoreXY / CoreYZ bots.
311
-    // If DeltaA == DeltaB, the movement is only in X or Y axis
312
-    if ((stepper.current_block->steps[CORE_AXIS_1] != stepper.current_block->steps[CORE_AXIS_2]) || (stepper.motor_direction(CORE_AXIS_1) != stepper.motor_direction(CORE_AXIS_2))) {
313
-      if (stepper.motor_direction(Y_HEAD))
327
+    // If DeltaA == DeltaB, the movement is in only one axis
328
+    if (stepper.current_block->steps[CORE_AXIS_1] != stepper.current_block->steps[CORE_AXIS_2] || stepper.motor_direction(CORE_AXIS_1) CORE_YZ_CMP stepper.motor_direction(CORE_AXIS_2)) {
329
+      if (CORE_YZ_NOT stepper.motor_direction(Y_HEAD))
314
   #else
330
   #else
315
       if (stepper.motor_direction(Y_AXIS))   // -direction
331
       if (stepper.motor_direction(Y_AXIS))   // -direction
316
   #endif
332
   #endif
330
 
346
 
331
   #if CORE_IS_XZ || CORE_IS_YZ
347
   #if CORE_IS_XZ || CORE_IS_YZ
332
     // Head direction in -Z axis for CoreXZ or CoreYZ bots.
348
     // Head direction in -Z axis for CoreXZ or CoreYZ bots.
333
-    // If DeltaA == DeltaB, the movement is only in X or Y axis
334
-    if ((stepper.current_block->steps[CORE_AXIS_1] != stepper.current_block->steps[CORE_AXIS_2]) || (stepper.motor_direction(CORE_AXIS_1) != stepper.motor_direction(CORE_AXIS_2))) {
335
-      if (stepper.motor_direction(Z_HEAD))
349
+    // If DeltaA == DeltaB, the movement is in only one axis
350
+    if (stepper.current_block->steps[CORE_AXIS_1] != stepper.current_block->steps[CORE_AXIS_2] || stepper.motor_direction(CORE_AXIS_1) CORE_YZ_CMP stepper.motor_direction(CORE_AXIS_2)) {
351
+      if (CORE_YZ_NOT stepper.motor_direction(Z_HEAD))
336
   #else
352
   #else
337
       if (stepper.motor_direction(Z_AXIS))
353
       if (stepper.motor_direction(Z_AXIS))
338
   #endif
354
   #endif

正在加载...
取消
保存