Browse Source

Merge CORE_XZ (PR#2300)

Richard Wackerbarth 10 years ago
parent
commit
39092efe88

+ 3
- 0
Marlin/Configuration.h View File

306
 // Uncomment this option to enable CoreXY kinematics
306
 // Uncomment this option to enable CoreXY kinematics
307
 // #define COREXY
307
 // #define COREXY
308
 
308
 
309
+// Uncomment this option to enable CoreXZ kinematics
310
+// #define COREXZ
311
+
309
 // Enable this option for Toshiba steppers
312
 // Enable this option for Toshiba steppers
310
 //#define CONFIG_STEPPERS_TOSHIBA
313
 //#define CONFIG_STEPPERS_TOSHIBA
311
 
314
 

+ 1
- 1
Marlin/Marlin.h View File

196
  * A_AXIS and B_AXIS are used by COREXY printers
196
  * A_AXIS and B_AXIS are used by COREXY printers
197
  * X_HEAD and Y_HEAD is used for systems that don't have a 1:1 relationship between X_AXIS and X Head movement, like CoreXY bots.
197
  * X_HEAD and Y_HEAD is used for systems that don't have a 1:1 relationship between X_AXIS and X Head movement, like CoreXY bots.
198
  */
198
  */
199
-enum AxisEnum {X_AXIS=0, Y_AXIS=1, A_AXIS=0, B_AXIS=1, Z_AXIS=2, E_AXIS=3, X_HEAD=4, Y_HEAD=5};
199
+enum AxisEnum {X_AXIS=0, A_AXIS=0, Y_AXIS=1, B_AXIS=1, Z_AXIS=2, C_AXIS=2, E_AXIS=3, X_HEAD=4, Y_HEAD=5, Z_HEAD=5};
200
 
200
 
201
 enum EndstopEnum {X_MIN=0, Y_MIN=1, Z_MIN=2, Z_PROBE=3, X_MAX=4, Y_MAX=5, Z_MAX=6, Z2_MIN=7, Z2_MAX=8};
201
 enum EndstopEnum {X_MIN=0, Y_MIN=1, Z_MIN=2, Z_PROBE=3, X_MAX=4, Y_MAX=5, Z_MAX=6, Z2_MIN=7, Z2_MAX=8};
202
 
202
 

+ 3
- 0
Marlin/configurator/config/Configuration.h View File

306
 // Uncomment this option to enable CoreXY kinematics
306
 // Uncomment this option to enable CoreXY kinematics
307
 // #define COREXY
307
 // #define COREXY
308
 
308
 
309
+// Uncomment this option to enable CoreXZ kinematics
310
+// #define COREXZ
311
+
309
 // Enable this option for Toshiba steppers
312
 // Enable this option for Toshiba steppers
310
 //#define CONFIG_STEPPERS_TOSHIBA
313
 //#define CONFIG_STEPPERS_TOSHIBA
311
 
314
 

+ 3
- 0
Marlin/example_configurations/Felix/Configuration.h View File

288
 // Uncomment this option to enable CoreXY kinematics
288
 // Uncomment this option to enable CoreXY kinematics
289
 // #define COREXY
289
 // #define COREXY
290
 
290
 
291
+// Uncomment this option to enable CoreXZ kinematics
292
+// #define COREXZ
293
+
291
 // Enable this option for Toshiba steppers
294
 // Enable this option for Toshiba steppers
292
 //#define CONFIG_STEPPERS_TOSHIBA
295
 //#define CONFIG_STEPPERS_TOSHIBA
293
 
296
 

+ 3
- 0
Marlin/example_configurations/Felix/Configuration_DUAL.h View File

273
 // Uncomment this option to enable CoreXY kinematics
273
 // Uncomment this option to enable CoreXY kinematics
274
 // #define COREXY
274
 // #define COREXY
275
 
275
 
276
+// Uncomment this option to enable CoreXZ kinematics
277
+// #define COREXZ
278
+
276
 // Enable this option for Toshiba steppers
279
 // Enable this option for Toshiba steppers
277
 //#define CONFIG_STEPPERS_TOSHIBA
280
 //#define CONFIG_STEPPERS_TOSHIBA
278
 
281
 

+ 3
- 0
Marlin/example_configurations/Hephestos/Configuration.h View File

298
 // Uncomment this option to enable CoreXY kinematics
298
 // Uncomment this option to enable CoreXY kinematics
299
 // #define COREXY
299
 // #define COREXY
300
 
300
 
301
+// Uncomment this option to enable CoreXZ kinematics
302
+// #define COREXZ
303
+
301
 // Enable this option for Toshiba steppers
304
 // Enable this option for Toshiba steppers
302
 //#define CONFIG_STEPPERS_TOSHIBA
305
 //#define CONFIG_STEPPERS_TOSHIBA
303
 
306
 

+ 3
- 0
Marlin/example_configurations/K8200/Configuration.h View File

294
 // Uncomment this option to enable CoreXY kinematics
294
 // Uncomment this option to enable CoreXY kinematics
295
 // #define COREXY
295
 // #define COREXY
296
 
296
 
297
+// Uncomment this option to enable CoreXZ kinematics
298
+// #define COREXZ
299
+
297
 // Enable this option for Toshiba steppers
300
 // Enable this option for Toshiba steppers
298
 //#define CONFIG_STEPPERS_TOSHIBA
301
 //#define CONFIG_STEPPERS_TOSHIBA
299
 
302
 

+ 3
- 0
Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h View File

306
 // Uncomment this option to enable CoreXY kinematics
306
 // Uncomment this option to enable CoreXY kinematics
307
 // #define COREXY
307
 // #define COREXY
308
 
308
 
309
+// Uncomment this option to enable CoreXZ kinematics
310
+// #define COREXZ
311
+
309
 // Enable this option for Toshiba steppers
312
 // Enable this option for Toshiba steppers
310
 //#define CONFIG_STEPPERS_TOSHIBA
313
 //#define CONFIG_STEPPERS_TOSHIBA
311
 
314
 

+ 3
- 0
Marlin/example_configurations/SCARA/Configuration.h View File

314
 // Uncomment this option to enable CoreXY kinematics
314
 // Uncomment this option to enable CoreXY kinematics
315
 // #define COREXY
315
 // #define COREXY
316
 
316
 
317
+// Uncomment this option to enable CoreXZ kinematics
318
+// #define COREXZ
319
+
317
 // Enable this option for Toshiba steppers
320
 // Enable this option for Toshiba steppers
318
 //#define CONFIG_STEPPERS_TOSHIBA
321
 //#define CONFIG_STEPPERS_TOSHIBA
319
 
322
 

+ 3
- 0
Marlin/example_configurations/WITBOX/Configuration.h View File

298
 // Uncomment this option to enable CoreXY kinematics
298
 // Uncomment this option to enable CoreXY kinematics
299
 // #define COREXY
299
 // #define COREXY
300
 
300
 
301
+// Uncomment this option to enable CoreXZ kinematics
302
+// #define COREXZ
303
+
301
 // Enable this option for Toshiba steppers
304
 // Enable this option for Toshiba steppers
302
 //#define CONFIG_STEPPERS_TOSHIBA
305
 //#define CONFIG_STEPPERS_TOSHIBA
303
 
306
 

+ 3
- 0
Marlin/example_configurations/adafruit/ST7565/Configuration.h View File

306
 // Uncomment this option to enable CoreXY kinematics
306
 // Uncomment this option to enable CoreXY kinematics
307
 // #define COREXY
307
 // #define COREXY
308
 
308
 
309
+// Uncomment this option to enable CoreXZ kinematics
310
+// #define COREXZ
311
+
309
 // Enable this option for Toshiba steppers
312
 // Enable this option for Toshiba steppers
310
 //#define CONFIG_STEPPERS_TOSHIBA
313
 //#define CONFIG_STEPPERS_TOSHIBA
311
 
314
 

+ 3
- 0
Marlin/example_configurations/delta/biv2.5/Configuration.h View File

306
 // Uncomment this option to enable CoreXY kinematics
306
 // Uncomment this option to enable CoreXY kinematics
307
 // #define COREXY
307
 // #define COREXY
308
 
308
 
309
+// Uncomment this option to enable CoreXZ kinematics
310
+// #define COREXZ
311
+
309
 //===========================================================================
312
 //===========================================================================
310
 //============================== Delta Settings =============================
313
 //============================== Delta Settings =============================
311
 //===========================================================================
314
 //===========================================================================

+ 3
- 0
Marlin/example_configurations/delta/generic/Configuration.h View File

306
 // Uncomment this option to enable CoreXY kinematics
306
 // Uncomment this option to enable CoreXY kinematics
307
 // #define COREXY
307
 // #define COREXY
308
 
308
 
309
+// Uncomment this option to enable CoreXZ kinematics
310
+// #define COREXZ
311
+
309
 //===========================================================================
312
 //===========================================================================
310
 //============================== Delta Settings =============================
313
 //============================== Delta Settings =============================
311
 //===========================================================================
314
 //===========================================================================

+ 3
- 0
Marlin/example_configurations/delta/kossel_mini/Configuration.h View File

306
 // Uncomment this option to enable CoreXY kinematics
306
 // Uncomment this option to enable CoreXY kinematics
307
 // #define COREXY
307
 // #define COREXY
308
 
308
 
309
+// Uncomment this option to enable CoreXZ kinematics
310
+// #define COREXZ
311
+
309
 //===========================================================================
312
 //===========================================================================
310
 //============================== Delta Settings =============================
313
 //============================== Delta Settings =============================
311
 //===========================================================================
314
 //===========================================================================

+ 3
- 0
Marlin/example_configurations/delta/kossel_pro/Configuration.h View File

293
 // Uncomment this option to enable CoreXY kinematics
293
 // Uncomment this option to enable CoreXY kinematics
294
 // #define COREXY
294
 // #define COREXY
295
 
295
 
296
+// Uncomment this option to enable CoreXZ kinematics
297
+// #define COREXZ
298
+
296
 //===========================================================================
299
 //===========================================================================
297
 //============================== Delta Settings =============================
300
 //============================== Delta Settings =============================
298
 //===========================================================================
301
 //===========================================================================

+ 3
- 0
Marlin/example_configurations/makibox/Configuration.h View File

309
 // Uncomment this option to enable CoreXY kinematics
309
 // Uncomment this option to enable CoreXY kinematics
310
 // #define COREXY
310
 // #define COREXY
311
 
311
 
312
+// Uncomment this option to enable CoreXZ kinematics
313
+// #define COREXZ
314
+
312
 // Enable this option for Toshiba steppers
315
 // Enable this option for Toshiba steppers
313
 //#define CONFIG_STEPPERS_TOSHIBA
316
 //#define CONFIG_STEPPERS_TOSHIBA
314
 
317
 

+ 3
- 0
Marlin/example_configurations/tvrrug/Round2/Configuration.h View File

296
 // Uncomment this option to enable CoreXY kinematics
296
 // Uncomment this option to enable CoreXY kinematics
297
 // #define COREXY
297
 // #define COREXY
298
 
298
 
299
+// Uncomment this option to enable CoreXZ kinematics
300
+// #define COREXZ
301
+
299
 // Enable this option for Toshiba steppers
302
 // Enable this option for Toshiba steppers
300
 #define CONFIG_STEPPERS_TOSHIBA
303
 #define CONFIG_STEPPERS_TOSHIBA
301
 
304
 

+ 39
- 10
Marlin/planner.cpp View File

541
     // these equations follow the form of the dA and dB equations on http://www.corexy.com/theory.html
541
     // these equations follow the form of the dA and dB equations on http://www.corexy.com/theory.html
542
     block->steps[A_AXIS] = labs(dx + dy);
542
     block->steps[A_AXIS] = labs(dx + dy);
543
     block->steps[B_AXIS] = labs(dx - dy);
543
     block->steps[B_AXIS] = labs(dx - dy);
544
+    block->steps[Z_AXIS] = labs(dz);
545
+  #elif defined(COREXZ)
546
+    // corexz planning
547
+    block->steps[A_AXIS] = labs(dx + dz);
548
+    block->steps[Y_AXIS] = labs(dy);
549
+    block->steps[C_AXIS] = labs(dx - dz);
544
   #else
550
   #else
545
     // default non-h-bot planning
551
     // default non-h-bot planning
546
     block->steps[X_AXIS] = labs(dx);
552
     block->steps[X_AXIS] = labs(dx);
547
     block->steps[Y_AXIS] = labs(dy);
553
     block->steps[Y_AXIS] = labs(dy);
554
+    block->steps[Z_AXIS] = labs(dz);
548
   #endif
555
   #endif
549
 
556
 
550
-  block->steps[Z_AXIS] = labs(dz);
551
   block->steps[E_AXIS] = labs(de);
557
   block->steps[E_AXIS] = labs(de);
552
   block->steps[E_AXIS] *= volumetric_multiplier[extruder];
558
   block->steps[E_AXIS] *= volumetric_multiplier[extruder];
553
   block->steps[E_AXIS] *= extruder_multiplier[extruder];
559
   block->steps[E_AXIS] *= extruder_multiplier[extruder];
568
   #ifdef COREXY
574
   #ifdef COREXY
569
     if (dx < 0) db |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis
575
     if (dx < 0) db |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis
570
     if (dy < 0) db |= BIT(Y_HEAD); // ...and Y
576
     if (dy < 0) db |= BIT(Y_HEAD); // ...and Y
577
+    if (dz < 0) db |= BIT(Z_AXIS);
571
     if (dx + dy < 0) db |= BIT(A_AXIS); // Motor A direction
578
     if (dx + dy < 0) db |= BIT(A_AXIS); // Motor A direction
572
     if (dx - dy < 0) db |= BIT(B_AXIS); // Motor B direction
579
     if (dx - dy < 0) db |= BIT(B_AXIS); // Motor B direction
580
+  #elif defined(COREXZ)
581
+    if (dx < 0) db |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis
582
+    if (dy < 0) db |= BIT(Y_AXIS);
583
+    if (dz < 0) db |= BIT(Z_HEAD); // ...and Z
584
+    if (dx + dz < 0) db |= BIT(A_AXIS); // Motor A direction
585
+    if (dx - dz < 0) db |= BIT(C_AXIS); // Motor B direction
573
   #else
586
   #else
574
     if (dx < 0) db |= BIT(X_AXIS);
587
     if (dx < 0) db |= BIT(X_AXIS);
575
     if (dy < 0) db |= BIT(Y_AXIS); 
588
     if (dy < 0) db |= BIT(Y_AXIS); 
589
+    if (dz < 0) db |= BIT(Z_AXIS);
576
   #endif
590
   #endif
577
-  if (dz < 0) db |= BIT(Z_AXIS);
578
   if (de < 0) db |= BIT(E_AXIS); 
591
   if (de < 0) db |= BIT(E_AXIS); 
579
   block->direction_bits = db;
592
   block->direction_bits = db;
580
 
593
 
586
       enable_x();
599
       enable_x();
587
       enable_y();
600
       enable_y();
588
     }
601
     }
602
+    #ifndef Z_LATE_ENABLE
603
+      if (block->steps[Z_AXIS]) enable_z();
604
+    #endif
605
+  #elif defined(COREXZ)
606
+    if (block->steps[A_AXIS] || block->steps[C_AXIS]) {
607
+      enable_x();
608
+      enable_z();
609
+    }
589
   #else
610
   #else
590
     if (block->steps[X_AXIS]) enable_x();
611
     if (block->steps[X_AXIS]) enable_x();
591
     if (block->steps[Y_AXIS]) enable_y();
612
     if (block->steps[Y_AXIS]) enable_y();
592
-  #endif
593
-
594
-  #ifndef Z_LATE_ENABLE
595
-    if (block->steps[Z_AXIS]) enable_z();
613
+    #ifndef Z_LATE_ENABLE
614
+      if (block->steps[Z_AXIS]) enable_z();
615
+    #endif
596
   #endif
616
   #endif
597
 
617
 
598
   // Enable extruder(s)
618
   // Enable extruder(s)
676
     float delta_mm[6];
696
     float delta_mm[6];
677
     delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_AXIS];
697
     delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_AXIS];
678
     delta_mm[Y_HEAD] = dy / axis_steps_per_unit[B_AXIS];
698
     delta_mm[Y_HEAD] = dy / axis_steps_per_unit[B_AXIS];
699
+    delta_mm[Z_AXIS] = dz / axis_steps_per_unit[Z_AXIS];
679
     delta_mm[A_AXIS] = (dx + dy) / axis_steps_per_unit[A_AXIS];
700
     delta_mm[A_AXIS] = (dx + dy) / axis_steps_per_unit[A_AXIS];
680
     delta_mm[B_AXIS] = (dx - dy) / axis_steps_per_unit[B_AXIS];
701
     delta_mm[B_AXIS] = (dx - dy) / axis_steps_per_unit[B_AXIS];
702
+  #elif defined(COREXZ)
703
+    float delta_mm[6];
704
+    delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_AXIS];
705
+    delta_mm[Y_AXIS] = dy / axis_steps_per_unit[Y_AXIS];
706
+    delta_mm[Z_HEAD] = dz / axis_steps_per_unit[C_AXIS];
707
+    delta_mm[A_AXIS] = (dx + dz) / axis_steps_per_unit[A_AXIS];
708
+    delta_mm[C_AXIS] = (dx - dz) / axis_steps_per_unit[C_AXIS];
681
   #else
709
   #else
682
     float delta_mm[4];
710
     float delta_mm[4];
683
     delta_mm[X_AXIS] = dx / axis_steps_per_unit[X_AXIS];
711
     delta_mm[X_AXIS] = dx / axis_steps_per_unit[X_AXIS];
684
     delta_mm[Y_AXIS] = dy / axis_steps_per_unit[Y_AXIS];
712
     delta_mm[Y_AXIS] = dy / axis_steps_per_unit[Y_AXIS];
713
+    delta_mm[Z_AXIS] = dz / axis_steps_per_unit[Z_AXIS];
685
   #endif
714
   #endif
686
-  delta_mm[Z_AXIS] = dz / axis_steps_per_unit[Z_AXIS];
687
   delta_mm[E_AXIS] = (de / axis_steps_per_unit[E_AXIS]) * volumetric_multiplier[extruder] * extruder_multiplier[extruder] / 100.0;
715
   delta_mm[E_AXIS] = (de / axis_steps_per_unit[E_AXIS]) * volumetric_multiplier[extruder] * extruder_multiplier[extruder] / 100.0;
688
 
716
 
689
   if (block->steps[X_AXIS] <= dropsegments && block->steps[Y_AXIS] <= dropsegments && block->steps[Z_AXIS] <= dropsegments) {
717
   if (block->steps[X_AXIS] <= dropsegments && block->steps[Y_AXIS] <= dropsegments && block->steps[Z_AXIS] <= dropsegments) {
692
   else {
720
   else {
693
     block->millimeters = sqrt(
721
     block->millimeters = sqrt(
694
       #ifdef COREXY
722
       #ifdef COREXY
695
-        square(delta_mm[X_HEAD]) + square(delta_mm[Y_HEAD])
723
+        square(delta_mm[X_HEAD]) + square(delta_mm[Y_HEAD]) + square(delta_mm[Z_AXIS])
724
+      #elif defined(COREXZ)
725
+        square(delta_mm[X_HEAD]) + square(delta_mm[Y_AXIS]) + square(delta_mm[Z_HEAD])
696
       #else
726
       #else
697
-        square(delta_mm[X_AXIS]) + square(delta_mm[Y_AXIS])
727
+        square(delta_mm[X_AXIS]) + square(delta_mm[Y_AXIS]) + square(delta_mm[Z_AXIS])
698
       #endif
728
       #endif
699
-      + square(delta_mm[Z_AXIS])
700
     );
729
     );
701
   }
730
   }
702
   float inverse_millimeters = 1.0 / block->millimeters;  // Inverse millimeters to remove multiple divides 
731
   float inverse_millimeters = 1.0 / block->millimeters;  // Inverse millimeters to remove multiple divides 

+ 106
- 85
Marlin/stepper.cpp View File

342
   return timer;
342
   return timer;
343
 }
343
 }
344
 
344
 
345
-// set the stepper direction of each axis
345
+/**
346
+ * Set the stepper direction of each axis
347
+ *
348
+ *   X_AXIS=A_AXIS and Y_AXIS=B_AXIS for COREXY
349
+ *   X_AXIS=A_AXIS and Z_AXIS=C_AXIS for COREXZ
350
+ */
346
 void set_stepper_direction() {
351
 void set_stepper_direction() {
347
-  
348
-  // Set the direction bits (X_AXIS=A_AXIS and Y_AXIS=B_AXIS for COREXY)
349
-  if (TEST(out_bits, X_AXIS)) {
350
-    X_APPLY_DIR(INVERT_X_DIR,0);
352
+
353
+  if (TEST(out_bits, X_AXIS)) { // A_AXIS
354
+    X_APPLY_DIR(INVERT_X_DIR, 0);
351
     count_direction[X_AXIS] = -1;
355
     count_direction[X_AXIS] = -1;
352
   }
356
   }
353
   else {
357
   else {
354
-    X_APPLY_DIR(!INVERT_X_DIR,0);
358
+    X_APPLY_DIR(!INVERT_X_DIR, 0);
355
     count_direction[X_AXIS] = 1;
359
     count_direction[X_AXIS] = 1;
356
   }
360
   }
357
 
361
 
358
-  if (TEST(out_bits, Y_AXIS)) {
359
-    Y_APPLY_DIR(INVERT_Y_DIR,0);
362
+  if (TEST(out_bits, Y_AXIS)) { // B_AXIS
363
+    Y_APPLY_DIR(INVERT_Y_DIR, 0);
360
     count_direction[Y_AXIS] = -1;
364
     count_direction[Y_AXIS] = -1;
361
   }
365
   }
362
   else {
366
   else {
363
-    Y_APPLY_DIR(!INVERT_Y_DIR,0);
367
+    Y_APPLY_DIR(!INVERT_Y_DIR, 0);
364
     count_direction[Y_AXIS] = 1;
368
     count_direction[Y_AXIS] = 1;
365
   }
369
   }
366
   
370
   
367
-  if (TEST(out_bits, Z_AXIS)) {
368
-    Z_APPLY_DIR(INVERT_Z_DIR,0);
371
+  if (TEST(out_bits, Z_AXIS)) { // C_AXIS
372
+    Z_APPLY_DIR(INVERT_Z_DIR, 0);
369
     count_direction[Z_AXIS] = -1;
373
     count_direction[Z_AXIS] = -1;
370
   }
374
   }
371
   else {
375
   else {
372
-    Z_APPLY_DIR(!INVERT_Z_DIR,0);
376
+    Z_APPLY_DIR(!INVERT_Z_DIR, 0);
373
     count_direction[Z_AXIS] = 1;
377
     count_direction[Z_AXIS] = 1;
374
   }
378
   }
375
   
379
   
503
         // If DeltaX == -DeltaY, the movement is only in Y axis
507
         // If DeltaX == -DeltaY, the movement is only in Y axis
504
         if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) == TEST(out_bits, B_AXIS))) {
508
         if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) == TEST(out_bits, B_AXIS))) {
505
           if (TEST(out_bits, X_HEAD))
509
           if (TEST(out_bits, X_HEAD))
510
+      #elif defined(COREXZ)
511
+        // Head direction in -X axis for CoreXZ bots.
512
+        // If DeltaX == -DeltaZ, the movement is only in Z axis
513
+        if ((current_block->steps[A_AXIS] != current_block->steps[C_AXIS]) || (TEST(out_bits, A_AXIS) == TEST(out_bits, C_AXIS))) {
514
+          if (TEST(out_bits, X_HEAD))
506
       #else
515
       #else
507
           if (TEST(out_bits, X_AXIS))   // stepping along -X axis (regular Cartesian bot)
516
           if (TEST(out_bits, X_AXIS))   // stepping along -X axis (regular Cartesian bot)
508
       #endif
517
       #endif
528
                 #endif
537
                 #endif
529
               }
538
               }
530
           }
539
           }
531
-      #ifdef COREXY
540
+      #if defined(COREXY) || defined(COREXZ)
532
         }
541
         }
542
+      #endif
543
+
544
+      #ifdef COREXY
533
         // Head direction in -Y axis for CoreXY bots.
545
         // Head direction in -Y axis for CoreXY bots.
534
         // If DeltaX == DeltaY, the movement is only in X axis
546
         // If DeltaX == DeltaY, the movement is only in X axis
535
         if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) != TEST(out_bits, B_AXIS))) {
547
         if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) != TEST(out_bits, B_AXIS))) {
547
               UPDATE_ENDSTOP(Y, MAX);
559
               UPDATE_ENDSTOP(Y, MAX);
548
             #endif
560
             #endif
549
           }
561
           }
550
-      #ifdef COREXY
562
+      #if defined(COREXY) || defined(COREXZ)
551
         }
563
         }
552
       #endif
564
       #endif
553
-      if (TEST(out_bits, Z_AXIS)) { // z -direction
554
-        #if HAS_Z_MIN
555
-
556
-          #ifdef Z_DUAL_ENDSTOPS
557
-            SET_ENDSTOP_BIT(Z, MIN);
558
-              #if HAS_Z2_MIN
559
-                SET_ENDSTOP_BIT(Z2, MIN);
560
-              #else
561
-                COPY_BIT(current_endstop_bits, Z_MIN, Z2_MIN);
562
-              #endif
563
-
564
-            byte z_test = TEST_ENDSTOP(Z_MIN) << 0 + TEST_ENDSTOP(Z2_MIN) << 1; // bit 0 for Z, bit 1 for Z2
565
-
566
-            if (z_test && current_block->steps[Z_AXIS] > 0) { // z_test = Z_MIN || Z2_MIN
567
-              endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
568
-              endstop_hit_bits |= BIT(Z_MIN);
569
-              if (!performing_homing || (z_test == 0x3))  //if not performing home or if both endstops were trigged during homing...
570
-                step_events_completed = current_block->step_event_count;
571
-            }
572
-          #else // !Z_DUAL_ENDSTOPS
573
-
574
-            UPDATE_ENDSTOP(Z, MIN);
575
-          #endif // !Z_DUAL_ENDSTOPS
576
-        #endif // Z_MIN_PIN
577
-
578
-        #ifdef Z_PROBE_ENDSTOP
579
-          UPDATE_ENDSTOP(Z, PROBE);
580
-
581
-          if (TEST_ENDSTOP(Z_PROBE))
582
-          {
583
-            endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
584
-            endstop_hit_bits |= BIT(Z_PROBE);
565
+
566
+      #ifdef COREXZ
567
+        // Head direction in -Z axis for CoreXZ bots.
568
+        // If DeltaX == DeltaZ, the movement is only in X axis
569
+        if ((current_block->steps[A_AXIS] != current_block->steps[C_AXIS]) || (TEST(out_bits, A_AXIS) != TEST(out_bits, C_AXIS))) {
570
+          if (TEST(out_bits, Z_HEAD))
571
+      #else
572
+          if (TEST(out_bits, Z_AXIS))
573
+      #endif
574
+          { // z -direction
575
+            #if HAS_Z_MIN
576
+
577
+              #ifdef Z_DUAL_ENDSTOPS
578
+                SET_ENDSTOP_BIT(Z, MIN);
579
+                  #if HAS_Z2_MIN
580
+                    SET_ENDSTOP_BIT(Z2, MIN);
581
+                  #else
582
+                    COPY_BIT(current_endstop_bits, Z_MIN, Z2_MIN);
583
+                  #endif
584
+
585
+                byte z_test = TEST_ENDSTOP(Z_MIN) << 0 + TEST_ENDSTOP(Z2_MIN) << 1; // bit 0 for Z, bit 1 for Z2
586
+
587
+                if (z_test && current_block->steps[Z_AXIS] > 0) { // z_test = Z_MIN || Z2_MIN
588
+                  endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
589
+                  endstop_hit_bits |= BIT(Z_MIN);
590
+                  if (!performing_homing || (z_test == 0x3))  //if not performing home or if both endstops were trigged during homing...
591
+                    step_events_completed = current_block->step_event_count;
592
+                }
593
+              #else // !Z_DUAL_ENDSTOPS
594
+
595
+                UPDATE_ENDSTOP(Z, MIN);
596
+              #endif // !Z_DUAL_ENDSTOPS
597
+            #endif // Z_MIN_PIN
598
+
599
+            #ifdef Z_PROBE_ENDSTOP
600
+              UPDATE_ENDSTOP(Z, PROBE);
601
+
602
+              if (TEST_ENDSTOP(Z_PROBE))
603
+              {
604
+                endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
605
+                endstop_hit_bits |= BIT(Z_PROBE);
606
+              }
607
+            #endif
585
           }
608
           }
586
-        #endif
587
-      }
588
-      else { // z +direction
589
-        #if HAS_Z_MAX
590
-
591
-          #ifdef Z_DUAL_ENDSTOPS
592
-
593
-            SET_ENDSTOP_BIT(Z, MAX);
594
-              #if HAS_Z2_MAX
595
-                SET_ENDSTOP_BIT(Z2, MAX);
596
-              #else
597
-                COPY_BIT(current_endstop_bits, Z_MAX, Z2_MAX)
598
-              #endif
599
-
600
-            byte z_test = TEST_ENDSTOP(Z_MAX) << 0 + TEST_ENDSTOP(Z2_MAX) << 1; // bit 0 for Z, bit 1 for Z2
601
-
602
-            if (z_test && current_block->steps[Z_AXIS] > 0) {  // t_test = Z_MAX || Z2_MAX
603
-              endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
604
-              endstop_hit_bits |= BIT(Z_MIN);
605
-              if (!performing_homing || (z_test == 0x3))  //if not performing home or if both endstops were trigged during homing...
606
-                step_events_completed = current_block->step_event_count;
607
-            }
608
-
609
-          #else // !Z_DUAL_ENDSTOPS
610
-
611
-            UPDATE_ENDSTOP(Z, MAX);
612
-
613
-          #endif // !Z_DUAL_ENDSTOPS
614
-        #endif // Z_MAX_PIN
615
-        
616
-        #ifdef Z_PROBE_ENDSTOP
617
-          UPDATE_ENDSTOP(Z, PROBE);
618
-          
619
-          if (TEST_ENDSTOP(Z_PROBE))
620
-          {
621
-            endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
622
-            endstop_hit_bits |= BIT(Z_PROBE);
609
+          else { // z +direction
610
+            #if HAS_Z_MAX
611
+
612
+              #ifdef Z_DUAL_ENDSTOPS
613
+
614
+                SET_ENDSTOP_BIT(Z, MAX);
615
+                  #if HAS_Z2_MAX
616
+                    SET_ENDSTOP_BIT(Z2, MAX);
617
+                  #else
618
+                    COPY_BIT(current_endstop_bits, Z_MAX, Z2_MAX)
619
+                  #endif
620
+
621
+                byte z_test = TEST_ENDSTOP(Z_MAX) << 0 + TEST_ENDSTOP(Z2_MAX) << 1; // bit 0 for Z, bit 1 for Z2
622
+
623
+                if (z_test && current_block->steps[Z_AXIS] > 0) {  // t_test = Z_MAX || Z2_MAX
624
+                  endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
625
+                  endstop_hit_bits |= BIT(Z_MIN);
626
+                  if (!performing_homing || (z_test == 0x3))  //if not performing home or if both endstops were trigged during homing...
627
+                    step_events_completed = current_block->step_event_count;
628
+                }
629
+
630
+              #else // !Z_DUAL_ENDSTOPS
631
+
632
+                UPDATE_ENDSTOP(Z, MAX);
633
+
634
+              #endif // !Z_DUAL_ENDSTOPS
635
+            #endif // Z_MAX_PIN
636
+            
637
+            #ifdef Z_PROBE_ENDSTOP
638
+              UPDATE_ENDSTOP(Z, PROBE);
639
+              
640
+              if (TEST_ENDSTOP(Z_PROBE))
641
+              {
642
+                endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
643
+                endstop_hit_bits |= BIT(Z_PROBE);
644
+              }
645
+            #endif
623
           }
646
           }
624
-        #endif
625
-      }
626
       old_endstop_bits = current_endstop_bits;
647
       old_endstop_bits = current_endstop_bits;
627
     }
648
     }
628
 
649
 

Loading…
Cancel
Save