Browse Source

Merge pull request #6045 from thinkyhead/rc_remove_raw_kinematics

Remove delta optimization concepts… for now
Scott Lahteine 8 years ago
parent
commit
af644871bf

+ 12
- 103
Marlin/Marlin_main.cpp View File

@@ -9145,7 +9145,7 @@ void ok_to_send() {
9145 9145
       )                                       \
9146 9146
     )
9147 9147
 
9148
-  #define DELTA_RAW_IK() do {   \
9148
+  #define DELTA_RAW_IK() do {        \
9149 9149
     delta[A_AXIS] = DELTA_Z(A_AXIS); \
9150 9150
     delta[B_AXIS] = DELTA_Z(B_AXIS); \
9151 9151
     delta[C_AXIS] = DELTA_Z(C_AXIS); \
@@ -9512,112 +9512,21 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
9512 9512
     // If there's only 1 segment, loops will be skipped entirely.
9513 9513
     --segments;
9514 9514
 
9515
-    // Using "raw" coordinates saves 6 float subtractions
9516
-    // per segment, saving valuable CPU cycles
9515
+    // Get the logical current position as starting point
9516
+    float logical[XYZE];
9517
+    COPY(logical, current_position);
9517 9518
 
9518
-    #if ENABLED(USE_RAW_KINEMATICS)
9519
-
9520
-      // Get the raw current position as starting point
9521
-      float raw[XYZE] = {
9522
-        RAW_CURRENT_POSITION(X_AXIS),
9523
-        RAW_CURRENT_POSITION(Y_AXIS),
9524
-        RAW_CURRENT_POSITION(Z_AXIS),
9525
-        current_position[E_AXIS]
9526
-      };
9527
-
9528
-      #define DELTA_VAR raw
9529
-
9530
-      // Delta can inline its kinematics
9531
-      #if ENABLED(DELTA)
9532
-        #define DELTA_IK() DELTA_RAW_IK()
9533
-      #else
9534
-        #define DELTA_IK() inverse_kinematics(raw)
9535
-      #endif
9536
-
9537
-    #else
9538
-
9539
-      // Get the logical current position as starting point
9540
-      float logical[XYZE];
9541
-      COPY(logical, current_position);
9542
-
9543
-      #define DELTA_VAR logical
9544
-
9545
-      // Delta can inline its kinematics
9519
+    // Calculate and execute the segments
9520
+    for (uint16_t s = segments + 1; --s;) {
9521
+      LOOP_XYZE(i) logical[i] += segment_distance[i];
9546 9522
       #if ENABLED(DELTA)
9547
-        #define DELTA_IK() DELTA_LOGICAL_IK()
9523
+        DELTA_LOGICAL_IK(); // Delta can inline its kinematics
9548 9524
       #else
9549
-        #define DELTA_IK() inverse_kinematics(logical)
9525
+        inverse_kinematics(logical);
9550 9526
       #endif
9551
-
9552
-    #endif
9553
-
9554
-    #if ENABLED(USE_DELTA_IK_INTERPOLATION)
9555
-
9556
-      // Only interpolate XYZ. Advance E normally.
9557
-      #define DELTA_NEXT(ADDEND) LOOP_XYZ(i) DELTA_VAR[i] += ADDEND;
9558
-
9559
-      // Get the starting delta if interpolation is possible
9560
-      if (segments >= 2) {
9561
-        DELTA_IK();
9562
-        ADJUST_DELTA(DELTA_VAR); // Adjust Z if bed leveling is enabled
9563
-      }
9564
-
9565
-      // Loop using decrement
9566
-      for (uint16_t s = segments + 1; --s;) {
9567
-        // Are there at least 2 moves left?
9568
-        if (s >= 2) {
9569
-          // Save the previous delta for interpolation
9570
-          float prev_delta[ABC] = { delta[A_AXIS], delta[B_AXIS], delta[C_AXIS] };
9571
-
9572
-          // Get the delta 2 segments ahead (rather than the next)
9573
-          DELTA_NEXT(segment_distance[i] + segment_distance[i]);
9574
-
9575
-          // Advance E normally
9576
-          DELTA_VAR[E_AXIS] += segment_distance[E_AXIS];
9577
-
9578
-          // Get the exact delta for the move after this
9579
-          DELTA_IK();
9580
-          ADJUST_DELTA(DELTA_VAR); // Adjust Z if bed leveling is enabled
9581
-
9582
-          // Move to the interpolated delta position first
9583
-          planner.buffer_line(
9584
-            (prev_delta[A_AXIS] + delta[A_AXIS]) * 0.5,
9585
-            (prev_delta[B_AXIS] + delta[B_AXIS]) * 0.5,
9586
-            (prev_delta[C_AXIS] + delta[C_AXIS]) * 0.5,
9587
-            DELTA_VAR[E_AXIS], _feedrate_mm_s, active_extruder
9588
-          );
9589
-
9590
-          // Advance E once more for the next move
9591
-          DELTA_VAR[E_AXIS] += segment_distance[E_AXIS];
9592
-
9593
-          // Do an extra decrement of the loop
9594
-          --s;
9595
-        }
9596
-        else {
9597
-          // Get the last segment delta. (Used when segments is odd)
9598
-          DELTA_NEXT(segment_distance[i]);
9599
-          DELTA_VAR[E_AXIS] += segment_distance[E_AXIS];
9600
-          DELTA_IK();
9601
-          ADJUST_DELTA(DELTA_VAR); // Adjust Z if bed leveling is enabled
9602
-        }
9603
-
9604
-        // Move to the non-interpolated position
9605
-        planner.buffer_line(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], DELTA_VAR[E_AXIS], _feedrate_mm_s, active_extruder);
9606
-      }
9607
-
9608
-    #else
9609
-
9610
-      #define DELTA_NEXT(ADDEND) LOOP_XYZE(i) DELTA_VAR[i] += ADDEND;
9611
-
9612
-      // For non-interpolated delta calculate every segment
9613
-      for (uint16_t s = segments + 1; --s;) {
9614
-        DELTA_NEXT(segment_distance[i]);
9615
-        DELTA_IK();
9616
-        ADJUST_DELTA(DELTA_VAR); // Adjust Z if bed leveling is enabled
9617
-        planner.buffer_line(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], DELTA_VAR[E_AXIS], _feedrate_mm_s, active_extruder);
9618
-      }
9619
-
9620
-    #endif
9527
+      ADJUST_DELTA(logical); // Adjust Z if bed leveling is enabled
9528
+      planner.buffer_line(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], logical[E_AXIS], _feedrate_mm_s, active_extruder);
9529
+    }
9621 9530
 
9622 9531
     // Since segment_distance is only approximate,
9623 9532
     // the final move must be to the exact destination.

+ 2
- 0
Marlin/SanityCheck.h View File

@@ -232,6 +232,8 @@
232 232
 #if ENABLED(DELTA)
233 233
   #if DISABLED(USE_XMAX_PLUG) && DISABLED(USE_YMAX_PLUG) && DISABLED(USE_ZMAX_PLUG)
234 234
     #error "You probably want to use Max Endstops for DELTA!"
235
+  #elif ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
236
+    #error "DELTA is incompatible with ENABLE_LEVELING_FADE_HEIGHT. Please disable it."
235 237
   #endif
236 238
   #if ABL_GRID
237 239
     #if (ABL_GRID_MAX_POINTS_X & 1) == 0 || (ABL_GRID_MAX_POINTS_Y & 1) == 0

+ 1
- 1
Marlin/example_configurations/delta/flsun_kossel_mini/Configuration.h View File

@@ -932,7 +932,7 @@
932 932
     // Gradually reduce leveling correction until a set height is reached,
933 933
     // at which point movement will be level to the machine's XY plane.
934 934
     // The height can be set with M420 Z<height>
935
-    #define ENABLE_LEVELING_FADE_HEIGHT
935
+    //#define ENABLE_LEVELING_FADE_HEIGHT
936 936
 
937 937
     //
938 938
     // Experimental Subdivision of the grid by Catmull-Rom method.

+ 1
- 1
Marlin/example_configurations/delta/generic/Configuration.h View File

@@ -916,7 +916,7 @@
916 916
     // Gradually reduce leveling correction until a set height is reached,
917 917
     // at which point movement will be level to the machine's XY plane.
918 918
     // The height can be set with M420 Z<height>
919
-    #define ENABLE_LEVELING_FADE_HEIGHT
919
+    //#define ENABLE_LEVELING_FADE_HEIGHT
920 920
 
921 921
     //
922 922
     // Experimental Subdivision of the grid by Catmull-Rom method.

+ 1
- 1
Marlin/example_configurations/delta/kossel_pro/Configuration.h View File

@@ -918,7 +918,7 @@
918 918
     // Gradually reduce leveling correction until a set height is reached,
919 919
     // at which point movement will be level to the machine's XY plane.
920 920
     // The height can be set with M420 Z<height>
921
-    #define ENABLE_LEVELING_FADE_HEIGHT
921
+    //#define ENABLE_LEVELING_FADE_HEIGHT
922 922
 
923 923
     //
924 924
     // Experimental Subdivision of the grid by Catmull-Rom method.

+ 1
- 1
Marlin/example_configurations/delta/kossel_xl/Configuration.h View File

@@ -922,7 +922,7 @@
922 922
     // Gradually reduce leveling correction until a set height is reached,
923 923
     // at which point movement will be level to the machine's XY plane.
924 924
     // The height can be set with M420 Z<height>
925
-    #define ENABLE_LEVELING_FADE_HEIGHT
925
+    //#define ENABLE_LEVELING_FADE_HEIGHT
926 926
 
927 927
     //
928 928
     // Experimental Subdivision of the grid by Catmull-Rom method.

Loading…
Cancel
Save