From a4a7ca10ca3802d1e68f92d410fc9793af184d8a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 9 Oct 2016 15:19:39 -0500 Subject: [PATCH] Make USE_DELTA_IK_INTERPOLATION compatible with ABL --- Marlin/Marlin_main.cpp | 23 +++++++++++++++++++++-- Marlin/SanityCheck.h | 4 ++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 9be4fd9b1a..36177c619f 100755 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -456,6 +456,18 @@ static uint8_t target_extruder; #define XY_PROBE_FEEDRATE_MM_S PLANNER_XY_FEEDRATE() #endif +#if ENABLED(AUTO_BED_LEVELING_BILINEAR) + #define ADJUST_DELTA(V) \ + if (planner.abl_enabled) { \ + const float zadj = bilinear_z_offset(V); \ + delta[A_AXIS] += zadj; \ + delta[B_AXIS] += zadj; \ + delta[C_AXIS] += zadj; \ + } +#elif IS_KINEMATIC + #define ADJUST_DELTA(V) NOOP +#endif + #if ENABLED(Z_DUAL_ENDSTOPS) float z_endstop_adj = 0; #endif @@ -8758,7 +8770,10 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) { #define DELTA_NEXT(ADDEND) LOOP_XYZ(i) DELTA_VAR[i] += ADDEND; // Get the starting delta if interpolation is possible - if (segments >= 2) DELTA_IK(); + if (segments >= 2) { + DELTA_IK(); + ADJUST_DELTA(DELTA_VAR); // Adjust Z if bed leveling is enabled + } // Loop using decrement for (uint16_t s = segments + 1; --s;) { @@ -8775,6 +8790,7 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) { // Get the exact delta for the move after this DELTA_IK(); + ADJUST_DELTA(DELTA_VAR); // Adjust Z if bed leveling is enabled // Move to the interpolated delta position first planner.buffer_line( @@ -8795,6 +8811,7 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) { DELTA_NEXT(segment_distance[i]); DELTA_VAR[E_AXIS] += segment_distance[E_AXIS]; DELTA_IK(); + ADJUST_DELTA(DELTA_VAR); // Adjust Z if bed leveling is enabled } // Move to the non-interpolated position @@ -8808,7 +8825,9 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) { // For non-interpolated delta calculate every segment for (uint16_t s = segments + 1; --s;) { DELTA_NEXT(segment_distance[i]); - planner.buffer_line_kinematic(DELTA_VAR, _feedrate_mm_s, active_extruder); + DELTA_IK(); + ADJUST_DELTA(DELTA_VAR); + planner.buffer_line(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], DELTA_VAR[E_AXIS], _feedrate_mm_s, active_extruder); } #endif diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index 0eca5743d3..cb3c8599a1 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -518,8 +518,8 @@ */ #if HAS_ABL - #if ENABLED(USE_RAW_KINEMATICS) || ENABLED(USE_DELTA_IK_INTERPOLATION) - #error "USE_RAW_KINEMATICS and USE_DELTA_IK_INTERPOLATION are not compatible with AUTO_BED_LEVELING" + #if ENABLED(USE_RAW_KINEMATICS) + #error "USE_RAW_KINEMATICS is not compatible with AUTO_BED_LEVELING" #endif /**