Browse Source

Add DEBUGGING macro

Scott Lahteine 9 years ago
parent
commit
05765fb570
3 changed files with 70 additions and 69 deletions
  1. 1
    0
      Marlin/Marlin.h
  2. 68
    68
      Marlin/Marlin_main.cpp
  3. 1
    1
      Marlin/planner.cpp

+ 1
- 0
Marlin/Marlin.h View File

@@ -238,6 +238,7 @@ enum DebugFlags {
238 238
   DEBUG_LEVELING      = _BV(5)
239 239
 };
240 240
 extern uint8_t marlin_debug_flags;
241
+#define DEBUGGING(F) (marlin_debug_flags & (DEBUG_## F))
241 242
 
242 243
 extern bool Running;
243 244
 inline bool IsRunning() { return  Running; }

+ 68
- 68
Marlin/Marlin_main.cpp View File

@@ -1238,7 +1238,7 @@ static void set_axis_is_at_home(AxisEnum axis) {
1238 1238
     #endif
1239 1239
 
1240 1240
     #if ENABLED(DEBUG_LEVELING_FEATURE)
1241
-      if (marlin_debug_flags & DEBUG_LEVELING) {
1241
+      if (DEBUGGING(LEVELING)) {
1242 1242
         SERIAL_ECHOPAIR("set_axis_is_at_home ", (unsigned long)axis);
1243 1243
         SERIAL_ECHOPAIR(" > (home_offset[axis]==", home_offset[axis]);
1244 1244
         print_xyz(") > current_position", current_position);
@@ -1290,7 +1290,7 @@ static void setup_for_endstop_move() {
1290 1290
   feedrate_multiplier = 100;
1291 1291
   refresh_cmd_timeout();
1292 1292
   #if ENABLED(DEBUG_LEVELING_FEATURE)
1293
-    if (marlin_debug_flags & DEBUG_LEVELING) {
1293
+    if (DEBUGGING(LEVELING)) {
1294 1294
       SERIAL_ECHOLNPGM("setup_for_endstop_move > enable_endstops(true)");
1295 1295
     }
1296 1296
   #endif
@@ -1305,7 +1305,7 @@ static void setup_for_endstop_move() {
1305 1305
      */
1306 1306
     void prepare_move_raw() {
1307 1307
       #if ENABLED(DEBUG_LEVELING_FEATURE)
1308
-        if (marlin_debug_flags & DEBUG_LEVELING) {
1308
+        if (DEBUGGING(LEVELING)) {
1309 1309
           print_xyz("prepare_move_raw > destination", destination);
1310 1310
         }
1311 1311
       #endif
@@ -1337,7 +1337,7 @@ static void setup_for_endstop_move() {
1337 1337
         current_position[Z_AXIS] = corrected_position.z;
1338 1338
 
1339 1339
         #if ENABLED(DEBUG_LEVELING_FEATURE)
1340
-          if (marlin_debug_flags & DEBUG_LEVELING) {
1340
+          if (DEBUGGING(LEVELING)) {
1341 1341
             print_xyz("set_bed_level_equation_lsq > current_position", current_position);
1342 1342
           }
1343 1343
         #endif
@@ -1372,7 +1372,7 @@ static void setup_for_endstop_move() {
1372 1372
       current_position[Z_AXIS] = corrected_position.z;
1373 1373
 
1374 1374
       #if ENABLED(DEBUG_LEVELING_FEATURE)
1375
-        if (marlin_debug_flags & DEBUG_LEVELING) {
1375
+        if (DEBUGGING(LEVELING)) {
1376 1376
           print_xyz("set_bed_level_equation_3pts > current_position", current_position);
1377 1377
         }
1378 1378
       #endif
@@ -1396,7 +1396,7 @@ static void setup_for_endstop_move() {
1396 1396
       long start_steps = st_get_position(Z_AXIS);
1397 1397
 
1398 1398
       #if ENABLED(DEBUG_LEVELING_FEATURE)
1399
-        if (marlin_debug_flags & DEBUG_LEVELING) {
1399
+        if (DEBUGGING(LEVELING)) {
1400 1400
           SERIAL_ECHOLNPGM("run_z_probe (DELTA) 1");
1401 1401
         }
1402 1402
       #endif
@@ -1417,7 +1417,7 @@ static void setup_for_endstop_move() {
1417 1417
       current_position[Z_AXIS] = mm;
1418 1418
 
1419 1419
       #if ENABLED(DEBUG_LEVELING_FEATURE)
1420
-        if (marlin_debug_flags & DEBUG_LEVELING) {
1420
+        if (DEBUGGING(LEVELING)) {
1421 1421
           print_xyz("run_z_probe (DELTA) 2 > current_position", current_position);
1422 1422
         }
1423 1423
       #endif
@@ -1460,7 +1460,7 @@ static void setup_for_endstop_move() {
1460 1460
       sync_plan_position();
1461 1461
 
1462 1462
       #if ENABLED(DEBUG_LEVELING_FEATURE)
1463
-        if (marlin_debug_flags & DEBUG_LEVELING) {
1463
+        if (DEBUGGING(LEVELING)) {
1464 1464
           print_xyz("run_z_probe > current_position", current_position);
1465 1465
         }
1466 1466
       #endif
@@ -1476,7 +1476,7 @@ static void setup_for_endstop_move() {
1476 1476
     float oldFeedRate = feedrate;
1477 1477
 
1478 1478
     #if ENABLED(DEBUG_LEVELING_FEATURE)
1479
-      if (marlin_debug_flags & DEBUG_LEVELING) {
1479
+      if (DEBUGGING(LEVELING)) {
1480 1480
         print_xyz("do_blocking_move_to", x, y, z);
1481 1481
       }
1482 1482
     #endif
@@ -1529,7 +1529,7 @@ static void setup_for_endstop_move() {
1529 1529
 
1530 1530
   static void clean_up_after_endstop_move() {
1531 1531
     #if ENABLED(DEBUG_LEVELING_FEATURE)
1532
-      if (marlin_debug_flags & DEBUG_LEVELING) {
1532
+      if (DEBUGGING(LEVELING)) {
1533 1533
         SERIAL_ECHOLNPGM("clean_up_after_endstop_move > ENDSTOPS_ONLY_FOR_HOMING > endstops_not_homing()");
1534 1534
       }
1535 1535
     #endif
@@ -1544,7 +1544,7 @@ static void setup_for_endstop_move() {
1544 1544
   static void deploy_z_probe() {
1545 1545
 
1546 1546
     #if ENABLED(DEBUG_LEVELING_FEATURE)
1547
-      if (marlin_debug_flags & DEBUG_LEVELING) {
1547
+      if (DEBUGGING(LEVELING)) {
1548 1548
         print_xyz("deploy_z_probe > current_position", current_position);
1549 1549
       }
1550 1550
     #endif
@@ -1639,7 +1639,7 @@ static void setup_for_endstop_move() {
1639 1639
 
1640 1640
   static void stow_z_probe(bool doRaise = true) {
1641 1641
     #if ENABLED(DEBUG_LEVELING_FEATURE)
1642
-      if (marlin_debug_flags & DEBUG_LEVELING) {
1642
+      if (DEBUGGING(LEVELING)) {
1643 1643
         print_xyz("stow_z_probe > current_position", current_position);
1644 1644
       }
1645 1645
     #endif
@@ -1654,7 +1654,7 @@ static void setup_for_endstop_move() {
1654 1654
         #if Z_RAISE_AFTER_PROBING > 0
1655 1655
           if (doRaise) {
1656 1656
             #if ENABLED(DEBUG_LEVELING_FEATURE)
1657
-              if (marlin_debug_flags & DEBUG_LEVELING) {
1657
+              if (DEBUGGING(LEVELING)) {
1658 1658
                 SERIAL_ECHOPAIR("Raise Z (after) by ", (float)Z_RAISE_AFTER_PROBING);
1659 1659
                 SERIAL_EOL;
1660 1660
                 SERIAL_ECHO("> SERVO_ENDSTOPS > raise_z_after_probing()");
@@ -1749,7 +1749,7 @@ static void setup_for_endstop_move() {
1749 1749
   // Probe bed height at position (x,y), returns the measured z value
1750 1750
   static float probe_pt(float x, float y, float z_before, ProbeAction probe_action = ProbeDeployAndStow, int verbose_level = 1) {
1751 1751
     #if ENABLED(DEBUG_LEVELING_FEATURE)
1752
-      if (marlin_debug_flags & DEBUG_LEVELING) {
1752
+      if (DEBUGGING(LEVELING)) {
1753 1753
         SERIAL_ECHOLNPGM("probe_pt >>>");
1754 1754
         SERIAL_ECHOPAIR("> ProbeAction:", (unsigned long)probe_action);
1755 1755
         SERIAL_EOL;
@@ -1758,7 +1758,7 @@ static void setup_for_endstop_move() {
1758 1758
     #endif
1759 1759
 
1760 1760
     #if ENABLED(DEBUG_LEVELING_FEATURE)
1761
-      if (marlin_debug_flags & DEBUG_LEVELING) {
1761
+      if (DEBUGGING(LEVELING)) {
1762 1762
         SERIAL_ECHOPAIR("Z Raise to z_before ", z_before);
1763 1763
         SERIAL_EOL;
1764 1764
         SERIAL_ECHOPAIR("> do_blocking_move_to_z ", z_before);
@@ -1770,7 +1770,7 @@ static void setup_for_endstop_move() {
1770 1770
     do_blocking_move_to_z(z_before); // this also updates current_position
1771 1771
 
1772 1772
     #if ENABLED(DEBUG_LEVELING_FEATURE)
1773
-      if (marlin_debug_flags & DEBUG_LEVELING) {
1773
+      if (DEBUGGING(LEVELING)) {
1774 1774
         SERIAL_ECHOPAIR("> do_blocking_move_to_xy ", x - (X_PROBE_OFFSET_FROM_EXTRUDER));
1775 1775
         SERIAL_ECHOPAIR(", ", y - (Y_PROBE_OFFSET_FROM_EXTRUDER));
1776 1776
         SERIAL_EOL;
@@ -1783,7 +1783,7 @@ static void setup_for_endstop_move() {
1783 1783
     #if DISABLED(Z_PROBE_SLED) && DISABLED(Z_PROBE_ALLEN_KEY)
1784 1784
       if (probe_action & ProbeDeploy) {
1785 1785
         #if ENABLED(DEBUG_LEVELING_FEATURE)
1786
-          if (marlin_debug_flags & DEBUG_LEVELING) {
1786
+          if (DEBUGGING(LEVELING)) {
1787 1787
             SERIAL_ECHOLNPGM("> ProbeDeploy");
1788 1788
           }
1789 1789
         #endif
@@ -1797,7 +1797,7 @@ static void setup_for_endstop_move() {
1797 1797
     #if DISABLED(Z_PROBE_SLED) && DISABLED(Z_PROBE_ALLEN_KEY)
1798 1798
       if (probe_action & ProbeStow) {
1799 1799
         #if ENABLED(DEBUG_LEVELING_FEATURE)
1800
-          if (marlin_debug_flags & DEBUG_LEVELING) {
1800
+          if (DEBUGGING(LEVELING)) {
1801 1801
             SERIAL_ECHOLNPGM("> ProbeStow (stow_z_probe will do Z Raise)");
1802 1802
           }
1803 1803
         #endif
@@ -1816,7 +1816,7 @@ static void setup_for_endstop_move() {
1816 1816
     }
1817 1817
 
1818 1818
     #if ENABLED(DEBUG_LEVELING_FEATURE)
1819
-      if (marlin_debug_flags & DEBUG_LEVELING) {
1819
+      if (DEBUGGING(LEVELING)) {
1820 1820
         SERIAL_ECHOLNPGM("<<< probe_pt");
1821 1821
       }
1822 1822
     #endif
@@ -1883,7 +1883,7 @@ static void setup_for_endstop_move() {
1883 1883
      */
1884 1884
     void reset_bed_level() {
1885 1885
       #if ENABLED(DEBUG_LEVELING_FEATURE)
1886
-        if (marlin_debug_flags & DEBUG_LEVELING) {
1886
+        if (DEBUGGING(LEVELING)) {
1887 1887
           SERIAL_ECHOLNPGM("reset_bed_level");
1888 1888
         }
1889 1889
       #endif
@@ -1932,7 +1932,7 @@ static void axis_unhomed_error() {
1932 1932
    */
1933 1933
   static void dock_sled(bool dock, int offset = 0) {
1934 1934
     #if ENABLED(DEBUG_LEVELING_FEATURE)
1935
-      if (marlin_debug_flags & DEBUG_LEVELING) {
1935
+      if (DEBUGGING(LEVELING)) {
1936 1936
         SERIAL_ECHOPAIR("dock_sled", dock);
1937 1937
         SERIAL_EOL;
1938 1938
       }
@@ -1977,7 +1977,7 @@ static void axis_unhomed_error() {
1977 1977
 
1978 1978
 static void homeaxis(AxisEnum axis) {
1979 1979
   #if ENABLED(DEBUG_LEVELING_FEATURE)
1980
-    if (marlin_debug_flags & DEBUG_LEVELING) {
1980
+    if (DEBUGGING(LEVELING)) {
1981 1981
       SERIAL_ECHOPAIR(">>> homeaxis(", (unsigned long)axis);
1982 1982
       SERIAL_CHAR(')');
1983 1983
       SERIAL_EOL;
@@ -2036,7 +2036,7 @@ static void homeaxis(AxisEnum axis) {
2036 2036
     sync_plan_position();
2037 2037
 
2038 2038
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2039
-      if (marlin_debug_flags & DEBUG_LEVELING) {
2039
+      if (DEBUGGING(LEVELING)) {
2040 2040
         SERIAL_ECHOLNPGM("> enable_endstops(false)");
2041 2041
       }
2042 2042
     #endif
@@ -2048,7 +2048,7 @@ static void homeaxis(AxisEnum axis) {
2048 2048
     st_synchronize();
2049 2049
 
2050 2050
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2051
-      if (marlin_debug_flags & DEBUG_LEVELING) {
2051
+      if (DEBUGGING(LEVELING)) {
2052 2052
         SERIAL_ECHOLNPGM("> enable_endstops(true)");
2053 2053
       }
2054 2054
     #endif
@@ -2063,7 +2063,7 @@ static void homeaxis(AxisEnum axis) {
2063 2063
     st_synchronize();
2064 2064
 
2065 2065
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2066
-      if (marlin_debug_flags & DEBUG_LEVELING) {
2066
+      if (DEBUGGING(LEVELING)) {
2067 2067
         print_xyz("> TRIGGER ENDSTOP > current_position", current_position);
2068 2068
       }
2069 2069
     #endif
@@ -2097,7 +2097,7 @@ static void homeaxis(AxisEnum axis) {
2097 2097
       // retrace by the amount specified in endstop_adj
2098 2098
       if (endstop_adj[axis] * axis_home_dir < 0) {
2099 2099
         #if ENABLED(DEBUG_LEVELING_FEATURE)
2100
-          if (marlin_debug_flags & DEBUG_LEVELING) {
2100
+          if (DEBUGGING(LEVELING)) {
2101 2101
             SERIAL_ECHOLNPGM("> enable_endstops(false)");
2102 2102
           }
2103 2103
         #endif
@@ -2105,7 +2105,7 @@ static void homeaxis(AxisEnum axis) {
2105 2105
         sync_plan_position();
2106 2106
         destination[axis] = endstop_adj[axis];
2107 2107
         #if ENABLED(DEBUG_LEVELING_FEATURE)
2108
-          if (marlin_debug_flags & DEBUG_LEVELING) {
2108
+          if (DEBUGGING(LEVELING)) {
2109 2109
             SERIAL_ECHOPAIR("> endstop_adj = ", endstop_adj[axis]);
2110 2110
             print_xyz(" > destination", destination);
2111 2111
           }
@@ -2113,7 +2113,7 @@ static void homeaxis(AxisEnum axis) {
2113 2113
         line_to_destination();
2114 2114
         st_synchronize();
2115 2115
         #if ENABLED(DEBUG_LEVELING_FEATURE)
2116
-          if (marlin_debug_flags & DEBUG_LEVELING) {
2116
+          if (DEBUGGING(LEVELING)) {
2117 2117
             SERIAL_ECHOLNPGM("> enable_endstops(true)");
2118 2118
           }
2119 2119
         #endif
@@ -2121,7 +2121,7 @@ static void homeaxis(AxisEnum axis) {
2121 2121
       }
2122 2122
       #if ENABLED(DEBUG_LEVELING_FEATURE)
2123 2123
         else {
2124
-          if (marlin_debug_flags & DEBUG_LEVELING) {
2124
+          if (DEBUGGING(LEVELING)) {
2125 2125
             SERIAL_ECHOPAIR("> endstop_adj * axis_home_dir = ", endstop_adj[axis] * axis_home_dir);
2126 2126
             SERIAL_EOL;
2127 2127
           }
@@ -2134,7 +2134,7 @@ static void homeaxis(AxisEnum axis) {
2134 2134
     sync_plan_position();
2135 2135
 
2136 2136
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2137
-      if (marlin_debug_flags & DEBUG_LEVELING) {
2137
+      if (DEBUGGING(LEVELING)) {
2138 2138
         print_xyz("> AFTER set_axis_is_at_home > current_position", current_position);
2139 2139
       }
2140 2140
     #endif
@@ -2156,7 +2156,7 @@ static void homeaxis(AxisEnum axis) {
2156 2156
       if (axis == Z_AXIS) {
2157 2157
         if (axis_home_dir < 0) {
2158 2158
           #if ENABLED(DEBUG_LEVELING_FEATURE)
2159
-            if (marlin_debug_flags & DEBUG_LEVELING) {
2159
+            if (DEBUGGING(LEVELING)) {
2160 2160
               SERIAL_ECHOLNPGM("> SERVO_LEVELING > stow_z_probe");
2161 2161
             }
2162 2162
           #endif
@@ -2172,7 +2172,7 @@ static void homeaxis(AxisEnum axis) {
2172 2172
         // Retract Servo endstop if enabled
2173 2173
         if (servo_endstop_id[axis] >= 0) {
2174 2174
           #if ENABLED(DEBUG_LEVELING_FEATURE)
2175
-            if (marlin_debug_flags & DEBUG_LEVELING) {
2175
+            if (DEBUGGING(LEVELING)) {
2176 2176
               SERIAL_ECHOLNPGM("> SERVO_ENDSTOPS > Stow with servo.move()");
2177 2177
             }
2178 2178
           #endif
@@ -2185,7 +2185,7 @@ static void homeaxis(AxisEnum axis) {
2185 2185
   }
2186 2186
 
2187 2187
   #if ENABLED(DEBUG_LEVELING_FEATURE)
2188
-    if (marlin_debug_flags & DEBUG_LEVELING) {
2188
+    if (DEBUGGING(LEVELING)) {
2189 2189
       SERIAL_ECHOPAIR("<<< homeaxis(", (unsigned long)axis);
2190 2190
       SERIAL_CHAR(')');
2191 2191
       SERIAL_EOL;
@@ -2424,7 +2424,7 @@ inline void gcode_G4() {
2424 2424
 inline void gcode_G28() {
2425 2425
 
2426 2426
   #if ENABLED(DEBUG_LEVELING_FEATURE)
2427
-    if (marlin_debug_flags & DEBUG_LEVELING) {
2427
+    if (DEBUGGING(LEVELING)) {
2428 2428
       SERIAL_ECHOLNPGM("gcode_G28 >>>");
2429 2429
     }
2430 2430
   #endif
@@ -2487,7 +2487,7 @@ inline void gcode_G28() {
2487 2487
     sync_plan_position_delta();
2488 2488
 
2489 2489
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2490
-      if (marlin_debug_flags & DEBUG_LEVELING) {
2490
+      if (DEBUGGING(LEVELING)) {
2491 2491
         print_xyz("(DELTA) > current_position", current_position);
2492 2492
       }
2493 2493
     #endif
@@ -2505,7 +2505,7 @@ inline void gcode_G28() {
2505 2505
       if (home_all_axis || homeZ) {
2506 2506
         HOMEAXIS(Z);
2507 2507
         #if ENABLED(DEBUG_LEVELING_FEATURE)
2508
-          if (marlin_debug_flags & DEBUG_LEVELING) {
2508
+          if (DEBUGGING(LEVELING)) {
2509 2509
             print_xyz("> HOMEAXIS(Z) > current_position", current_position);
2510 2510
           }
2511 2511
         #endif
@@ -2518,7 +2518,7 @@ inline void gcode_G28() {
2518 2518
         destination[Z_AXIS] = MIN_Z_HEIGHT_FOR_HOMING;
2519 2519
         feedrate = max_feedrate[Z_AXIS] * 60;  // feedrate (mm/m) = max_feedrate (mm/s)
2520 2520
         #if ENABLED(DEBUG_LEVELING_FEATURE)
2521
-          if (marlin_debug_flags & DEBUG_LEVELING) {
2521
+          if (DEBUGGING(LEVELING)) {
2522 2522
             SERIAL_ECHOPAIR("Raise Z (before homing) to ", (float)(MIN_Z_HEIGHT_FOR_HOMING));
2523 2523
             SERIAL_EOL;
2524 2524
             print_xyz("> (home_all_axis || homeZ) > current_position", current_position);
@@ -2566,7 +2566,7 @@ inline void gcode_G28() {
2566 2566
         sync_plan_position();
2567 2567
 
2568 2568
         #if ENABLED(DEBUG_LEVELING_FEATURE)
2569
-          if (marlin_debug_flags & DEBUG_LEVELING) {
2569
+          if (DEBUGGING(LEVELING)) {
2570 2570
             print_xyz("> QUICK_HOME > current_position 1", current_position);
2571 2571
           }
2572 2572
         #endif
@@ -2585,7 +2585,7 @@ inline void gcode_G28() {
2585 2585
         #endif
2586 2586
 
2587 2587
         #if ENABLED(DEBUG_LEVELING_FEATURE)
2588
-          if (marlin_debug_flags & DEBUG_LEVELING) {
2588
+          if (DEBUGGING(LEVELING)) {
2589 2589
             print_xyz("> QUICK_HOME > current_position 2", current_position);
2590 2590
           }
2591 2591
         #endif
@@ -2616,7 +2616,7 @@ inline void gcode_G28() {
2616 2616
         HOMEAXIS(X);
2617 2617
       #endif
2618 2618
       #if ENABLED(DEBUG_LEVELING_FEATURE)
2619
-        if (marlin_debug_flags & DEBUG_LEVELING) {
2619
+        if (DEBUGGING(LEVELING)) {
2620 2620
           print_xyz("> homeX", current_position);
2621 2621
         }
2622 2622
       #endif
@@ -2627,7 +2627,7 @@ inline void gcode_G28() {
2627 2627
       if (home_all_axis || homeY) {
2628 2628
         HOMEAXIS(Y);
2629 2629
         #if ENABLED(DEBUG_LEVELING_FEATURE)
2630
-          if (marlin_debug_flags & DEBUG_LEVELING) {
2630
+          if (DEBUGGING(LEVELING)) {
2631 2631
             print_xyz("> homeY", current_position);
2632 2632
           }
2633 2633
         #endif
@@ -2642,7 +2642,7 @@ inline void gcode_G28() {
2642 2642
         #if ENABLED(Z_SAFE_HOMING)
2643 2643
 
2644 2644
           #if ENABLED(DEBUG_LEVELING_FEATURE)
2645
-            if (marlin_debug_flags & DEBUG_LEVELING) {
2645
+            if (DEBUGGING(LEVELING)) {
2646 2646
               SERIAL_ECHOLNPGM("> Z_SAFE_HOMING >>>");
2647 2647
             }
2648 2648
           #endif
@@ -2667,7 +2667,7 @@ inline void gcode_G28() {
2667 2667
             feedrate = XY_TRAVEL_SPEED;
2668 2668
 
2669 2669
             #if ENABLED(DEBUG_LEVELING_FEATURE)
2670
-              if (marlin_debug_flags & DEBUG_LEVELING) {
2670
+              if (DEBUGGING(LEVELING)) {
2671 2671
                 print_xyz("> Z_SAFE_HOMING > home_all_axis > current_position", current_position);
2672 2672
                 print_xyz("> Z_SAFE_HOMING > home_all_axis > destination", destination);
2673 2673
               }
@@ -2720,7 +2720,7 @@ inline void gcode_G28() {
2720 2720
           } // !home_all_axes && homeZ
2721 2721
 
2722 2722
           #if ENABLED(DEBUG_LEVELING_FEATURE)
2723
-            if (marlin_debug_flags & DEBUG_LEVELING) {
2723
+            if (DEBUGGING(LEVELING)) {
2724 2724
               SERIAL_ECHOLNPGM("<<< Z_SAFE_HOMING");
2725 2725
             }
2726 2726
           #endif
@@ -2732,7 +2732,7 @@ inline void gcode_G28() {
2732 2732
         #endif // !Z_SAFE_HOMING
2733 2733
 
2734 2734
         #if ENABLED(DEBUG_LEVELING_FEATURE)
2735
-          if (marlin_debug_flags & DEBUG_LEVELING) {
2735
+          if (DEBUGGING(LEVELING)) {
2736 2736
             print_xyz("> (home_all_axis || homeZ) > final", current_position);
2737 2737
           }
2738 2738
         #endif
@@ -2751,7 +2751,7 @@ inline void gcode_G28() {
2751 2751
 
2752 2752
   #if ENABLED(ENDSTOPS_ONLY_FOR_HOMING)
2753 2753
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2754
-      if (marlin_debug_flags & DEBUG_LEVELING) {
2754
+      if (DEBUGGING(LEVELING)) {
2755 2755
         SERIAL_ECHOLNPGM("ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)");
2756 2756
       }
2757 2757
     #endif
@@ -2770,7 +2770,7 @@ inline void gcode_G28() {
2770 2770
       line_to_destination();
2771 2771
       st_synchronize();
2772 2772
       #if ENABLED(DEBUG_LEVELING_FEATURE)
2773
-        if (marlin_debug_flags & DEBUG_LEVELING) {
2773
+        if (DEBUGGING(LEVELING)) {
2774 2774
           print_xyz("mbl_was_active > current_position", current_position);
2775 2775
         }
2776 2776
       #endif
@@ -2783,7 +2783,7 @@ inline void gcode_G28() {
2783 2783
   endstops_hit_on_purpose(); // clear endstop hit flags
2784 2784
 
2785 2785
   #if ENABLED(DEBUG_LEVELING_FEATURE)
2786
-    if (marlin_debug_flags & DEBUG_LEVELING) {
2786
+    if (DEBUGGING(LEVELING)) {
2787 2787
       SERIAL_ECHOLNPGM("<<< gcode_G28");
2788 2788
     }
2789 2789
   #endif
@@ -2993,7 +2993,7 @@ inline void gcode_G28() {
2993 2993
   inline void gcode_G29() {
2994 2994
 
2995 2995
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2996
-      if (marlin_debug_flags & DEBUG_LEVELING) {
2996
+      if (DEBUGGING(LEVELING)) {
2997 2997
         SERIAL_ECHOLNPGM("gcode_G29 >>>");
2998 2998
       }
2999 2999
     #endif
@@ -3160,7 +3160,7 @@ inline void gcode_G28() {
3160 3160
 
3161 3161
           if (probePointCounter) {
3162 3162
             #if ENABLED(DEBUG_LEVELING_FEATURE)
3163
-              if (marlin_debug_flags & DEBUG_LEVELING) {
3163
+              if (DEBUGGING(LEVELING)) {
3164 3164
                 SERIAL_ECHOPAIR("z_before = (between) ", (float)(Z_RAISE_BETWEEN_PROBINGS + current_position[Z_AXIS]));
3165 3165
                 SERIAL_EOL;
3166 3166
               }
@@ -3168,7 +3168,7 @@ inline void gcode_G28() {
3168 3168
           }
3169 3169
           else {
3170 3170
             #if ENABLED(DEBUG_LEVELING_FEATURE)
3171
-              if (marlin_debug_flags & DEBUG_LEVELING) {
3171
+              if (DEBUGGING(LEVELING)) {
3172 3172
                 SERIAL_ECHOPAIR("z_before = (before) ", (float)Z_RAISE_BEFORE_PROBING);
3173 3173
                 SERIAL_EOL;
3174 3174
               }
@@ -3213,7 +3213,7 @@ inline void gcode_G28() {
3213 3213
       } //yProbe
3214 3214
 
3215 3215
       #if ENABLED(DEBUG_LEVELING_FEATURE)
3216
-        if (marlin_debug_flags & DEBUG_LEVELING) {
3216
+        if (DEBUGGING(LEVELING)) {
3217 3217
           print_xyz("> probing complete > current_position", current_position);
3218 3218
         }
3219 3219
       #endif
@@ -3319,7 +3319,7 @@ inline void gcode_G28() {
3319 3319
     #else // !AUTO_BED_LEVELING_GRID
3320 3320
 
3321 3321
       #if ENABLED(DEBUG_LEVELING_FEATURE)
3322
-        if (marlin_debug_flags & DEBUG_LEVELING) {
3322
+        if (DEBUGGING(LEVELING)) {
3323 3323
           SERIAL_ECHOLNPGM("> 3-point Leveling");
3324 3324
         }
3325 3325
       #endif
@@ -3363,7 +3363,7 @@ inline void gcode_G28() {
3363 3363
               real_z = st_get_axis_position_mm(Z_AXIS);  //get the real Z (since plan_get_position is now correcting the plane)
3364 3364
 
3365 3365
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3366
-          if (marlin_debug_flags & DEBUG_LEVELING) {
3366
+          if (DEBUGGING(LEVELING)) {
3367 3367
             SERIAL_ECHOPAIR("> BEFORE apply_rotation_xyz > z_tmp  = ", z_tmp);
3368 3368
             SERIAL_EOL;
3369 3369
             SERIAL_ECHOPAIR("> BEFORE apply_rotation_xyz > real_z = ", real_z);
@@ -3397,7 +3397,7 @@ inline void gcode_G28() {
3397 3397
          *   here, it could be seen as a compensating factor for the Z probe.
3398 3398
          */
3399 3399
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3400
-          if (marlin_debug_flags & DEBUG_LEVELING) {
3400
+          if (DEBUGGING(LEVELING)) {
3401 3401
             SERIAL_ECHOPAIR("> AFTER apply_rotation_xyz > z_tmp  = ", z_tmp);
3402 3402
             SERIAL_EOL;
3403 3403
           }
@@ -3412,7 +3412,7 @@ inline void gcode_G28() {
3412 3412
         sync_plan_position();
3413 3413
 
3414 3414
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3415
-          if (marlin_debug_flags & DEBUG_LEVELING) {
3415
+          if (DEBUGGING(LEVELING)) {
3416 3416
             print_xyz("> corrected Z in G29", current_position);
3417 3417
           }
3418 3418
         #endif
@@ -3432,7 +3432,7 @@ inline void gcode_G28() {
3432 3432
 
3433 3433
     #ifdef Z_PROBE_END_SCRIPT
3434 3434
       #if ENABLED(DEBUG_LEVELING_FEATURE)
3435
-        if (marlin_debug_flags & DEBUG_LEVELING) {
3435
+        if (DEBUGGING(LEVELING)) {
3436 3436
           SERIAL_ECHO("Z Probe End Script: ");
3437 3437
           SERIAL_ECHOLNPGM(Z_PROBE_END_SCRIPT);
3438 3438
         }
@@ -3447,7 +3447,7 @@ inline void gcode_G28() {
3447 3447
     KEEPALIVE_STATE(IN_HANDLER);
3448 3448
 
3449 3449
     #if ENABLED(DEBUG_LEVELING_FEATURE)
3450
-      if (marlin_debug_flags & DEBUG_LEVELING) {
3450
+      if (DEBUGGING(LEVELING)) {
3451 3451
         SERIAL_ECHOLNPGM("<<< gcode_G29");
3452 3452
       }
3453 3453
     #endif
@@ -4084,7 +4084,7 @@ inline void gcode_M42() {
4084 4084
  */
4085 4085
 inline void gcode_M104() {
4086 4086
   if (setTargetedHotend(104)) return;
4087
-  if (marlin_debug_flags & DEBUG_DRYRUN) return;
4087
+  if (DEBUGGING(DRYRUN)) return;
4088 4088
 
4089 4089
   if (code_seen('S')) {
4090 4090
     float temp = code_value();
@@ -4224,7 +4224,7 @@ inline void gcode_M109() {
4224 4224
   print_job_start();
4225 4225
 
4226 4226
   if (setTargetedHotend(109)) return;
4227
-  if (marlin_debug_flags & DEBUG_DRYRUN) return;
4227
+  if (DEBUGGING(DRYRUN)) return;
4228 4228
 
4229 4229
   no_wait_for_cooling = code_seen('S');
4230 4230
   if (no_wait_for_cooling || code_seen('R')) {
@@ -4308,7 +4308,7 @@ inline void gcode_M109() {
4308 4308
    *       Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling
4309 4309
    */
4310 4310
   inline void gcode_M190() {
4311
-    if (marlin_debug_flags & DEBUG_DRYRUN) return;
4311
+    if (DEBUGGING(DRYRUN)) return;
4312 4312
 
4313 4313
     LCD_MESSAGEPGM(MSG_BED_HEATING);
4314 4314
     bool no_wait_for_cooling = code_seen('S');
@@ -4416,7 +4416,7 @@ inline void gcode_M112() { kill(PSTR(MSG_KILLED)); }
4416 4416
  * M140: Set bed temperature
4417 4417
  */
4418 4418
 inline void gcode_M140() {
4419
-  if (marlin_debug_flags & DEBUG_DRYRUN) return;
4419
+  if (DEBUGGING(DRYRUN)) return;
4420 4420
   if (code_seen('S')) setTargetBed(code_value());
4421 4421
 }
4422 4422
 
@@ -4900,7 +4900,7 @@ inline void gcode_M206() {
4900 4900
    */
4901 4901
   inline void gcode_M666() {
4902 4902
     #if ENABLED(DEBUG_LEVELING_FEATURE)
4903
-      if (marlin_debug_flags & DEBUG_LEVELING) {
4903
+      if (DEBUGGING(LEVELING)) {
4904 4904
         SERIAL_ECHOLNPGM(">>> gcode_M666");
4905 4905
       }
4906 4906
     #endif
@@ -4908,7 +4908,7 @@ inline void gcode_M206() {
4908 4908
       if (code_seen(axis_codes[i])) {
4909 4909
         endstop_adj[i] = code_value();
4910 4910
         #if ENABLED(DEBUG_LEVELING_FEATURE)
4911
-          if (marlin_debug_flags & DEBUG_LEVELING) {
4911
+          if (DEBUGGING(LEVELING)) {
4912 4912
             SERIAL_ECHOPGM("endstop_adj[");
4913 4913
             SERIAL_ECHO(axis_codes[i]);
4914 4914
             SERIAL_ECHOPAIR("] = ", endstop_adj[i]);
@@ -4918,7 +4918,7 @@ inline void gcode_M206() {
4918 4918
       }
4919 4919
     }
4920 4920
     #if ENABLED(DEBUG_LEVELING_FEATURE)
4921
-      if (marlin_debug_flags & DEBUG_LEVELING) {
4921
+      if (DEBUGGING(LEVELING)) {
4922 4922
         SERIAL_ECHOLNPGM("<<< gcode_M666");
4923 4923
       }
4924 4924
     #endif
@@ -6081,7 +6081,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
6081 6081
 void process_next_command() {
6082 6082
   current_command = command_queue[cmd_queue_index_r];
6083 6083
 
6084
-  if ((marlin_debug_flags & DEBUG_ECHO)) {
6084
+  if (DEBUGGING(ECHO)) {
6085 6085
     SERIAL_ECHO_START;
6086 6086
     SERIAL_ECHOLN(current_command);
6087 6087
   }
@@ -6709,7 +6709,7 @@ void clamp_to_software_endstops(float target[3]) {
6709 6709
       if (zprobe_zoffset < 0) negative_z_offset += zprobe_zoffset;
6710 6710
       if (home_offset[Z_AXIS] < 0) {
6711 6711
         #if ENABLED(DEBUG_LEVELING_FEATURE)
6712
-          if (marlin_debug_flags & DEBUG_LEVELING) {
6712
+          if (DEBUGGING(LEVELING)) {
6713 6713
             SERIAL_ECHOPAIR("> clamp_to_software_endstops > Add home_offset[Z_AXIS]:", home_offset[Z_AXIS]);
6714 6714
             SERIAL_EOL;
6715 6715
           }
@@ -6889,7 +6889,7 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
6889 6889
 #if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
6890 6890
 
6891 6891
   inline void prevent_dangerous_extrude(float& curr_e, float& dest_e) {
6892
-    if (marlin_debug_flags & DEBUG_DRYRUN) return;
6892
+    if (DEBUGGING(DRYRUN)) return;
6893 6893
     float de = dest_e - curr_e;
6894 6894
     if (de) {
6895 6895
       if (degHotend(active_extruder) < extrude_min_temp) {

+ 1
- 1
Marlin/planner.cpp View File

@@ -591,7 +591,7 @@ float junction_deviation = 0.1;
591 591
        dz = target[Z_AXIS] - position[Z_AXIS];
592 592
 
593 593
   // DRYRUN ignores all temperature constraints and assures that the extruder is instantly satisfied
594
-  if (marlin_debug_flags & DEBUG_DRYRUN)
594
+  if (DEBUGGING(DRYRUN))
595 595
     position[E_AXIS] = target[E_AXIS];
596 596
 
597 597
   long de = target[E_AXIS] - position[E_AXIS];

Loading…
Cancel
Save