MBL: Add support for max z endstop

See https://github.com/MarlinFirmware/Marlin/issues/4088
This commit is contained in:
Edward Patel 2016-06-25 21:58:02 +02:00
parent c8a9829387
commit da88b00585
2 changed files with 20 additions and 4 deletions

View File

@ -3072,7 +3072,11 @@ inline void gcode_G28() {
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
if (mbl.has_mesh()) { if (mbl.has_mesh()) {
if (home_all_axis || (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && homeZ)) { if (home_all_axis || (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && homeZ)) {
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z; current_position[Z_AXIS] = MESH_HOME_SEARCH_Z
#if Z_HOME_DIR > 0
+ Z_MAX_POS
#endif
;
SYNC_PLAN_POSITION_KINEMATIC(); SYNC_PLAN_POSITION_KINEMATIC();
mbl.set_active(true); mbl.set_active(true);
#if ENABLED(MESH_G28_REST_ORIGIN) #if ENABLED(MESH_G28_REST_ORIGIN)
@ -3084,7 +3088,11 @@ inline void gcode_G28() {
#else #else
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z - current_position[Z_AXIS] = MESH_HOME_SEARCH_Z -
mbl.get_z(current_position[X_AXIS] - home_offset[X_AXIS], mbl.get_z(current_position[X_AXIS] - home_offset[X_AXIS],
current_position[Y_AXIS] - home_offset[Y_AXIS]); current_position[Y_AXIS] - home_offset[Y_AXIS])
#if Z_HOME_DIR > 0
+ Z_MAX_POS
#endif
;
#endif #endif
} }
else if ((axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) && (homeX || homeY)) { else if ((axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) && (homeX || homeY)) {
@ -3223,7 +3231,11 @@ inline void gcode_G28() {
// For each G29 S2... // For each G29 S2...
if (probe_point == 0) { if (probe_point == 0) {
// For the intial G29 S2 make Z a positive value (e.g., 4.0) // For the intial G29 S2 make Z a positive value (e.g., 4.0)
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z; current_position[Z_AXIS] = MESH_HOME_SEARCH_Z
#if Z_HOME_DIR > 0
+ Z_MAX_POS
#endif
;
SYNC_PLAN_POSITION_KINEMATIC(); SYNC_PLAN_POSITION_KINEMATIC();
} }
else { else {

View File

@ -1057,7 +1057,11 @@ static void lcd_status_screen() {
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_WAITING)); if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_WAITING));
if (LCD_CLICKED) { if (LCD_CLICKED) {
_lcd_level_bed_position = 0; _lcd_level_bed_position = 0;
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z; current_position[Z_AXIS] = MESH_HOME_SEARCH_Z
#if Z_HOME_DIR > 0
+ Z_MAX_POS
#endif
;
planner.set_position_mm(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); planner.set_position_mm(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
lcd_goto_screen(_lcd_level_goto_next_point, true); lcd_goto_screen(_lcd_level_goto_next_point, true);
} }