Sfoglia il codice sorgente

COREYZ stepper, planner, endstop, babysteps

Scott Lahteine 8 anni fa
parent
commit
5172d4ba40
5 ha cambiato i file con 76 aggiunte e 48 eliminazioni
  1. 11
    11
      Marlin/endstops.cpp
  2. 34
    14
      Marlin/planner.cpp
  3. 1
    1
      Marlin/planner.h
  4. 20
    13
      Marlin/stepper.cpp
  5. 10
    9
      Marlin/temperature.h

+ 11
- 11
Marlin/endstops.cpp Vedi File

@@ -239,8 +239,8 @@ void Endstops::update() {
239 239
 
240 240
   #if ENABLED(COREXY) || ENABLED(COREXZ)
241 241
     // Head direction in -X axis for CoreXY and CoreXZ bots.
242
-    // If Delta1 == -Delta2, the movement is only in Y or Z axis
243
-    if ((stepper.current_block->steps[A_AXIS] != stepper.current_block->steps[CORE_AXIS_2]) || (stepper.motor_direction(A_AXIS) == stepper.motor_direction(CORE_AXIS_2))) {
242
+    // If DeltaA == -DeltaB, the movement is only in Y or Z axis
243
+    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))) {
244 244
       if (stepper.motor_direction(X_HEAD))
245 245
   #else
246 246
     if (stepper.motor_direction(X_AXIS))   // stepping along -X axis (regular Cartesian bot)
@@ -271,10 +271,10 @@ void Endstops::update() {
271 271
     }
272 272
   #endif
273 273
 
274
-  #if ENABLED(COREXY)
275
-    // Head direction in -Y axis for CoreXY bots.
276
-    // If DeltaX == DeltaY, the movement is only in X axis
277
-    if ((stepper.current_block->steps[A_AXIS] != stepper.current_block->steps[B_AXIS]) || (stepper.motor_direction(A_AXIS) != stepper.motor_direction(B_AXIS))) {
274
+  #if ENABLED(COREXY) || ENABLED(COREYZ)
275
+    // Head direction in -Y axis for CoreXY / CoreYZ bots.
276
+    // If DeltaA == DeltaB, the movement is only in X or Y axis
277
+    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))) {
278 278
       if (stepper.motor_direction(Y_HEAD))
279 279
   #else
280 280
       if (stepper.motor_direction(Y_AXIS))   // -direction
@@ -289,14 +289,14 @@ void Endstops::update() {
289 289
           UPDATE_ENDSTOP(Y, MAX);
290 290
         #endif
291 291
       }
292
-  #if ENABLED(COREXY)
292
+  #if ENABLED(COREXY) || ENABLED(COREYZ)
293 293
     }
294 294
   #endif
295 295
 
296
-  #if ENABLED(COREXZ)
297
-    // Head direction in -Z axis for CoreXZ bots.
298
-    // If DeltaX == DeltaZ, the movement is only in X axis
299
-    if ((stepper.current_block->steps[A_AXIS] != stepper.current_block->steps[C_AXIS]) || (stepper.motor_direction(A_AXIS) != stepper.motor_direction(C_AXIS))) {
296
+  #if ENABLED(COREXZ) || ENABLED(COREYZ)
297
+    // Head direction in -Z axis for CoreXZ or CoreYZ bots.
298
+    // If DeltaA == DeltaB, the movement is only in X or Y axis
299
+    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))) {
300 300
       if (stepper.motor_direction(Z_HEAD))
301 301
   #else
302 302
       if (stepper.motor_direction(Z_AXIS))

+ 34
- 14
Marlin/planner.cpp Vedi File

@@ -543,6 +543,11 @@ void Planner::check_axes_activity() {
543 543
     block->steps[A_AXIS] = labs(dx + dz);
544 544
     block->steps[Y_AXIS] = labs(dy);
545 545
     block->steps[C_AXIS] = labs(dx - dz);
546
+  #elif ENABLED(COREYZ)
547
+    // coreyz planning
548
+    block->steps[X_AXIS] = labs(dx);
549
+    block->steps[B_AXIS] = labs(dy + dz);
550
+    block->steps[C_AXIS] = labs(dy - dz);
546 551
   #else
547 552
     // default non-h-bot planning
548 553
     block->steps[X_AXIS] = labs(dx);
@@ -581,7 +586,13 @@ void Planner::check_axes_activity() {
581 586
     if (dy < 0) SBI(db, Y_AXIS);
582 587
     if (dz < 0) SBI(db, Z_HEAD); // ...and Z
583 588
     if (dx + dz < 0) SBI(db, A_AXIS); // Motor A direction
584
-    if (dx - dz < 0) SBI(db, C_AXIS); // Motor B direction
589
+    if (dx - dz < 0) SBI(db, C_AXIS); // Motor C direction
590
+  #elif ENABLED(COREYZ)
591
+    if (dx < 0) SBI(db, X_AXIS);
592
+    if (dy < 0) SBI(db, Y_HEAD); // Save the real Extruder (head) direction in Y Axis
593
+    if (dz < 0) SBI(db, Z_HEAD); // ...and Z
594
+    if (dy + dz < 0) SBI(db, B_AXIS); // Motor B direction
595
+    if (dy - dz < 0) SBI(db, C_AXIS); // Motor C direction
585 596
   #else
586 597
     if (dx < 0) SBI(db, X_AXIS);
587 598
     if (dy < 0) SBI(db, Y_AXIS);
@@ -698,20 +709,27 @@ void Planner::check_axes_activity() {
698 709
    * So we need to create other 2 "AXIS", named X_HEAD and Y_HEAD, meaning the real displacement of the Head.
699 710
    * Having the real displacement of the head, we can calculate the total movement length and apply the desired speed.
700 711
    */
701
-  #if ENABLED(COREXY)
712
+  #if ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ)
702 713
     float delta_mm[6];
703
-    delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_AXIS];
704
-    delta_mm[Y_HEAD] = dy / axis_steps_per_unit[B_AXIS];
705
-    delta_mm[Z_AXIS] = dz / axis_steps_per_unit[Z_AXIS];
706
-    delta_mm[A_AXIS] = (dx + dy) / axis_steps_per_unit[A_AXIS];
707
-    delta_mm[B_AXIS] = (dx - dy) / axis_steps_per_unit[B_AXIS];
708
-  #elif ENABLED(COREXZ)
709
-    float delta_mm[6];
710
-    delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_AXIS];
711
-    delta_mm[Y_AXIS] = dy / axis_steps_per_unit[Y_AXIS];
712
-    delta_mm[Z_HEAD] = dz / axis_steps_per_unit[C_AXIS];
713
-    delta_mm[A_AXIS] = (dx + dz) / axis_steps_per_unit[A_AXIS];
714
-    delta_mm[C_AXIS] = (dx - dz) / axis_steps_per_unit[C_AXIS];
714
+    #if ENABLED(COREXY)
715
+      delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_AXIS];
716
+      delta_mm[Y_HEAD] = dy / axis_steps_per_unit[B_AXIS];
717
+      delta_mm[Z_AXIS] = dz / axis_steps_per_unit[Z_AXIS];
718
+      delta_mm[A_AXIS] = (dx + dy) / axis_steps_per_unit[A_AXIS];
719
+      delta_mm[B_AXIS] = (dx - dy) / axis_steps_per_unit[B_AXIS];
720
+    #elif ENABLED(COREXZ)
721
+      delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_AXIS];
722
+      delta_mm[Y_AXIS] = dy / axis_steps_per_unit[Y_AXIS];
723
+      delta_mm[Z_HEAD] = dz / axis_steps_per_unit[C_AXIS];
724
+      delta_mm[A_AXIS] = (dx + dz) / axis_steps_per_unit[A_AXIS];
725
+      delta_mm[C_AXIS] = (dx - dz) / axis_steps_per_unit[C_AXIS];
726
+    #elif ENABLED(COREYZ)
727
+      delta_mm[X_AXIS] = dx / axis_steps_per_unit[A_AXIS];
728
+      delta_mm[Y_HEAD] = dy / axis_steps_per_unit[Y_AXIS];
729
+      delta_mm[Z_HEAD] = dz / axis_steps_per_unit[C_AXIS];
730
+      delta_mm[B_AXIS] = (dy + dz) / axis_steps_per_unit[B_AXIS];
731
+      delta_mm[C_AXIS] = (dy - dz) / axis_steps_per_unit[C_AXIS];
732
+    #endif
715 733
   #else
716 734
     float delta_mm[4];
717 735
     delta_mm[X_AXIS] = dx / axis_steps_per_unit[X_AXIS];
@@ -729,6 +747,8 @@ void Planner::check_axes_activity() {
729 747
         square(delta_mm[X_HEAD]) + square(delta_mm[Y_HEAD]) + square(delta_mm[Z_AXIS])
730 748
       #elif ENABLED(COREXZ)
731 749
         square(delta_mm[X_HEAD]) + square(delta_mm[Y_AXIS]) + square(delta_mm[Z_HEAD])
750
+      #elif ENABLED(COREYZ)
751
+        square(delta_mm[X_AXIS]) + square(delta_mm[Y_HEAD]) + square(delta_mm[Z_HEAD])
732 752
       #else
733 753
         square(delta_mm[X_AXIS]) + square(delta_mm[Y_AXIS]) + square(delta_mm[Z_AXIS])
734 754
       #endif

+ 1
- 1
Marlin/planner.h Vedi File

@@ -204,7 +204,7 @@ class Planner {
204 204
        * Used by G92, G28, G29, and other procedures.
205 205
        *
206 206
        * Multiplies by axis_steps_per_unit[] and does necessary conversion
207
-       * for COREXY / COREXZ to set the corresponding stepper positions.
207
+       * for COREXY / COREXZ / COREYZ to set the corresponding stepper positions.
208 208
        *
209 209
        * Clears previous speed values.
210 210
        */

+ 20
- 13
Marlin/stepper.cpp Vedi File

@@ -204,8 +204,9 @@ void Stepper::wake_up() {
204 204
 /**
205 205
  * Set the stepper direction of each axis
206 206
  *
207
- *   X_AXIS=A_AXIS and Y_AXIS=B_AXIS for COREXY
208
- *   X_AXIS=A_AXIS and Z_AXIS=C_AXIS for COREXZ
207
+ *   COREXY: X_AXIS=A_AXIS and Y_AXIS=B_AXIS
208
+ *   COREXZ: X_AXIS=A_AXIS and Z_AXIS=C_AXIS
209
+ *   COREYZ: Y_AXIS=B_AXIS and Z_AXIS=C_AXIS
209 210
  */
210 211
 void Stepper::set_directions() {
211 212
 
@@ -649,6 +650,11 @@ void Stepper::set_position(const long& x, const long& y, const long& z, const lo
649 650
     count_position[A_AXIS] = x + z;
650 651
     count_position[Y_AXIS] = y;
651 652
     count_position[C_AXIS] = x - z;
653
+  #elif ENABLED(COREYZ)
654
+    // coreyz planning
655
+    count_position[X_AXIS] = x;
656
+    count_position[B_AXIS] = y + z;
657
+    count_position[C_AXIS] = y - z;
652 658
   #else
653 659
     // default non-h-bot planning
654 660
     count_position[X_AXIS] = x;
@@ -682,15 +688,16 @@ long Stepper::position(AxisEnum axis) {
682 688
  */
683 689
 float Stepper::get_axis_position_mm(AxisEnum axis) {
684 690
   float axis_steps;
685
-  #if ENABLED(COREXY) | ENABLED(COREXZ)
686
-    if (axis == X_AXIS || axis == CORE_AXIS_2) {
691
+  #if ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ)
692
+    // Requesting one of the "core" axes?
693
+    if (axis == CORE_AXIS_1 || axis == CORE_AXIS_2) {
687 694
       CRITICAL_SECTION_START;
688
-      long pos1 = count_position[A_AXIS],
695
+      long pos1 = count_position[CORE_AXIS_1],
689 696
            pos2 = count_position[CORE_AXIS_2];
690 697
       CRITICAL_SECTION_END;
691 698
       // ((a1+a2)+(a1-a2))/2 -> (a1+a2+a1-a2)/2 -> (a1+a1)/2 -> a1
692 699
       // ((a1+a2)-(a1-a2))/2 -> (a1+a2-a1+a2)/2 -> (a2+a2)/2 -> a2
693
-      axis_steps = (pos1 + ((axis == X_AXIS) ? pos2 : -pos2)) / 2.0f;
700
+      axis_steps = (pos1 + ((axis == CORE_AXIS_1) ? pos2 : -pos2)) / 2.0f;
694 701
     }
695 702
     else
696 703
       axis_steps = position(axis);
@@ -715,20 +722,20 @@ void Stepper::quick_stop() {
715 722
 
716 723
 void Stepper::endstop_triggered(AxisEnum axis) {
717 724
 
718
-  #if ENABLED(COREXY) || ENABLED(COREXZ)
725
+  #if ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ)
719 726
 
720 727
     float axis_pos = count_position[axis];
721
-    if (axis == A_AXIS)
728
+    if (axis == CORE_AXIS_1)
722 729
       axis_pos = (axis_pos + count_position[CORE_AXIS_2]) / 2;
723 730
     else if (axis == CORE_AXIS_2)
724
-      axis_pos = (count_position[A_AXIS] - axis_pos) / 2;
731
+      axis_pos = (count_position[CORE_AXIS_1] - axis_pos) / 2;
725 732
     endstops_trigsteps[axis] = axis_pos;
726 733
 
727
-  #else // !COREXY && !COREXZ
734
+  #else // !COREXY && !COREXZ && !COREYZ
728 735
 
729 736
     endstops_trigsteps[axis] = count_position[axis];
730 737
 
731
-  #endif // !COREXY && !COREXZ
738
+  #endif // !COREXY && !COREXZ && !COREYZ
732 739
 
733 740
   kill_current_block();
734 741
 }
@@ -747,14 +754,14 @@ void Stepper::report_positions() {
747 754
   #endif
748 755
   SERIAL_PROTOCOL(xpos);
749 756
 
750
-  #if ENABLED(COREXY) || ENABLED(COREXZ)
757
+  #if ENABLED(COREXY) || ENABLED(COREYZ)
751 758
     SERIAL_PROTOCOLPGM(" B:");
752 759
   #else
753 760
     SERIAL_PROTOCOLPGM(" Y:");
754 761
   #endif
755 762
   SERIAL_PROTOCOL(ypos);
756 763
 
757
-  #if ENABLED(COREXZ) || ENABLED(COREXZ)
764
+  #if ENABLED(COREXZ) || ENABLED(COREYZ)
758 765
     SERIAL_PROTOCOLPGM(" C:");
759 766
   #else
760 767
     SERIAL_PROTOCOLPGM(" Z:");

+ 10
- 9
Marlin/temperature.h Vedi File

@@ -306,24 +306,25 @@ class Temperature {
306 306
     #if ENABLED(BABYSTEPPING)
307 307
 
308 308
       FORCE_INLINE void babystep_axis(AxisEnum axis, int distance) {
309
-        #if ENABLED(COREXY) || ENABLED(COREXZ)
309
+        #if ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ)
310 310
           #if ENABLED(BABYSTEP_XY)
311 311
             switch (axis) {
312
-              case X_AXIS: // X on CoreXY and CoreXZ
313
-                babystepsTodo[A_AXIS] += distance * 2;
312
+              case CORE_AXIS_1: // X on CoreXY and CoreXZ, Y on CoreYZ
313
+                babystepsTodo[CORE_AXIS_1] += distance * 2;
314 314
                 babystepsTodo[CORE_AXIS_2] += distance * 2;
315 315
                 break;
316
-              case CORE_AXIS_2: // Y on CoreXY, Z on CoreXZ
317
-                babystepsTodo[A_AXIS] += distance * 2;
316
+              case CORE_AXIS_2: // Y on CoreXY, Z on CoreXZ and CoreYZ
317
+                babystepsTodo[CORE_AXIS_1] += distance * 2;
318 318
                 babystepsTodo[CORE_AXIS_2] -= distance * 2;
319 319
                 break;
320
-              case CORE_AXIS_3: // Z on CoreXY, Y on CoreXZ
320
+              case CORE_AXIS_3: // Z on CoreXY, Y on CoreXZ, X on CoreYZ
321 321
                 babystepsTodo[CORE_AXIS_3] += distance;
322 322
                 break;
323 323
             }
324
-          #elif ENABLED(COREXZ)
325
-            babystepsTodo[A_AXIS] += distance * 2;
326
-            babystepsTodo[C_AXIS] -= distance * 2;
324
+          #elif ENABLED(COREXZ) || ENABLED(COREYZ)
325
+            // Only Z stepping needs to be handled here
326
+            babystepsTodo[CORE_AXIS_1] += distance * 2;
327
+            babystepsTodo[CORE_AXIS_2] -= distance * 2;
327 328
           #else
328 329
             babystepsTodo[Z_AXIS] += distance;
329 330
           #endif

Loading…
Annulla
Salva