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
       if (axis == Z_AXIS) {
1242
       if (axis == Z_AXIS) {
1243
         current_position[Z_AXIS] -= zprobe_zoffset;
1243
         current_position[Z_AXIS] -= zprobe_zoffset;
1244
         #if ENABLED(DEBUG_LEVELING_FEATURE)
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
         #endif
1249
         #endif
1247
       }
1250
       }
1248
     #endif
1251
     #endif
1288
   line_to_destination(feedrate);
1291
   line_to_destination(feedrate);
1289
 }
1292
 }
1290
 inline void sync_plan_position() {
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
   plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1297
   plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1292
 }
1298
 }
1293
 #if ENABLED(DELTA) || ENABLED(SCARA)
1299
 #if ENABLED(DELTA) || ENABLED(SCARA)
1294
   inline void sync_plan_position_delta() {
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
     calculate_delta(current_position);
1304
     calculate_delta(current_position);
1296
     plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
1305
     plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
1297
   }
1306
   }
1332
     #if DISABLED(DELTA)
1341
     #if DISABLED(DELTA)
1333
 
1342
 
1334
       static void set_bed_level_equation_lsq(double* plane_equation_coefficients) {
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
         vector_3 planeNormal = vector_3(-plane_equation_coefficients[0], -plane_equation_coefficients[1], 1);
1348
         vector_3 planeNormal = vector_3(-plane_equation_coefficients[0], -plane_equation_coefficients[1], 1);
1336
-        planeNormal.debug("planeNormal");
1349
+        // planeNormal.debug("planeNormal");
1337
         plan_bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
1350
         plan_bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
1338
         //bedLevel.debug("bedLevel");
1351
         //bedLevel.debug("bedLevel");
1339
 
1352
 
1340
         //plan_bed_level_matrix.debug("bed level before");
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
         //uncorrected_position.debug("position before");
1355
         //uncorrected_position.debug("position before");
1343
 
1356
 
1344
         vector_3 corrected_position = plan_get_position();
1357
         vector_3 corrected_position = plan_get_position();
1348
         current_position[Z_AXIS] = corrected_position.z;
1361
         current_position[Z_AXIS] = corrected_position.z;
1349
 
1362
 
1350
         #if ENABLED(DEBUG_LEVELING_FEATURE)
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
         #endif
1365
         #endif
1353
 
1366
 
1354
         sync_plan_position();
1367
         sync_plan_position();
3026
 
3039
 
3027
     #endif // AUTO_BED_LEVELING_GRID
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
     if (!dryrun) {
3042
     if (!dryrun) {
3043
+
3038
       // make sure the bed_level_rotation_matrix is identity or the planner will get it wrong
3044
       // make sure the bed_level_rotation_matrix is identity or the planner will get it wrong
3039
       plan_bed_level_matrix.set_to_identity();
3045
       plan_bed_level_matrix.set_to_identity();
3040
 
3046
 
3041
       #if ENABLED(DELTA)
3047
       #if ENABLED(DELTA)
3042
         reset_bed_level();
3048
         reset_bed_level();
3043
       #else //!DELTA
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
         //corrected_position.debug("position before G29");
3056
         //corrected_position.debug("position before G29");
3046
         vector_3 uncorrected_position = plan_get_position();
3057
         vector_3 uncorrected_position = plan_get_position();
3047
         //uncorrected_position.debug("position during G29");
3058
         //uncorrected_position.debug("position during G29");
3049
         current_position[Y_AXIS] = uncorrected_position.y;
3060
         current_position[Y_AXIS] = uncorrected_position.y;
3050
         current_position[Z_AXIS] = uncorrected_position.z;
3061
         current_position[Z_AXIS] = uncorrected_position.z;
3051
         sync_plan_position();
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
       #endif // !DELTA
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
     setup_for_endstop_move();
3079
     setup_for_endstop_move();
3056
 
3080
 
3057
     feedrate = homing_feedrate[Z_AXIS];
3081
     feedrate = homing_feedrate[Z_AXIS];

Loading…
Cancel
Save