|
@@ -674,24 +674,24 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
674
|
674
|
|
675
|
675
|
// Compute direction bit-mask for this block
|
676
|
676
|
uint8_t dm = 0;
|
677
|
|
- #if ENABLED(COREXY)
|
678
|
|
- if (da < 0) SBI(dm, X_HEAD); // Save the real Extruder (head) direction in X Axis
|
679
|
|
- if (db < 0) SBI(dm, Y_HEAD); // ...and Y
|
|
677
|
+ #if CORE_IS_XY
|
|
678
|
+ if (da < 0) SBI(dm, X_HEAD); // Save the real Extruder (head) direction in X Axis
|
|
679
|
+ if (db < 0) SBI(dm, Y_HEAD); // ...and Y
|
680
|
680
|
if (dc < 0) SBI(dm, Z_AXIS);
|
681
|
|
- if (da + db < 0) SBI(dm, A_AXIS); // Motor A direction
|
682
|
|
- if (da - db < 0) SBI(dm, B_AXIS); // Motor B direction
|
683
|
|
- #elif ENABLED(COREXZ)
|
684
|
|
- if (da < 0) SBI(dm, X_HEAD); // Save the real Extruder (head) direction in X Axis
|
|
681
|
+ if (da + db < 0) SBI(dm, A_AXIS); // Motor A direction
|
|
682
|
+ if (CORESIGN(da - db) < 0) SBI(dm, B_AXIS); // Motor B direction
|
|
683
|
+ #elif CORE_IS_XZ
|
|
684
|
+ if (da < 0) SBI(dm, X_HEAD); // Save the real Extruder (head) direction in X Axis
|
685
|
685
|
if (db < 0) SBI(dm, Y_AXIS);
|
686
|
|
- if (dc < 0) SBI(dm, Z_HEAD); // ...and Z
|
687
|
|
- if (da + dc < 0) SBI(dm, A_AXIS); // Motor A direction
|
688
|
|
- if (da - dc < 0) SBI(dm, C_AXIS); // Motor C direction
|
689
|
|
- #elif ENABLED(COREYZ)
|
|
686
|
+ if (dc < 0) SBI(dm, Z_HEAD); // ...and Z
|
|
687
|
+ if (da + dc < 0) SBI(dm, A_AXIS); // Motor A direction
|
|
688
|
+ if (CORESIGN(da - dc) < 0) SBI(dm, C_AXIS); // Motor C direction
|
|
689
|
+ #elif CORE_IS_YZ
|
690
|
690
|
if (da < 0) SBI(dm, X_AXIS);
|
691
|
|
- if (db < 0) SBI(dm, Y_HEAD); // Save the real Extruder (head) direction in Y Axis
|
692
|
|
- if (dc < 0) SBI(dm, Z_HEAD); // ...and Z
|
693
|
|
- if (db + dc < 0) SBI(dm, B_AXIS); // Motor B direction
|
694
|
|
- if (db - dc < 0) SBI(dm, C_AXIS); // Motor C direction
|
|
691
|
+ if (db < 0) SBI(dm, Y_HEAD); // Save the real Extruder (head) direction in Y Axis
|
|
692
|
+ if (dc < 0) SBI(dm, Z_HEAD); // ...and Z
|
|
693
|
+ if (db + dc < 0) SBI(dm, B_AXIS); // Motor B direction
|
|
694
|
+ if (CORESIGN(db - dc) < 0) SBI(dm, C_AXIS); // Motor C direction
|
695
|
695
|
#else
|
696
|
696
|
if (da < 0) SBI(dm, X_AXIS);
|
697
|
697
|
if (db < 0) SBI(dm, Y_AXIS);
|
|
@@ -718,19 +718,16 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
718
|
718
|
block->direction_bits = dm;
|
719
|
719
|
|
720
|
720
|
// Number of steps for each axis
|
721
|
|
- #if ENABLED(COREXY)
|
722
|
|
- // corexy planning
|
723
|
|
- // these equations follow the form of the dA and dB equations on http://www.corexy.com/theory.html
|
|
721
|
+ // See http://www.corexy.com/theory.html
|
|
722
|
+ #if CORE_IS_XY
|
724
|
723
|
block->steps[A_AXIS] = labs(da + db);
|
725
|
724
|
block->steps[B_AXIS] = labs(da - db);
|
726
|
725
|
block->steps[Z_AXIS] = labs(dc);
|
727
|
|
- #elif ENABLED(COREXZ)
|
728
|
|
- // corexz planning
|
|
726
|
+ #elif CORE_IS_XZ
|
729
|
727
|
block->steps[A_AXIS] = labs(da + dc);
|
730
|
728
|
block->steps[Y_AXIS] = labs(db);
|
731
|
729
|
block->steps[C_AXIS] = labs(da - dc);
|
732
|
|
- #elif ENABLED(COREYZ)
|
733
|
|
- // coreyz planning
|
|
730
|
+ #elif CORE_IS_YZ
|
734
|
731
|
block->steps[X_AXIS] = labs(da);
|
735
|
732
|
block->steps[B_AXIS] = labs(db + dc);
|
736
|
733
|
block->steps[C_AXIS] = labs(db - dc);
|
|
@@ -765,7 +762,7 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
765
|
762
|
block->active_extruder = extruder;
|
766
|
763
|
|
767
|
764
|
//enable active axes
|
768
|
|
- #if ENABLED(COREXY)
|
|
765
|
+ #if CORE_IS_XY
|
769
|
766
|
if (block->steps[A_AXIS] || block->steps[B_AXIS]) {
|
770
|
767
|
enable_x();
|
771
|
768
|
enable_y();
|
|
@@ -773,13 +770,13 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
773
|
770
|
#if DISABLED(Z_LATE_ENABLE)
|
774
|
771
|
if (block->steps[Z_AXIS]) enable_z();
|
775
|
772
|
#endif
|
776
|
|
- #elif ENABLED(COREXZ)
|
|
773
|
+ #elif CORE_IS_XZ
|
777
|
774
|
if (block->steps[A_AXIS] || block->steps[C_AXIS]) {
|
778
|
775
|
enable_x();
|
779
|
776
|
enable_z();
|
780
|
777
|
}
|
781
|
778
|
if (block->steps[Y_AXIS]) enable_y();
|
782
|
|
- #elif ENABLED(COREYZ)
|
|
779
|
+ #elif CORE_IS_YZ
|
783
|
780
|
if (block->steps[B_AXIS] || block->steps[C_AXIS]) {
|
784
|
781
|
enable_y();
|
785
|
782
|
enable_z();
|
|
@@ -876,26 +873,26 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
876
|
873
|
* So we need to create other 2 "AXIS", named X_HEAD and Y_HEAD, meaning the real displacement of the Head.
|
877
|
874
|
* Having the real displacement of the head, we can calculate the total movement length and apply the desired speed.
|
878
|
875
|
*/
|
879
|
|
- #if ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ)
|
|
876
|
+ #if IS_CORE
|
880
|
877
|
float delta_mm[7];
|
881
|
|
- #if ENABLED(COREXY)
|
|
878
|
+ #if CORE_IS_XY
|
882
|
879
|
delta_mm[X_HEAD] = da * steps_to_mm[A_AXIS];
|
883
|
880
|
delta_mm[Y_HEAD] = db * steps_to_mm[B_AXIS];
|
884
|
881
|
delta_mm[Z_AXIS] = dc * steps_to_mm[Z_AXIS];
|
885
|
882
|
delta_mm[A_AXIS] = (da + db) * steps_to_mm[A_AXIS];
|
886
|
|
- delta_mm[B_AXIS] = (da - db) * steps_to_mm[B_AXIS];
|
887
|
|
- #elif ENABLED(COREXZ)
|
|
883
|
+ delta_mm[B_AXIS] = CORESIGN(da - db) * steps_to_mm[B_AXIS];
|
|
884
|
+ #elif CORE_IS_XZ
|
888
|
885
|
delta_mm[X_HEAD] = da * steps_to_mm[A_AXIS];
|
889
|
886
|
delta_mm[Y_AXIS] = db * steps_to_mm[Y_AXIS];
|
890
|
887
|
delta_mm[Z_HEAD] = dc * steps_to_mm[C_AXIS];
|
891
|
888
|
delta_mm[A_AXIS] = (da + dc) * steps_to_mm[A_AXIS];
|
892
|
|
- delta_mm[C_AXIS] = (da - dc) * steps_to_mm[C_AXIS];
|
893
|
|
- #elif ENABLED(COREYZ)
|
|
889
|
+ delta_mm[C_AXIS] = CORESIGN(da - dc) * steps_to_mm[C_AXIS];
|
|
890
|
+ #elif CORE_IS_YZ
|
894
|
891
|
delta_mm[X_AXIS] = da * steps_to_mm[X_AXIS];
|
895
|
892
|
delta_mm[Y_HEAD] = db * steps_to_mm[B_AXIS];
|
896
|
893
|
delta_mm[Z_HEAD] = dc * steps_to_mm[C_AXIS];
|
897
|
894
|
delta_mm[B_AXIS] = (db + dc) * steps_to_mm[B_AXIS];
|
898
|
|
- delta_mm[C_AXIS] = (db - dc) * steps_to_mm[C_AXIS];
|
|
895
|
+ delta_mm[C_AXIS] = CORESIGN(db - dc) * steps_to_mm[C_AXIS];
|
899
|
896
|
#endif
|
900
|
897
|
#else
|
901
|
898
|
float delta_mm[4];
|
|
@@ -910,11 +907,11 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
910
|
907
|
}
|
911
|
908
|
else {
|
912
|
909
|
block->millimeters = sqrt(
|
913
|
|
- #if ENABLED(COREXY)
|
|
910
|
+ #if CORE_IS_XY
|
914
|
911
|
sq(delta_mm[X_HEAD]) + sq(delta_mm[Y_HEAD]) + sq(delta_mm[Z_AXIS])
|
915
|
|
- #elif ENABLED(COREXZ)
|
|
912
|
+ #elif CORE_IS_XZ
|
916
|
913
|
sq(delta_mm[X_HEAD]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_HEAD])
|
917
|
|
- #elif ENABLED(COREYZ)
|
|
914
|
+ #elif CORE_IS_YZ
|
918
|
915
|
sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_HEAD]) + sq(delta_mm[Z_HEAD])
|
919
|
916
|
#else
|
920
|
917
|
sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_AXIS])
|