Browse Source

Merge pull request #4934 from thinkyhead/rc_more_debug_homing

More detailed debugging of G28 delta
Scott Lahteine 8 years ago
parent
commit
911f7e436c
3 changed files with 67 additions and 34 deletions
  1. 63
    32
      Marlin/Marlin_main.cpp
  2. 2
    1
      Marlin/planner.cpp
  3. 2
    1
      Marlin/stepper_dac.cpp

+ 63
- 32
Marlin/Marlin_main.cpp View File

@@ -643,7 +643,7 @@ static void report_current_position();
643 643
   #endif
644 644
 
645 645
   #define DEBUG_POS(SUFFIX,VAR) do { \
646
-    print_xyz(PSTR(STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); } while(0)
646
+    print_xyz(PSTR("  " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); } while(0)
647 647
 #endif
648 648
 
649 649
 /**
@@ -1349,7 +1349,8 @@ static void set_axis_is_at_home(AxisEnum axis) {
1349 1349
   #if ENABLED(DEBUG_LEVELING_FEATURE)
1350 1350
     if (DEBUGGING(LEVELING)) {
1351 1351
       SERIAL_ECHOPAIR(">>> set_axis_is_at_home(", axis_codes[axis]);
1352
-      SERIAL_ECHOLNPGM(")");
1352
+      SERIAL_CHAR(')');
1353
+      SERIAL_EOL;
1353 1354
     }
1354 1355
   #endif
1355 1356
 
@@ -1437,7 +1438,8 @@ static void set_axis_is_at_home(AxisEnum axis) {
1437 1438
       SERIAL_ECHOLNPAIR("] = ", home_offset[axis]);
1438 1439
       DEBUG_POS("", current_position);
1439 1440
       SERIAL_ECHOPAIR("<<< set_axis_is_at_home(", axis_codes[axis]);
1440
-      SERIAL_ECHOLNPGM(")");
1441
+      SERIAL_CHAR(')');
1442
+      SERIAL_EOL;
1441 1443
     }
1442 1444
   #endif
1443 1445
 }
@@ -1661,7 +1663,8 @@ static void clean_up_after_endstop_or_probe_move() {
1661 1663
     #if ENABLED(DEBUG_LEVELING_FEATURE)
1662 1664
       if (DEBUGGING(LEVELING)) {
1663 1665
         SERIAL_ECHOPAIR("do_probe_raise(", z_raise);
1664
-        SERIAL_ECHOLNPGM(")");
1666
+        SERIAL_CHAR(')');
1667
+        SERIAL_EOL;
1665 1668
       }
1666 1669
     #endif
1667 1670
 
@@ -1718,7 +1721,8 @@ static void clean_up_after_endstop_or_probe_move() {
1718 1721
     #if ENABLED(DEBUG_LEVELING_FEATURE)
1719 1722
       if (DEBUGGING(LEVELING)) {
1720 1723
         SERIAL_ECHOPAIR("dock_sled(", stow);
1721
-        SERIAL_ECHOLNPGM(")");
1724
+        SERIAL_CHAR(')');
1725
+        SERIAL_EOL;
1722 1726
       }
1723 1727
     #endif
1724 1728
 
@@ -1905,6 +1909,13 @@ static void clean_up_after_endstop_or_probe_move() {
1905 1909
   #if ENABLED(BLTOUCH)
1906 1910
     FORCE_INLINE void set_bltouch_deployed(const bool &deploy) {
1907 1911
       servo[Z_ENDSTOP_SERVO_NR].move(deploy ? BLTOUCH_DEPLOY : BLTOUCH_STOW);
1912
+      #if ENABLED(DEBUG_LEVELING_FEATURE)
1913
+        if (DEBUGGING(LEVELING)) {
1914
+          SERIAL_ECHOPAIR("set_bltouch_deployed(", deploy);
1915
+          SERIAL_CHAR(')');
1916
+          SERIAL_EOL;
1917
+        }
1918
+      #endif
1908 1919
     }
1909 1920
   #endif
1910 1921
 
@@ -2084,7 +2095,8 @@ static void clean_up_after_endstop_or_probe_move() {
2084 2095
         SERIAL_ECHOPAIR(">>> probe_pt(", x);
2085 2096
         SERIAL_ECHOPAIR(", ", y);
2086 2097
         SERIAL_ECHOPAIR(", ", stow ? "stow" : "no stow");
2087
-        SERIAL_ECHOLNPGM(")");
2098
+        SERIAL_CHAR(')');
2099
+        SERIAL_EOL;
2088 2100
         DEBUG_POS("", current_position);
2089 2101
       }
2090 2102
     #endif
@@ -2094,15 +2106,6 @@ static void clean_up_after_endstop_or_probe_move() {
2094 2106
     // Ensure a minimum height before moving the probe
2095 2107
     do_probe_raise(Z_CLEARANCE_BETWEEN_PROBES);
2096 2108
 
2097
-    // Move to the XY where we shall probe
2098
-    #if ENABLED(DEBUG_LEVELING_FEATURE)
2099
-      if (DEBUGGING(LEVELING)) {
2100
-        SERIAL_ECHOPAIR("> do_blocking_move_to_xy(", x - (X_PROBE_OFFSET_FROM_EXTRUDER));
2101
-        SERIAL_ECHOPAIR(", ", y - (Y_PROBE_OFFSET_FROM_EXTRUDER));
2102
-        SERIAL_ECHOLNPGM(")");
2103
-      }
2104
-    #endif
2105
-
2106 2109
     feedrate_mm_s = XY_PROBE_FEEDRATE_MM_S;
2107 2110
 
2108 2111
     // Move the probe to the given XY
@@ -2337,6 +2340,16 @@ static void clean_up_after_endstop_or_probe_move() {
2337 2340
  */
2338 2341
 static void do_homing_move(const AxisEnum axis, float distance, float fr_mm_s=0.0) {
2339 2342
 
2343
+  #if ENABLED(DEBUG_LEVELING_FEATURE)
2344
+    if (DEBUGGING(LEVELING)) {
2345
+      SERIAL_ECHOPAIR(">>> do_homing_move(", axis_codes[axis]);
2346
+      SERIAL_ECHOPAIR(", ", distance);
2347
+      SERIAL_ECHOPAIR(", ", fr_mm_s);
2348
+      SERIAL_CHAR(')');
2349
+      SERIAL_EOL;
2350
+    }
2351
+  #endif
2352
+
2340 2353
   #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH)
2341 2354
     bool deploy_bltouch = (axis == Z_AXIS && distance < 0);
2342 2355
     if (deploy_bltouch) set_bltouch_deployed(true);
@@ -2363,6 +2376,14 @@ static void do_homing_move(const AxisEnum axis, float distance, float fr_mm_s=0.
2363 2376
   #endif
2364 2377
 
2365 2378
   endstops.hit_on_purpose();
2379
+
2380
+  #if ENABLED(DEBUG_LEVELING_FEATURE)
2381
+    if (DEBUGGING(LEVELING)) {
2382
+      SERIAL_ECHOPAIR("<<< do_homing_move(", axis_codes[axis]);
2383
+      SERIAL_CHAR(')');
2384
+      SERIAL_EOL;
2385
+    }
2386
+  #endif
2366 2387
 }
2367 2388
 
2368 2389
 /**
@@ -2392,7 +2413,8 @@ static void homeaxis(AxisEnum axis) {
2392 2413
   #if ENABLED(DEBUG_LEVELING_FEATURE)
2393 2414
     if (DEBUGGING(LEVELING)) {
2394 2415
       SERIAL_ECHOPAIR(">>> homeaxis(", axis_codes[axis]);
2395
-      SERIAL_ECHOLNPGM(")");
2416
+      SERIAL_CHAR(')');
2417
+      SERIAL_EOL;
2396 2418
     }
2397 2419
   #endif
2398 2420
 
@@ -2413,6 +2435,9 @@ static void homeaxis(AxisEnum axis) {
2413 2435
   #endif
2414 2436
 
2415 2437
   // Fast move towards endstop until triggered
2438
+  #if ENABLED(DEBUG_LEVELING_FEATURE)
2439
+    if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("Home 1 Fast:");
2440
+  #endif
2416 2441
   do_homing_move(axis, 1.5 * max_length(axis) * axis_home_dir);
2417 2442
 
2418 2443
   // When homing Z with probe respect probe clearance
@@ -2426,8 +2451,15 @@ static void homeaxis(AxisEnum axis) {
2426 2451
   // If a second homing move is configured...
2427 2452
   if (bump) {
2428 2453
     // Move away from the endstop by the axis HOME_BUMP_MM
2454
+    #if ENABLED(DEBUG_LEVELING_FEATURE)
2455
+      if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("Move Away:");
2456
+    #endif
2429 2457
     do_homing_move(axis, -bump);
2458
+
2430 2459
     // Slow move towards endstop until triggered
2460
+    #if ENABLED(DEBUG_LEVELING_FEATURE)
2461
+      if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("Home 2 Slow:");
2462
+    #endif
2431 2463
     do_homing_move(axis, 2 * bump, get_homing_bump_feedrate(axis));
2432 2464
   }
2433 2465
 
@@ -2466,10 +2498,7 @@ static void homeaxis(AxisEnum axis) {
2466 2498
     // retrace by the amount specified in endstop_adj
2467 2499
     if (endstop_adj[axis] * Z_HOME_DIR < 0) {
2468 2500
       #if ENABLED(DEBUG_LEVELING_FEATURE)
2469
-        if (DEBUGGING(LEVELING)) {
2470
-          SERIAL_ECHOPAIR("> endstop_adj = ", endstop_adj[axis] * Z_HOME_DIR);
2471
-          DEBUG_POS("", current_position);
2472
-        }
2501
+        if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("endstop_adj:");
2473 2502
       #endif
2474 2503
       do_homing_move(axis, endstop_adj[axis]);
2475 2504
     }
@@ -2497,7 +2526,8 @@ static void homeaxis(AxisEnum axis) {
2497 2526
   #if ENABLED(DEBUG_LEVELING_FEATURE)
2498 2527
     if (DEBUGGING(LEVELING)) {
2499 2528
       SERIAL_ECHOPAIR("<<< homeaxis(", axis_codes[axis]);
2500
-      SERIAL_ECHOLNPGM(")");
2529
+      SERIAL_CHAR(')');
2530
+      SERIAL_EOL;
2501 2531
     }
2502 2532
   #endif
2503 2533
 } // homeaxis()
@@ -3044,6 +3074,9 @@ inline void gcode_G4() {
3044 3074
    * This is like quick_home_xy() but for 3 towers.
3045 3075
    */
3046 3076
   inline void home_delta() {
3077
+    #if ENABLED(DEBUG_LEVELING_FEATURE)
3078
+      if (DEBUGGING(LEVELING)) DEBUG_POS(">>> home_delta", current_position);
3079
+    #endif
3047 3080
     // Init the current position of all carriages to 0,0,0
3048 3081
     memset(current_position, 0, sizeof(current_position));
3049 3082
     sync_plan_position();
@@ -3055,11 +3088,8 @@ inline void gcode_G4() {
3055 3088
     stepper.synchronize();
3056 3089
     endstops.hit_on_purpose(); // clear endstop hit flags
3057 3090
 
3058
-    // Probably not needed. Double-check this line:
3059
-    memset(current_position, 0, sizeof(current_position));
3060
-
3061 3091
     // At least one carriage has reached the top.
3062
-    // Now back off and re-home each carriage separately.
3092
+    // Now re-home each carriage separately.
3063 3093
     HOMEAXIS(A);
3064 3094
     HOMEAXIS(B);
3065 3095
     HOMEAXIS(C);
@@ -3073,7 +3103,7 @@ inline void gcode_G4() {
3073 3103
     SYNC_PLAN_POSITION_KINEMATIC();
3074 3104
 
3075 3105
     #if ENABLED(DEBUG_LEVELING_FEATURE)
3076
-      if (DEBUGGING(LEVELING)) DEBUG_POS("(DELTA)", current_position);
3106
+      if (DEBUGGING(LEVELING)) DEBUG_POS("<<< home_delta", current_position);
3077 3107
     #endif
3078 3108
   }
3079 3109
 
@@ -3313,6 +3343,11 @@ inline void gcode_G28() {
3313 3343
 
3314 3344
   endstops.not_homing();
3315 3345
 
3346
+  #if ENABLED(DELTA)
3347
+    // move to a height where we can use the full xy-area
3348
+    do_blocking_move_to_z(delta_clip_start_height);
3349
+  #endif
3350
+
3316 3351
   // Enable mesh leveling again
3317 3352
   #if ENABLED(MESH_BED_LEVELING)
3318 3353
     if (mbl.has_mesh()) {
@@ -3357,11 +3392,6 @@ inline void gcode_G28() {
3357 3392
     }
3358 3393
   #endif
3359 3394
 
3360
-  #if ENABLED(DELTA)
3361
-    // move to a height where we can use the full xy-area
3362
-    do_blocking_move_to_z(delta_clip_start_height);
3363
-  #endif
3364
-
3365 3395
   clean_up_after_endstop_or_probe_move();
3366 3396
 
3367 3397
   #if ENABLED(DEBUG_LEVELING_FEATURE)
@@ -7314,7 +7344,8 @@ inline void gcode_T(uint8_t tmp_extruder) {
7314 7344
   #if ENABLED(DEBUG_LEVELING_FEATURE)
7315 7345
     if (DEBUGGING(LEVELING)) {
7316 7346
       SERIAL_ECHOPAIR(">>> gcode_T(", tmp_extruder);
7317
-      SERIAL_ECHOLNPGM(")");
7347
+      SERIAL_CHAR(')');
7348
+      SERIAL_EOL;
7318 7349
       DEBUG_POS("BEFORE", current_position);
7319 7350
     }
7320 7351
   #endif

+ 2
- 1
Marlin/planner.cpp View File

@@ -658,7 +658,8 @@ void Planner::buffer_line(ARG_X, ARG_Y, ARG_Z, const float &e, float fr_mm_s, co
658 658
     SERIAL_ECHOPAIR(") Z:", lz);
659 659
   #endif
660 660
   SERIAL_ECHOPAIR(" (", dz);
661
-  SERIAL_ECHOLNPGM(")");
661
+  SERIAL_CHAR(')');
662
+  SERIAL_EOL;
662 663
   //*/
663 664
 
664 665
   // DRYRUN ignores all temperature constraints and assures that the extruder is instantly satisfied

+ 2
- 1
Marlin/stepper_dac.cpp View File

@@ -102,7 +102,8 @@
102 102
     SERIAL_ECHOPAIR(" (",   dac_amps(2));
103 103
     SERIAL_ECHOPAIR(") E:", dac_perc(3));
104 104
     SERIAL_ECHOPAIR(" (",   dac_amps(3));
105
-    SERIAL_ECHOLNPGM(")");
105
+    SERIAL_CHAR(')');
106
+    SERIAL_EOL;
106 107
   }
107 108
 
108 109
   void dac_commit_eeprom() {

Loading…
Cancel
Save