Browse Source

Merge pull request #3434 from thinkyhead/rc_more_debug_leveling

Additional debug leveling output
Scott Lahteine 8 years ago
parent
commit
843aa90b5a
1 changed files with 37 additions and 13 deletions
  1. 37
    13
      Marlin/Marlin_main.cpp

+ 37
- 13
Marlin/Marlin_main.cpp View File

@@ -1242,7 +1242,10 @@ static void set_axis_is_at_home(AxisEnum axis) {
1242 1242
       if (axis == Z_AXIS) {
1243 1243
         current_position[Z_AXIS] -= zprobe_zoffset;
1244 1244
         #if ENABLED(DEBUG_LEVELING_FEATURE)
1245
-          if (DEBUGGING(LEVELING)) SERIAL_ECHOPAIR("> zprobe_zoffset==", zprobe_zoffset);
1245
+          if (DEBUGGING(LEVELING)) {
1246
+            SERIAL_ECHOPAIR("> zprobe_zoffset==", zprobe_zoffset);
1247
+            SERIAL_EOL;
1248
+          }
1246 1249
         #endif
1247 1250
       }
1248 1251
     #endif
@@ -1288,10 +1291,16 @@ inline void line_to_destination() {
1288 1291
   line_to_destination(feedrate);
1289 1292
 }
1290 1293
 inline void sync_plan_position() {
1294
+  #if ENABLED(DEBUG_LEVELING_FEATURE)
1295
+    if (DEBUGGING(LEVELING)) DEBUG_POS("sync_plan_position", current_position);
1296
+  #endif
1291 1297
   plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1292 1298
 }
1293 1299
 #if ENABLED(DELTA) || ENABLED(SCARA)
1294 1300
   inline void sync_plan_position_delta() {
1301
+    #if ENABLED(DEBUG_LEVELING_FEATURE)
1302
+      if (DEBUGGING(LEVELING)) DEBUG_POS("sync_plan_position_delta", current_position);
1303
+    #endif
1295 1304
     calculate_delta(current_position);
1296 1305
     plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
1297 1306
   }
@@ -1332,13 +1341,17 @@ static void setup_for_endstop_move() {
1332 1341
     #if DISABLED(DELTA)
1333 1342
 
1334 1343
       static void set_bed_level_equation_lsq(double* plane_equation_coefficients) {
1344
+        #if ENABLED(DEBUG_LEVELING_FEATURE)
1345
+          if (DEBUGGING(LEVELING)) DEBUG_POS("BEFORE set_bed_level_equation_lsq", current_position);
1346
+        #endif
1347
+
1335 1348
         vector_3 planeNormal = vector_3(-plane_equation_coefficients[0], -plane_equation_coefficients[1], 1);
1336
-        planeNormal.debug("planeNormal");
1349
+        // planeNormal.debug("planeNormal");
1337 1350
         plan_bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
1338 1351
         //bedLevel.debug("bedLevel");
1339 1352
 
1340 1353
         //plan_bed_level_matrix.debug("bed level before");
1341
-        //vector_3 uncorrected_position = plan_get_position_mm();
1354
+        //vector_3 uncorrected_position = plan_get_position();
1342 1355
         //uncorrected_position.debug("position before");
1343 1356
 
1344 1357
         vector_3 corrected_position = plan_get_position();
@@ -1348,7 +1361,7 @@ static void setup_for_endstop_move() {
1348 1361
         current_position[Z_AXIS] = corrected_position.z;
1349 1362
 
1350 1363
         #if ENABLED(DEBUG_LEVELING_FEATURE)
1351
-          if (DEBUGGING(LEVELING)) DEBUG_POS("set_bed_level_equation_lsq", current_position);
1364
+          if (DEBUGGING(LEVELING)) DEBUG_POS("AFTER set_bed_level_equation_lsq", current_position);
1352 1365
         #endif
1353 1366
 
1354 1367
         sync_plan_position();
@@ -3026,22 +3039,20 @@ inline void gcode_G28() {
3026 3039
 
3027 3040
     #endif // AUTO_BED_LEVELING_GRID
3028 3041
 
3029
-    #if ENABLED(Z_PROBE_SLED)
3030
-      dock_sled(false); // engage (un-dock) the Z probe
3031
-    #elif ENABLED(Z_PROBE_ALLEN_KEY) || (ENABLED(DELTA) && SERVO_LEVELING)
3032
-      deploy_z_probe();
3033
-    #endif
3034
-
3035
-    st_synchronize();
3036
-
3037 3042
     if (!dryrun) {
3043
+
3038 3044
       // make sure the bed_level_rotation_matrix is identity or the planner will get it wrong
3039 3045
       plan_bed_level_matrix.set_to_identity();
3040 3046
 
3041 3047
       #if ENABLED(DELTA)
3042 3048
         reset_bed_level();
3043 3049
       #else //!DELTA
3044
-        //vector_3 corrected_position = plan_get_position_mm();
3050
+
3051
+        #if ENABLED(DEBUG_LEVELING_FEATURE)
3052
+          if (DEBUGGING(LEVELING)) DEBUG_POS("BEFORE matrix.set_to_identity", current_position);
3053
+        #endif
3054
+
3055
+        //vector_3 corrected_position = plan_get_position();
3045 3056
         //corrected_position.debug("position before G29");
3046 3057
         vector_3 uncorrected_position = plan_get_position();
3047 3058
         //uncorrected_position.debug("position during G29");
@@ -3049,9 +3060,22 @@ inline void gcode_G28() {
3049 3060
         current_position[Y_AXIS] = uncorrected_position.y;
3050 3061
         current_position[Z_AXIS] = uncorrected_position.z;
3051 3062
         sync_plan_position();
3063
+
3064
+        #if ENABLED(DEBUG_LEVELING_FEATURE)
3065
+          if (DEBUGGING(LEVELING)) DEBUG_POS("AFTER matrix.set_to_identity", current_position);
3066
+        #endif
3067
+
3052 3068
       #endif // !DELTA
3053 3069
     }
3054 3070
 
3071
+    #if ENABLED(Z_PROBE_SLED)
3072
+      dock_sled(false); // engage (un-dock) the Z probe
3073
+    #elif ENABLED(Z_PROBE_ALLEN_KEY) || (ENABLED(DELTA) && SERVO_LEVELING)
3074
+      deploy_z_probe();
3075
+    #endif
3076
+
3077
+    st_synchronize();
3078
+
3055 3079
     setup_for_endstop_move();
3056 3080
 
3057 3081
     feedrate = homing_feedrate[Z_AXIS];

Loading…
Cancel
Save