Pass array pointer to unapply_leveling
This commit is contained in:
parent
cbc158eb62
commit
22ece0081e
@ -3150,7 +3150,7 @@ inline void gcode_G28() {
|
|||||||
if (DEBUGGING(LEVELING)) DEBUG_POS("MBL Rest Origin", current_position);
|
if (DEBUGGING(LEVELING)) DEBUG_POS("MBL Rest Origin", current_position);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#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 ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
if (DEBUGGING(LEVELING)) DEBUG_POS("MBL adjusted MESH_HOME_SEARCH_Z", current_position);
|
if (DEBUGGING(LEVELING)) DEBUG_POS("MBL adjusted MESH_HOME_SEARCH_Z", current_position);
|
||||||
#endif
|
#endif
|
||||||
@ -3160,7 +3160,7 @@ inline void gcode_G28() {
|
|||||||
current_position[Z_AXIS] = pre_home_z;
|
current_position[Z_AXIS] = pre_home_z;
|
||||||
SYNC_PLAN_POSITION_KINEMATIC();
|
SYNC_PLAN_POSITION_KINEMATIC();
|
||||||
mbl.set_active(true);
|
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 ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
if (DEBUGGING(LEVELING)) DEBUG_POS("MBL Home X or Y", current_position);
|
if (DEBUGGING(LEVELING)) DEBUG_POS("MBL Home X or Y", current_position);
|
||||||
#endif
|
#endif
|
||||||
@ -8053,7 +8053,7 @@ void get_cartesian_from_steppers() {
|
|||||||
void set_current_from_steppers_for_axis(const AxisEnum axis) {
|
void set_current_from_steppers_for_axis(const AxisEnum axis) {
|
||||||
get_cartesian_from_steppers();
|
get_cartesian_from_steppers();
|
||||||
#if PLANNER_LEVELING
|
#if PLANNER_LEVELING
|
||||||
planner.unapply_leveling(cartes[X_AXIS], cartes[Y_AXIS], cartes[Z_AXIS]);
|
planner.unapply_leveling(cartes);
|
||||||
#endif
|
#endif
|
||||||
if (axis == ALL_AXES)
|
if (axis == ALL_AXES)
|
||||||
memcpy(current_position, cartes, sizeof(cartes));
|
memcpy(current_position, cartes, sizeof(cartes));
|
||||||
|
@ -570,7 +570,7 @@ void Planner::check_axes_activity() {
|
|||||||
#endif
|
#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 ENABLED(AUTO_BED_LEVELING_FEATURE)
|
||||||
if (!abl_enabled) return;
|
if (!abl_enabled) return;
|
||||||
@ -579,26 +579,25 @@ void Planner::check_axes_activity() {
|
|||||||
#if ENABLED(MESH_BED_LEVELING)
|
#if ENABLED(MESH_BED_LEVELING)
|
||||||
|
|
||||||
if (mbl.active())
|
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)
|
#elif ENABLED(AUTO_BED_LEVELING_LINEAR)
|
||||||
|
|
||||||
matrix_3x3 inverse = matrix_3x3::transpose(bed_level_matrix);
|
matrix_3x3 inverse = matrix_3x3::transpose(bed_level_matrix);
|
||||||
|
|
||||||
float dx = RAW_X_POSITION(lx) - (X_TILT_FULCRUM),
|
float dx = RAW_X_POSITION(logical[X_AXIS]) - (X_TILT_FULCRUM),
|
||||||
dy = RAW_Y_POSITION(ly) - (Y_TILT_FULCRUM),
|
dy = RAW_Y_POSITION(logical[Y_AXIS]) - (Y_TILT_FULCRUM),
|
||||||
dz = RAW_Z_POSITION(lz);
|
dz = RAW_Z_POSITION(logical[Z_AXIS]);
|
||||||
|
|
||||||
apply_rotation_xyz(inverse, dx, dy, dz);
|
apply_rotation_xyz(inverse, dx, dy, dz);
|
||||||
|
|
||||||
lx = LOGICAL_X_POSITION(dx + X_TILT_FULCRUM);
|
logical[X_AXIS] = LOGICAL_X_POSITION(dx + X_TILT_FULCRUM);
|
||||||
ly = LOGICAL_Y_POSITION(dy + Y_TILT_FULCRUM);
|
logical[Y_AXIS] = LOGICAL_Y_POSITION(dy + Y_TILT_FULCRUM);
|
||||||
lz = LOGICAL_Z_POSITION(dz);
|
logical[Z_AXIS] = LOGICAL_Z_POSITION(dz);
|
||||||
|
|
||||||
#elif ENABLED(AUTO_BED_LEVELING_NONLINEAR)
|
#elif ENABLED(AUTO_BED_LEVELING_NONLINEAR)
|
||||||
|
|
||||||
float tmp[XYZ] = { lx, ly, 0 };
|
logical[Z_AXIS] -= nonlinear_z_offset(logical);
|
||||||
lz -= nonlinear_z_offset(tmp);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ class Planner {
|
|||||||
* as it will be given to the planner and steppers.
|
* as it will be given to the planner and steppers.
|
||||||
*/
|
*/
|
||||||
static void apply_leveling(float &lx, float &ly, float &lz);
|
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
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user