Add option to configure G28 all axis resting position for MBL

This commit is contained in:
Edward Patel 2016-05-17 23:38:08 +02:00 committed by Scott Lahteine
parent 319d184999
commit c7d90dc5ec
2 changed files with 10 additions and 6 deletions

View File

@ -525,6 +525,8 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
#define MESH_NUM_Y_POINTS 3
#define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0.
//#define MESH_G28_REST_ORIGIN // Enable to make 'G28' all axis to rest at origin [0,0,0]
//#define MANUAL_BED_LEVELING // Add display menu option for bed leveling.
#if ENABLED(MANUAL_BED_LEVELING)

View File

@ -2918,17 +2918,19 @@ inline void gcode_G28() {
#endif
#endif
// For mesh leveling move back to Z=0
// Enable mesh leveling again
#if ENABLED(MESH_BED_LEVELING)
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();
stepper.synchronize();
#if ENABLED(MESH_G28_REST_ORIGIN)
current_position[Z_AXIS] = 0.0;
set_destination_to_current();
feedrate = homing_feedrate[Z_AXIS];
line_to_destination();
stepper.synchronize();
#endif
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("mbl_was_active", current_position);
#endif