UBL/planner patch tweaks

This commit is contained in:
Scott Lahteine 2018-08-11 22:44:51 -05:00
parent 105d20c2e8
commit f1467ddc0e

View File

@ -2527,12 +2527,12 @@ void Planner::_set_position_mm(const float &a, const float &b, const float &c, c
#endif #endif
position[A_AXIS] = LROUND(a * axis_steps_per_mm[A_AXIS]); position[A_AXIS] = LROUND(a * axis_steps_per_mm[A_AXIS]);
position[B_AXIS] = LROUND(b * axis_steps_per_mm[B_AXIS]); position[B_AXIS] = LROUND(b * axis_steps_per_mm[B_AXIS]);
#if !IS_KINEMATIC && ENABLED(AUTO_BED_LEVELING_UBL) position[C_AXIS] = LROUND(axis_steps_per_mm[C_AXIS] * (c +
if (leveling_active) #if !IS_KINEMATIC && ENABLED(AUTO_BED_LEVELING_UBL)
position[C_AXIS] = LROUND((c + ubl.get_z_correction(a, b)) * axis_steps_per_mm[Z_AXIS]); leveling_active ? ubl.get_z_correction(a, b) :
else #endif
#endif 0
position[C_AXIS] = LROUND(c * axis_steps_per_mm[C_AXIS]); ));
position[E_AXIS] = LROUND(e * axis_steps_per_mm[_EINDEX]); position[E_AXIS] = LROUND(e * axis_steps_per_mm[_EINDEX]);
#if HAS_POSITION_FLOAT #if HAS_POSITION_FLOAT
position_float[A_AXIS] = a; position_float[A_AXIS] = a;
@ -2574,19 +2574,17 @@ void Planner::set_position_mm(const AxisEnum axis, const float &v) {
#else #else
const uint8_t axis_index = axis; const uint8_t axis_index = axis;
#endif #endif
#if ENABLED(AUTO_BED_LEVELING_UBL) position[axis] = LROUND(axis_steps_per_mm[axis_index] * (v +
if (axis == Z_AXIS && leveling_active) #if ENABLED(AUTO_BED_LEVELING_UBL)
position[axis] = LROUND((v + ubl.get_z_correction(current_position[X_AXIS], current_position[Y_AXIS])) * axis_steps_per_mm[axis_index]); axis == Z_AXIS && leveling_active ? ubl.get_z_correction(current_position[X_AXIS], current_position[Y_AXIS]) :
else #endif
#endif 0
position[axis] = LROUND(v * axis_steps_per_mm[axis_index]); ));
#if HAS_POSITION_FLOAT #if HAS_POSITION_FLOAT
position_float[axis] = v; position_float[axis] = v;
#endif #endif
if (has_blocks_queued()) { if (has_blocks_queued())
//previous_speed[axis] = 0.0;
buffer_sync_block(); buffer_sync_block();
}
else else
stepper.set_position(axis, position[axis]); stepper.set_position(axis, position[axis]);
} }