Browse Source

Clean up G28 MBL code

Scott Lahteine 9 years ago
parent
commit
2c52e6ecf4
1 changed files with 3 additions and 10 deletions
  1. 3
    10
      Marlin/Marlin_main.cpp

+ 3
- 10
Marlin/Marlin_main.cpp View File

3140
         #if ENABLED(MESH_G28_REST_ORIGIN)
3140
         #if ENABLED(MESH_G28_REST_ORIGIN)
3141
           current_position[Z_AXIS] = 0.0;
3141
           current_position[Z_AXIS] = 0.0;
3142
           set_destination_to_current();
3142
           set_destination_to_current();
3143
-          feedrate_mm_s = homing_feedrate_mm_s[Z_AXIS];
3144
-          line_to_destination();
3143
+          line_to_destination(homing_feedrate_mm_s[Z_AXIS]);
3145
           stepper.synchronize();
3144
           stepper.synchronize();
3146
           #if ENABLED(DEBUG_LEVELING_FEATURE)
3145
           #if ENABLED(DEBUG_LEVELING_FEATURE)
3147
             if (DEBUGGING(LEVELING)) DEBUG_POS("MBL Rest Origin", current_position);
3146
             if (DEBUGGING(LEVELING)) DEBUG_POS("MBL Rest Origin", current_position);
3148
           #endif
3147
           #endif
3149
         #else
3148
         #else
3150
-          current_position[Z_AXIS] = MESH_HOME_SEARCH_Z -
3151
-            mbl.get_z(RAW_CURRENT_POSITION(X_AXIS), RAW_CURRENT_POSITION(Y_AXIS))
3152
-            #if Z_HOME_DIR > 0
3153
-              + Z_MAX_POS
3154
-            #endif
3155
-          ;
3149
+          planner.unapply_leveling(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS]);
3156
           #if ENABLED(DEBUG_LEVELING_FEATURE)
3150
           #if ENABLED(DEBUG_LEVELING_FEATURE)
3157
             if (DEBUGGING(LEVELING)) DEBUG_POS("MBL adjusted MESH_HOME_SEARCH_Z", current_position);
3151
             if (DEBUGGING(LEVELING)) DEBUG_POS("MBL adjusted MESH_HOME_SEARCH_Z", current_position);
3158
           #endif
3152
           #endif
3162
         current_position[Z_AXIS] = pre_home_z;
3156
         current_position[Z_AXIS] = pre_home_z;
3163
         SYNC_PLAN_POSITION_KINEMATIC();
3157
         SYNC_PLAN_POSITION_KINEMATIC();
3164
         mbl.set_active(true);
3158
         mbl.set_active(true);
3165
-        current_position[Z_AXIS] = pre_home_z -
3166
-          mbl.get_z(RAW_CURRENT_POSITION(X_AXIS), RAW_CURRENT_POSITION(Y_AXIS));
3159
+        planner.unapply_leveling(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS]);
3167
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3160
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3168
           if (DEBUGGING(LEVELING)) DEBUG_POS("MBL Home X or Y", current_position);
3161
           if (DEBUGGING(LEVELING)) DEBUG_POS("MBL Home X or Y", current_position);
3169
         #endif
3162
         #endif

Loading…
Cancel
Save