Skip to content

Commit

Permalink
MBL: Add support for max z endstop
Browse files Browse the repository at this point in the history
  • Loading branch information
epatel committed Jun 25, 2016
1 parent c8a9829 commit da88b00
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
18 changes: 15 additions & 3 deletions Marlin/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3072,7 +3072,11 @@ inline void gcode_G28() {
#if ENABLED(MESH_BED_LEVELING)
if (mbl.has_mesh()) {
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();
mbl.set_active(true);
#if ENABLED(MESH_G28_REST_ORIGIN)
Expand All @@ -3084,7 +3088,11 @@ inline void gcode_G28() {
#else
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z -
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
}
else if ((axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) && (homeX || homeY)) {
Expand Down Expand Up @@ -3223,7 +3231,11 @@ inline void gcode_G28() {
// For each G29 S2...
if (probe_point == 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();
}
else {
Expand Down
6 changes: 5 additions & 1 deletion Marlin/ultralcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,11 @@ static void lcd_status_screen() {
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_WAITING));
if (LCD_CLICKED) {
_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]);
lcd_goto_screen(_lcd_level_goto_next_point, true);
}
Expand Down

0 comments on commit da88b00

Please sign in to comment.