Pass array pointer to unapply_leveling

This commit is contained in:
Scott Lahteine 2016-09-23 03:01:27 -05:00
parent cbc158eb62
commit 22ece0081e
3 changed files with 13 additions and 14 deletions

View File

@ -3150,7 +3150,7 @@ inline void gcode_G28() {
if (DEBUGGING(LEVELING)) DEBUG_POS("MBL Rest Origin", current_position);
#endif
#else
planner.unapply_leveling(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS]);
planner.unapply_leveling(current_position);
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("MBL adjusted MESH_HOME_SEARCH_Z", current_position);
#endif
@ -3160,7 +3160,7 @@ inline void gcode_G28() {
current_position[Z_AXIS] = pre_home_z;
SYNC_PLAN_POSITION_KINEMATIC();
mbl.set_active(true);
planner.unapply_leveling(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS]);
planner.unapply_leveling(current_position);
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("MBL Home X or Y", current_position);
#endif
@ -8053,7 +8053,7 @@ void get_cartesian_from_steppers() {
void set_current_from_steppers_for_axis(const AxisEnum axis) {
get_cartesian_from_steppers();
#if PLANNER_LEVELING
planner.unapply_leveling(cartes[X_AXIS], cartes[Y_AXIS], cartes[Z_AXIS]);
planner.unapply_leveling(cartes);
#endif
if (axis == ALL_AXES)
memcpy(current_position, cartes, sizeof(cartes));

View File

@ -570,7 +570,7 @@ void Planner::check_axes_activity() {
#endif
}
void Planner::unapply_leveling(float &lx, float &ly, float &lz) {
void Planner::unapply_leveling(float logical[XYZ]) {
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
if (!abl_enabled) return;
@ -579,26 +579,25 @@ void Planner::check_axes_activity() {
#if ENABLED(MESH_BED_LEVELING)
if (mbl.active())
lz -= mbl.get_z(RAW_X_POSITION(lx), RAW_Y_POSITION(ly));
logical[Z_AXIS] -= mbl.get_z(RAW_X_POSITION(logical[X_AXIS]), RAW_Y_POSITION(logical[Y_AXIS]));
#elif ENABLED(AUTO_BED_LEVELING_LINEAR)
matrix_3x3 inverse = matrix_3x3::transpose(bed_level_matrix);
float dx = RAW_X_POSITION(lx) - (X_TILT_FULCRUM),
dy = RAW_Y_POSITION(ly) - (Y_TILT_FULCRUM),
dz = RAW_Z_POSITION(lz);
float dx = RAW_X_POSITION(logical[X_AXIS]) - (X_TILT_FULCRUM),
dy = RAW_Y_POSITION(logical[Y_AXIS]) - (Y_TILT_FULCRUM),
dz = RAW_Z_POSITION(logical[Z_AXIS]);
apply_rotation_xyz(inverse, dx, dy, dz);
lx = LOGICAL_X_POSITION(dx + X_TILT_FULCRUM);
ly = LOGICAL_Y_POSITION(dy + Y_TILT_FULCRUM);
lz = LOGICAL_Z_POSITION(dz);
logical[X_AXIS] = LOGICAL_X_POSITION(dx + X_TILT_FULCRUM);
logical[Y_AXIS] = LOGICAL_Y_POSITION(dy + Y_TILT_FULCRUM);
logical[Z_AXIS] = LOGICAL_Z_POSITION(dz);
#elif ENABLED(AUTO_BED_LEVELING_NONLINEAR)
float tmp[XYZ] = { lx, ly, 0 };
lz -= nonlinear_z_offset(tmp);
logical[Z_AXIS] -= nonlinear_z_offset(logical);
#endif
}

View File

@ -219,7 +219,7 @@ class Planner {
* as it will be given to the planner and steppers.
*/
static void apply_leveling(float &lx, float &ly, float &lz);
static void unapply_leveling(float &lx, float &ly, float &lz);
static void unapply_leveling(float logical[XYZ]);
#endif