Browse Source

Make USE_DELTA_IK_INTERPOLATION compatible with ABL

Scott Lahteine 8 years ago
parent
commit
a4a7ca10ca
2 changed files with 23 additions and 4 deletions
  1. 21
    2
      Marlin/Marlin_main.cpp
  2. 2
    2
      Marlin/SanityCheck.h

+ 21
- 2
Marlin/Marlin_main.cpp View File

@@ -456,6 +456,18 @@ static uint8_t target_extruder;
456 456
   #define XY_PROBE_FEEDRATE_MM_S PLANNER_XY_FEEDRATE()
457 457
 #endif
458 458
 
459
+#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
460
+  #define ADJUST_DELTA(V) \
461
+    if (planner.abl_enabled) { \
462
+      const float zadj = bilinear_z_offset(V); \
463
+      delta[A_AXIS] += zadj; \
464
+      delta[B_AXIS] += zadj; \
465
+      delta[C_AXIS] += zadj; \
466
+    }
467
+#elif IS_KINEMATIC
468
+  #define ADJUST_DELTA(V) NOOP
469
+#endif
470
+
459 471
 #if ENABLED(Z_DUAL_ENDSTOPS)
460 472
   float z_endstop_adj = 0;
461 473
 #endif
@@ -8758,7 +8770,10 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
8758 8770
       #define DELTA_NEXT(ADDEND) LOOP_XYZ(i) DELTA_VAR[i] += ADDEND;
8759 8771
 
8760 8772
       // Get the starting delta if interpolation is possible
8761
-      if (segments >= 2) DELTA_IK();
8773
+      if (segments >= 2) {
8774
+        DELTA_IK();
8775
+        ADJUST_DELTA(DELTA_VAR); // Adjust Z if bed leveling is enabled
8776
+      }
8762 8777
 
8763 8778
       // Loop using decrement
8764 8779
       for (uint16_t s = segments + 1; --s;) {
@@ -8775,6 +8790,7 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
8775 8790
 
8776 8791
           // Get the exact delta for the move after this
8777 8792
           DELTA_IK();
8793
+          ADJUST_DELTA(DELTA_VAR); // Adjust Z if bed leveling is enabled
8778 8794
 
8779 8795
           // Move to the interpolated delta position first
8780 8796
           planner.buffer_line(
@@ -8795,6 +8811,7 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
8795 8811
           DELTA_NEXT(segment_distance[i]);
8796 8812
           DELTA_VAR[E_AXIS] += segment_distance[E_AXIS];
8797 8813
           DELTA_IK();
8814
+          ADJUST_DELTA(DELTA_VAR); // Adjust Z if bed leveling is enabled
8798 8815
         }
8799 8816
 
8800 8817
         // Move to the non-interpolated position
@@ -8808,7 +8825,9 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
8808 8825
       // For non-interpolated delta calculate every segment
8809 8826
       for (uint16_t s = segments + 1; --s;) {
8810 8827
         DELTA_NEXT(segment_distance[i]);
8811
-        planner.buffer_line_kinematic(DELTA_VAR, _feedrate_mm_s, active_extruder);
8828
+        DELTA_IK();
8829
+        ADJUST_DELTA(DELTA_VAR);
8830
+        planner.buffer_line(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], DELTA_VAR[E_AXIS], _feedrate_mm_s, active_extruder);
8812 8831
       }
8813 8832
 
8814 8833
     #endif

+ 2
- 2
Marlin/SanityCheck.h View File

@@ -518,8 +518,8 @@
518 518
  */
519 519
 #if HAS_ABL
520 520
 
521
-  #if ENABLED(USE_RAW_KINEMATICS) || ENABLED(USE_DELTA_IK_INTERPOLATION)
522
-    #error "USE_RAW_KINEMATICS and USE_DELTA_IK_INTERPOLATION are not compatible with AUTO_BED_LEVELING"
521
+  #if ENABLED(USE_RAW_KINEMATICS)
522
+    #error "USE_RAW_KINEMATICS is not compatible with AUTO_BED_LEVELING"
523 523
   #endif
524 524
 
525 525
   /**

Loading…
Cancel
Save