Clean up G28 MBL code

This commit is contained in:
Scott Lahteine 2016-09-21 18:40:30 -05:00
parent 0bf1054bb2
commit 2c52e6ecf4

View File

@ -3140,19 +3140,13 @@ inline void gcode_G28() {
#if ENABLED(MESH_G28_REST_ORIGIN) #if ENABLED(MESH_G28_REST_ORIGIN)
current_position[Z_AXIS] = 0.0; current_position[Z_AXIS] = 0.0;
set_destination_to_current(); set_destination_to_current();
feedrate_mm_s = homing_feedrate_mm_s[Z_AXIS]; line_to_destination(homing_feedrate_mm_s[Z_AXIS]);
line_to_destination();
stepper.synchronize(); stepper.synchronize();
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("MBL Rest Origin", current_position); if (DEBUGGING(LEVELING)) DEBUG_POS("MBL Rest Origin", current_position);
#endif #endif
#else #else
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z - planner.unapply_leveling(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS]);
mbl.get_z(RAW_CURRENT_POSITION(X_AXIS), RAW_CURRENT_POSITION(Y_AXIS))
#if Z_HOME_DIR > 0
+ Z_MAX_POS
#endif
;
#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
@ -3162,8 +3156,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);
current_position[Z_AXIS] = pre_home_z - planner.unapply_leveling(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS]);
mbl.get_z(RAW_CURRENT_POSITION(X_AXIS), RAW_CURRENT_POSITION(Y_AXIS));
#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