|
@@ -2908,6 +2908,9 @@ inline void gcode_G28() {
|
2908
|
2908
|
#if ENABLED(MESH_BED_LEVELING)
|
2909
|
2909
|
float pre_home_z = MESH_HOME_SEARCH_Z;
|
2910
|
2910
|
if (mbl.active()) {
|
|
2911
|
+ #if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
2912
|
+ if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("MBL was active");
|
|
2913
|
+ #endif
|
2911
|
2914
|
// Save known Z position if already homed
|
2912
|
2915
|
if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) {
|
2913
|
2916
|
pre_home_z = current_position[Z_AXIS];
|
|
@@ -2915,6 +2918,9 @@ inline void gcode_G28() {
|
2915
|
2918
|
}
|
2916
|
2919
|
mbl.set_active(false);
|
2917
|
2920
|
current_position[Z_AXIS] = pre_home_z;
|
|
2921
|
+ #if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
2922
|
+ if (DEBUGGING(LEVELING)) DEBUG_POS("Set Z to pre_home_z", current_position);
|
|
2923
|
+ #endif
|
2918
|
2924
|
}
|
2919
|
2925
|
#endif
|
2920
|
2926
|
|
|
@@ -3140,7 +3146,13 @@ inline void gcode_G28() {
|
3140
|
3146
|
// Enable mesh leveling again
|
3141
|
3147
|
#if ENABLED(MESH_BED_LEVELING)
|
3142
|
3148
|
if (mbl.has_mesh()) {
|
|
3149
|
+ #if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
3150
|
+ if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("MBL has mesh");
|
|
3151
|
+ #endif
|
3143
|
3152
|
if (home_all_axis || (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && homeZ)) {
|
|
3153
|
+ #if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
3154
|
+ if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("MBL Z homing");
|
|
3155
|
+ #endif
|
3144
|
3156
|
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z
|
3145
|
3157
|
#if Z_HOME_DIR > 0
|
3146
|
3158
|
+ Z_MAX_POS
|
|
@@ -3154,6 +3166,9 @@ inline void gcode_G28() {
|
3154
|
3166
|
feedrate = homing_feedrate[Z_AXIS];
|
3155
|
3167
|
line_to_destination();
|
3156
|
3168
|
stepper.synchronize();
|
|
3169
|
+ #if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
3170
|
+ if (DEBUGGING(LEVELING)) DEBUG_POS("MBL Rest Origin", current_position);
|
|
3171
|
+ #endif
|
3157
|
3172
|
#else
|
3158
|
3173
|
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z -
|
3159
|
3174
|
mbl.get_z(RAW_CURRENT_POSITION(X_AXIS), RAW_CURRENT_POSITION(Y_AXIS))
|
|
@@ -3161,6 +3176,9 @@ inline void gcode_G28() {
|
3161
|
3176
|
+ Z_MAX_POS
|
3162
|
3177
|
#endif
|
3163
|
3178
|
;
|
|
3179
|
+ #if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
3180
|
+ if (DEBUGGING(LEVELING)) DEBUG_POS("MBL adjusted MESH_HOME_SEARCH_Z", current_position);
|
|
3181
|
+ #endif
|
3164
|
3182
|
#endif
|
3165
|
3183
|
}
|
3166
|
3184
|
else if ((axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) && (homeX || homeY)) {
|
|
@@ -3169,6 +3187,9 @@ inline void gcode_G28() {
|
3169
|
3187
|
mbl.set_active(true);
|
3170
|
3188
|
current_position[Z_AXIS] = pre_home_z -
|
3171
|
3189
|
mbl.get_z(RAW_CURRENT_POSITION(X_AXIS), RAW_CURRENT_POSITION(Y_AXIS));
|
|
3190
|
+ #if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
3191
|
+ if (DEBUGGING(LEVELING)) DEBUG_POS("MBL Home X or Y", current_position);
|
|
3192
|
+ #endif
|
3172
|
3193
|
}
|
3173
|
3194
|
}
|
3174
|
3195
|
#endif
|