Move to Z=0 for G28 when using Manual Bed Leveling

copy of 406992f9dd
master
Edward Patel 9 years ago committed by Scott Lahteine
parent c606ed447a
commit 14afe1a017

@ -2381,7 +2381,7 @@ inline void gcode_G28() {
#endif
#endif
// For manual bed leveling deactivate the matrix temporarily
// For mesh bed leveling deactivate the mesh calculations, will be turned on again when homing all axis
#if ENABLED(MESH_BED_LEVELING)
uint8_t mbl_was_active = mbl.active;
mbl.active = 0;
@ -2680,18 +2680,17 @@ inline void gcode_G28() {
enable_endstops(false);
#endif
// For manual leveling move back to 0,0
// For mesh leveling move back to Z=0
#if ENABLED(MESH_BED_LEVELING)
if (mbl_was_active) {
current_position[X_AXIS] = mbl.get_x(0);
current_position[Y_AXIS] = mbl.get_y(0);
set_destination_to_current();
feedrate = homing_feedrate[X_AXIS];
line_to_destination();
st_synchronize();
if (mbl_was_active && home_all_axis) {
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
sync_plan_position();
mbl.active = 1;
current_position[Z_AXIS] = 0.0;
set_destination_to_current();
feedrate = homing_feedrate[Z_AXIS];
line_to_destination();
st_synchronize();
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (marlin_debug_flags & DEBUG_LEVELING) {
print_xyz("mbl_was_active > current_position", current_position);

@ -2434,6 +2434,7 @@ char* ftostr52(const float& x) {
if (_lcd_level_bed_position == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) {
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
line_to_current(Z_AXIS);
st_synchronize();
mbl.active = 1;
enqueue_and_echo_commands_P(PSTR("G28"));
lcd_return_to_status();

Loading…
Cancel
Save