Browse Source

Merge pull request #4330 from thinkyhead/rc_debug_g28_more

Debugging of MBL in G28
Scott Lahteine 9 years ago
parent
commit
c3cc24242c
1 changed files with 21 additions and 0 deletions
  1. 21
    0
      Marlin/Marlin_main.cpp

+ 21
- 0
Marlin/Marlin_main.cpp View File

2908
   #if ENABLED(MESH_BED_LEVELING)
2908
   #if ENABLED(MESH_BED_LEVELING)
2909
     float pre_home_z = MESH_HOME_SEARCH_Z;
2909
     float pre_home_z = MESH_HOME_SEARCH_Z;
2910
     if (mbl.active()) {
2910
     if (mbl.active()) {
2911
+      #if ENABLED(DEBUG_LEVELING_FEATURE)
2912
+        if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("MBL was active");
2913
+      #endif
2911
       // Save known Z position if already homed
2914
       // Save known Z position if already homed
2912
       if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) {
2915
       if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) {
2913
         pre_home_z = current_position[Z_AXIS];
2916
         pre_home_z = current_position[Z_AXIS];
2915
       }
2918
       }
2916
       mbl.set_active(false);
2919
       mbl.set_active(false);
2917
       current_position[Z_AXIS] = pre_home_z;
2920
       current_position[Z_AXIS] = pre_home_z;
2921
+      #if ENABLED(DEBUG_LEVELING_FEATURE)
2922
+        if (DEBUGGING(LEVELING)) DEBUG_POS("Set Z to pre_home_z", current_position);
2923
+      #endif
2918
     }
2924
     }
2919
   #endif
2925
   #endif
2920
 
2926
 
3140
   // Enable mesh leveling again
3146
   // Enable mesh leveling again
3141
   #if ENABLED(MESH_BED_LEVELING)
3147
   #if ENABLED(MESH_BED_LEVELING)
3142
     if (mbl.has_mesh()) {
3148
     if (mbl.has_mesh()) {
3149
+      #if ENABLED(DEBUG_LEVELING_FEATURE)
3150
+        if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("MBL has mesh");
3151
+      #endif
3143
       if (home_all_axis || (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && homeZ)) {
3152
       if (home_all_axis || (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && homeZ)) {
3153
+        #if ENABLED(DEBUG_LEVELING_FEATURE)
3154
+          if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("MBL Z homing");
3155
+        #endif
3144
         current_position[Z_AXIS] = MESH_HOME_SEARCH_Z
3156
         current_position[Z_AXIS] = MESH_HOME_SEARCH_Z
3145
           #if Z_HOME_DIR > 0
3157
           #if Z_HOME_DIR > 0
3146
             + Z_MAX_POS
3158
             + Z_MAX_POS
3154
           feedrate = homing_feedrate[Z_AXIS];
3166
           feedrate = homing_feedrate[Z_AXIS];
3155
           line_to_destination();
3167
           line_to_destination();
3156
           stepper.synchronize();
3168
           stepper.synchronize();
3169
+          #if ENABLED(DEBUG_LEVELING_FEATURE)
3170
+            if (DEBUGGING(LEVELING)) DEBUG_POS("MBL Rest Origin", current_position);
3171
+          #endif
3157
         #else
3172
         #else
3158
           current_position[Z_AXIS] = MESH_HOME_SEARCH_Z -
3173
           current_position[Z_AXIS] = MESH_HOME_SEARCH_Z -
3159
             mbl.get_z(RAW_CURRENT_POSITION(X_AXIS), RAW_CURRENT_POSITION(Y_AXIS))
3174
             mbl.get_z(RAW_CURRENT_POSITION(X_AXIS), RAW_CURRENT_POSITION(Y_AXIS))
3161
               + Z_MAX_POS
3176
               + Z_MAX_POS
3162
             #endif
3177
             #endif
3163
           ;
3178
           ;
3179
+          #if ENABLED(DEBUG_LEVELING_FEATURE)
3180
+            if (DEBUGGING(LEVELING)) DEBUG_POS("MBL adjusted MESH_HOME_SEARCH_Z", current_position);
3181
+          #endif
3164
         #endif
3182
         #endif
3165
       }
3183
       }
3166
       else if ((axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) && (homeX || homeY)) {
3184
       else if ((axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) && (homeX || homeY)) {
3169
         mbl.set_active(true);
3187
         mbl.set_active(true);
3170
         current_position[Z_AXIS] = pre_home_z -
3188
         current_position[Z_AXIS] = pre_home_z -
3171
           mbl.get_z(RAW_CURRENT_POSITION(X_AXIS), RAW_CURRENT_POSITION(Y_AXIS));
3189
           mbl.get_z(RAW_CURRENT_POSITION(X_AXIS), RAW_CURRENT_POSITION(Y_AXIS));
3190
+        #if ENABLED(DEBUG_LEVELING_FEATURE)
3191
+          if (DEBUGGING(LEVELING)) DEBUG_POS("MBL Home X or Y", current_position);
3192
+        #endif
3172
       }
3193
       }
3173
     }
3194
     }
3174
   #endif
3195
   #endif

Loading…
Cancel
Save