Make USE_DELTA_IK_INTERPOLATION compatible with ABL

This commit is contained in:
Scott Lahteine 2016-10-09 15:19:39 -05:00
parent c5cac486f5
commit a4a7ca10ca
2 changed files with 23 additions and 4 deletions

View File

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

View File

@ -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
/**