Browse Source

Merge pull request #4146 from epatel/epatel/max_z_endstop

MBL: Add support for max z endstop
Scott Lahteine 9 years ago
parent
commit
e72bd68eaf
2 changed files with 20 additions and 4 deletions
  1. 15
    3
      Marlin/Marlin_main.cpp
  2. 5
    1
      Marlin/ultralcd.cpp

+ 15
- 3
Marlin/Marlin_main.cpp View File

@@ -3072,7 +3072,11 @@ inline void gcode_G28() {
3072 3072
   #if ENABLED(MESH_BED_LEVELING)
3073 3073
     if (mbl.has_mesh()) {
3074 3074
       if (home_all_axis || (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && homeZ)) {
3075
-        current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
3075
+        current_position[Z_AXIS] = MESH_HOME_SEARCH_Z
3076
+          #if Z_HOME_DIR > 0
3077
+            + Z_MAX_POS
3078
+          #endif
3079
+        ;
3076 3080
         SYNC_PLAN_POSITION_KINEMATIC();
3077 3081
         mbl.set_active(true);
3078 3082
         #if ENABLED(MESH_G28_REST_ORIGIN)
@@ -3084,7 +3088,11 @@ inline void gcode_G28() {
3084 3088
         #else
3085 3089
           current_position[Z_AXIS] = MESH_HOME_SEARCH_Z -
3086 3090
             mbl.get_z(current_position[X_AXIS] - home_offset[X_AXIS],
3087
-                      current_position[Y_AXIS] - home_offset[Y_AXIS]);
3091
+                      current_position[Y_AXIS] - home_offset[Y_AXIS])
3092
+            #if Z_HOME_DIR > 0
3093
+              + Z_MAX_POS
3094
+            #endif
3095
+          ;
3088 3096
         #endif
3089 3097
       }
3090 3098
       else if ((axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) && (homeX || homeY)) {
@@ -3223,7 +3231,11 @@ inline void gcode_G28() {
3223 3231
         // For each G29 S2...
3224 3232
         if (probe_point == 0) {
3225 3233
           // For the intial G29 S2 make Z a positive value (e.g., 4.0)
3226
-          current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
3234
+          current_position[Z_AXIS] = MESH_HOME_SEARCH_Z
3235
+            #if Z_HOME_DIR > 0
3236
+              + Z_MAX_POS
3237
+            #endif
3238
+          ;
3227 3239
           SYNC_PLAN_POSITION_KINEMATIC();
3228 3240
         }
3229 3241
         else {

+ 5
- 1
Marlin/ultralcd.cpp View File

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

Loading…
Cancel
Save