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

Loading…
Cancel
Save