Browse Source

Explode conditions common to corexy and cartesian

Scott Lahteine 10 years ago
parent
commit
fa00e1d97f
1 changed files with 14 additions and 10 deletions
  1. 14
    10
      Marlin/planner.cpp

+ 14
- 10
Marlin/planner.cpp View File

@@ -541,13 +541,14 @@ float junction_deviation = 0.1;
541 541
     // these equations follow the form of the dA and dB equations on http://www.corexy.com/theory.html
542 542
     block->steps[A_AXIS] = labs(dx + dy);
543 543
     block->steps[B_AXIS] = labs(dx - dy);
544
+    block->steps[Z_AXIS] = labs(dz);
544 545
   #else
545 546
     // default non-h-bot planning
546 547
     block->steps[X_AXIS] = labs(dx);
547 548
     block->steps[Y_AXIS] = labs(dy);
549
+    block->steps[Z_AXIS] = labs(dz);
548 550
   #endif
549 551
 
550
-  block->steps[Z_AXIS] = labs(dz);
551 552
   block->steps[E_AXIS] = labs(de);
552 553
   block->steps[E_AXIS] *= volumetric_multiplier[extruder];
553 554
   block->steps[E_AXIS] *= extruder_multiplier[extruder];
@@ -568,13 +569,14 @@ float junction_deviation = 0.1;
568 569
   #ifdef COREXY
569 570
     if (dx < 0) db |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis
570 571
     if (dy < 0) db |= BIT(Y_HEAD); // ...and Y
572
+    if (dz < 0) db |= BIT(Z_AXIS);
571 573
     if (dx + dy < 0) db |= BIT(A_AXIS); // Motor A direction
572 574
     if (dx - dy < 0) db |= BIT(B_AXIS); // Motor B direction
573 575
   #else
574 576
     if (dx < 0) db |= BIT(X_AXIS);
575 577
     if (dy < 0) db |= BIT(Y_AXIS); 
578
+    if (dz < 0) db |= BIT(Z_AXIS);
576 579
   #endif
577
-  if (dz < 0) db |= BIT(Z_AXIS);
578 580
   if (de < 0) db |= BIT(E_AXIS); 
579 581
   block->direction_bits = db;
580 582
 
@@ -586,13 +588,15 @@ float junction_deviation = 0.1;
586 588
       enable_x();
587 589
       enable_y();
588 590
     }
591
+    #ifndef Z_LATE_ENABLE
592
+      if (block->steps[Z_AXIS]) enable_z();
593
+    #endif
589 594
   #else
590 595
     if (block->steps[X_AXIS]) enable_x();
591 596
     if (block->steps[Y_AXIS]) enable_y();
592
-  #endif
593
-
594
-  #ifndef Z_LATE_ENABLE
595
-    if (block->steps[Z_AXIS]) enable_z();
597
+    #ifndef Z_LATE_ENABLE
598
+      if (block->steps[Z_AXIS]) enable_z();
599
+    #endif
596 600
   #endif
597 601
 
598 602
   // Enable extruder(s)
@@ -676,14 +680,15 @@ float junction_deviation = 0.1;
676 680
     float delta_mm[6];
677 681
     delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_AXIS];
678 682
     delta_mm[Y_HEAD] = dy / axis_steps_per_unit[B_AXIS];
683
+    delta_mm[Z_AXIS] = dz / axis_steps_per_unit[Z_AXIS];
679 684
     delta_mm[A_AXIS] = (dx + dy) / axis_steps_per_unit[A_AXIS];
680 685
     delta_mm[B_AXIS] = (dx - dy) / axis_steps_per_unit[B_AXIS];
681 686
   #else
682 687
     float delta_mm[4];
683 688
     delta_mm[X_AXIS] = dx / axis_steps_per_unit[X_AXIS];
684 689
     delta_mm[Y_AXIS] = dy / axis_steps_per_unit[Y_AXIS];
690
+    delta_mm[Z_AXIS] = dz / axis_steps_per_unit[Z_AXIS];
685 691
   #endif
686
-  delta_mm[Z_AXIS] = dz / axis_steps_per_unit[Z_AXIS];
687 692
   delta_mm[E_AXIS] = (de / axis_steps_per_unit[E_AXIS]) * volumetric_multiplier[extruder] * extruder_multiplier[extruder] / 100.0;
688 693
 
689 694
   if (block->steps[X_AXIS] <= dropsegments && block->steps[Y_AXIS] <= dropsegments && block->steps[Z_AXIS] <= dropsegments) {
@@ -692,11 +697,10 @@ float junction_deviation = 0.1;
692 697
   else {
693 698
     block->millimeters = sqrt(
694 699
       #ifdef COREXY
695
-        square(delta_mm[X_HEAD]) + square(delta_mm[Y_HEAD])
700
+        square(delta_mm[X_HEAD]) + square(delta_mm[Y_HEAD]) + square(delta_mm[Z_AXIS])
696 701
       #else
697
-        square(delta_mm[X_AXIS]) + square(delta_mm[Y_AXIS])
702
+        square(delta_mm[X_AXIS]) + square(delta_mm[Y_AXIS]) + square(delta_mm[Z_AXIS])
698 703
       #endif
699
-      + square(delta_mm[Z_AXIS])
700 704
     );
701 705
   }
702 706
   float inverse_millimeters = 1.0 / block->millimeters;  // Inverse millimeters to remove multiple divides 

Loading…
Cancel
Save