Browse Source

Remove kinematic optimizations

Scott Lahteine 8 years ago
parent
commit
e46898f8e5
1 changed files with 21 additions and 52 deletions
  1. 21
    52
      Marlin/Marlin_main.cpp

+ 21
- 52
Marlin/Marlin_main.cpp View File

9201
       )                                       \
9201
       )                                       \
9202
     )
9202
     )
9203
 
9203
 
9204
-  #define DELTA_RAW_IK() do {   \
9204
+  #define DELTA_RAW_IK() do {        \
9205
     delta[A_AXIS] = DELTA_Z(A_AXIS); \
9205
     delta[A_AXIS] = DELTA_Z(A_AXIS); \
9206
     delta[B_AXIS] = DELTA_Z(B_AXIS); \
9206
     delta[B_AXIS] = DELTA_Z(B_AXIS); \
9207
     delta[C_AXIS] = DELTA_Z(C_AXIS); \
9207
     delta[C_AXIS] = DELTA_Z(C_AXIS); \
9568
     // If there's only 1 segment, loops will be skipped entirely.
9568
     // If there's only 1 segment, loops will be skipped entirely.
9569
     --segments;
9569
     --segments;
9570
 
9570
 
9571
-    // Using "raw" coordinates saves 6 float subtractions
9572
-    // per segment, saving valuable CPU cycles
9573
-
9574
-    #if ENABLED(USE_RAW_KINEMATICS)
9575
-
9576
-      // Get the raw current position as starting point
9577
-      float raw[XYZE] = {
9578
-        RAW_CURRENT_POSITION(X_AXIS),
9579
-        RAW_CURRENT_POSITION(Y_AXIS),
9580
-        RAW_CURRENT_POSITION(Z_AXIS),
9581
-        current_position[E_AXIS]
9582
-      };
9583
-
9584
-      #define DELTA_VAR raw
9585
-
9586
-      // Delta can inline its kinematics
9587
-      #if ENABLED(DELTA)
9588
-        #define DELTA_IK() DELTA_RAW_IK()
9589
-      #else
9590
-        #define DELTA_IK() inverse_kinematics(raw)
9591
-      #endif
9592
-
9593
-    #else
9594
-
9595
-      // Get the logical current position as starting point
9596
-      float logical[XYZE];
9597
-      COPY(logical, current_position);
9598
-
9599
-      #define DELTA_VAR logical
9600
-
9601
-      // Delta can inline its kinematics
9602
-      #if ENABLED(DELTA)
9603
-        #define DELTA_IK() DELTA_LOGICAL_IK()
9604
-      #else
9605
-        #define DELTA_IK() inverse_kinematics(logical)
9606
-      #endif
9607
-
9608
-    #endif
9571
+    // Get the logical current position as starting point
9572
+    float logical[XYZE];
9573
+    COPY(logical, current_position);
9609
 
9574
 
9610
     #if ENABLED(USE_DELTA_IK_INTERPOLATION)
9575
     #if ENABLED(USE_DELTA_IK_INTERPOLATION)
9611
 
9576
 
9612
       // Only interpolate XYZ. Advance E normally.
9577
       // Only interpolate XYZ. Advance E normally.
9613
-      #define DELTA_NEXT(ADDEND) LOOP_XYZ(i) DELTA_VAR[i] += ADDEND;
9578
+      #define DELTA_NEXT(ADDEND) LOOP_XYZ(i) logical[i] += ADDEND;
9614
 
9579
 
9615
       // Get the starting delta if interpolation is possible
9580
       // Get the starting delta if interpolation is possible
9616
       if (segments >= 2) {
9581
       if (segments >= 2) {
9617
         DELTA_IK();
9582
         DELTA_IK();
9618
-        ADJUST_DELTA(DELTA_VAR); // Adjust Z if bed leveling is enabled
9583
+        ADJUST_DELTA(logical); // Adjust Z if bed leveling is enabled
9619
       }
9584
       }
9620
 
9585
 
9621
       // Loop using decrement
9586
       // Loop using decrement
9629
           DELTA_NEXT(segment_distance[i] + segment_distance[i]);
9594
           DELTA_NEXT(segment_distance[i] + segment_distance[i]);
9630
 
9595
 
9631
           // Advance E normally
9596
           // Advance E normally
9632
-          DELTA_VAR[E_AXIS] += segment_distance[E_AXIS];
9597
+          logical[E_AXIS] += segment_distance[E_AXIS];
9633
 
9598
 
9634
           // Get the exact delta for the move after this
9599
           // Get the exact delta for the move after this
9635
           DELTA_IK();
9600
           DELTA_IK();
9636
-          ADJUST_DELTA(DELTA_VAR); // Adjust Z if bed leveling is enabled
9601
+          ADJUST_DELTA(logical); // Adjust Z if bed leveling is enabled
9637
 
9602
 
9638
           // Move to the interpolated delta position first
9603
           // Move to the interpolated delta position first
9639
           planner.buffer_line(
9604
           planner.buffer_line(
9640
             (prev_delta[A_AXIS] + delta[A_AXIS]) * 0.5,
9605
             (prev_delta[A_AXIS] + delta[A_AXIS]) * 0.5,
9641
             (prev_delta[B_AXIS] + delta[B_AXIS]) * 0.5,
9606
             (prev_delta[B_AXIS] + delta[B_AXIS]) * 0.5,
9642
             (prev_delta[C_AXIS] + delta[C_AXIS]) * 0.5,
9607
             (prev_delta[C_AXIS] + delta[C_AXIS]) * 0.5,
9643
-            DELTA_VAR[E_AXIS], _feedrate_mm_s, active_extruder
9608
+            logical[E_AXIS], _feedrate_mm_s, active_extruder
9644
           );
9609
           );
9645
 
9610
 
9646
           // Advance E once more for the next move
9611
           // Advance E once more for the next move
9647
-          DELTA_VAR[E_AXIS] += segment_distance[E_AXIS];
9612
+          logical[E_AXIS] += segment_distance[E_AXIS];
9648
 
9613
 
9649
           // Do an extra decrement of the loop
9614
           // Do an extra decrement of the loop
9650
           --s;
9615
           --s;
9652
         else {
9617
         else {
9653
           // Get the last segment delta. (Used when segments is odd)
9618
           // Get the last segment delta. (Used when segments is odd)
9654
           DELTA_NEXT(segment_distance[i]);
9619
           DELTA_NEXT(segment_distance[i]);
9655
-          DELTA_VAR[E_AXIS] += segment_distance[E_AXIS];
9620
+          logical[E_AXIS] += segment_distance[E_AXIS];
9656
           DELTA_IK();
9621
           DELTA_IK();
9657
-          ADJUST_DELTA(DELTA_VAR); // Adjust Z if bed leveling is enabled
9622
+          ADJUST_DELTA(logical); // Adjust Z if bed leveling is enabled
9658
         }
9623
         }
9659
 
9624
 
9660
         // Move to the non-interpolated position
9625
         // Move to the non-interpolated position
9661
-        planner.buffer_line(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], DELTA_VAR[E_AXIS], _feedrate_mm_s, active_extruder);
9626
+        planner.buffer_line(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], logical[E_AXIS], _feedrate_mm_s, active_extruder);
9662
       }
9627
       }
9663
 
9628
 
9664
     #else
9629
     #else
9665
 
9630
 
9666
-      #define DELTA_NEXT(ADDEND) LOOP_XYZE(i) DELTA_VAR[i] += ADDEND;
9631
+      #define DELTA_NEXT(ADDEND) LOOP_XYZE(i) logical[i] += ADDEND;
9667
 
9632
 
9668
       // For non-interpolated delta calculate every segment
9633
       // For non-interpolated delta calculate every segment
9669
       for (uint16_t s = segments + 1; --s;) {
9634
       for (uint16_t s = segments + 1; --s;) {
9670
         DELTA_NEXT(segment_distance[i]);
9635
         DELTA_NEXT(segment_distance[i]);
9671
-        DELTA_IK();
9672
-        ADJUST_DELTA(DELTA_VAR); // Adjust Z if bed leveling is enabled
9673
-        planner.buffer_line(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], DELTA_VAR[E_AXIS], _feedrate_mm_s, active_extruder);
9636
+        #if ENABLED(DELTA)
9637
+          DELTA_LOGICAL_IK(); // Delta can inline its kinematics
9638
+        #else
9639
+          inverse_kinematics(logical);
9640
+        #endif
9641
+        ADJUST_DELTA(logical); // Adjust Z if bed leveling is enabled
9642
+        planner.buffer_line(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], logical[E_AXIS], _feedrate_mm_s, active_extruder);
9674
       }
9643
       }
9675
 
9644
 
9676
     #endif
9645
     #endif

Loading…
Cancel
Save