Browse Source

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

copy of 406992f9dd
pull/1/head
Edward Patel 9 years ago
committed by Scott Lahteine
parent
commit
14afe1a017
  1. 17
      Marlin/Marlin_main.cpp
  2. 1
      Marlin/ultralcd.cpp

17
Marlin/Marlin_main.cpp

@ -2381,7 +2381,7 @@ inline void gcode_G28() {
#endif #endif
#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) #if ENABLED(MESH_BED_LEVELING)
uint8_t mbl_was_active = mbl.active; uint8_t mbl_was_active = mbl.active;
mbl.active = 0; mbl.active = 0;
@ -2680,18 +2680,17 @@ inline void gcode_G28() {
enable_endstops(false); enable_endstops(false);
#endif #endif
// For manual leveling move back to 0,0 // For mesh leveling move back to Z=0
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
if (mbl_was_active) { if (mbl_was_active && home_all_axis) {
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();
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z; current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
sync_plan_position(); sync_plan_position();
mbl.active = 1; 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 ENABLED(DEBUG_LEVELING_FEATURE)
if (marlin_debug_flags & DEBUG_LEVELING) { if (marlin_debug_flags & DEBUG_LEVELING) {
print_xyz("mbl_was_active > current_position", current_position); print_xyz("mbl_was_active > current_position", current_position);

1
Marlin/ultralcd.cpp

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

Loading…
Cancel
Save