|
@@ -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.
|