Bläddra i källkod

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 år sedan
förälder
incheckning
c5e08e8761
2 ändrade filer med 30 tillägg och 14 borttagningar
  1. 2
    2
      .travis.yml
  2. 28
    12
      Marlin/endstops.cpp

+ 2
- 2
.travis.yml Visa fil

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

+ 28
- 12
Marlin/endstops.cpp Visa fil

@@ -274,16 +274,23 @@ void Endstops::update() {
274 274
 
275 275
   #if CORE_IS_XY || CORE_IS_XZ
276 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 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 289
   #endif
283 290
       { // -direction
284 291
         #if ENABLED(DUAL_X_CARRIAGE)
285 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 294
         #endif
288 295
           {
289 296
             #if HAS_X_MIN
@@ -294,7 +301,7 @@ void Endstops::update() {
294 301
       else { // +direction
295 302
         #if ENABLED(DUAL_X_CARRIAGE)
296 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 305
         #endif
299 306
           {
300 307
             #if HAS_X_MAX
@@ -306,11 +313,20 @@ void Endstops::update() {
306 313
     }
307 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 325
   #if CORE_IS_XY || CORE_IS_YZ
310 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 330
   #else
315 331
       if (stepper.motor_direction(Y_AXIS))   // -direction
316 332
   #endif
@@ -330,9 +346,9 @@ void Endstops::update() {
330 346
 
331 347
   #if CORE_IS_XZ || CORE_IS_YZ
332 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 352
   #else
337 353
       if (stepper.motor_direction(Z_AXIS))
338 354
   #endif

Laddar…
Avbryt
Spara