Browse Source

Merge pull request #3278 from thinkyhead/rc_cleanup_m111_redo

Echo all debug levels in M111, default to DEBUG_NONE
Scott Lahteine 8 years ago
parent
commit
5f32184254
4 changed files with 110 additions and 93 deletions
  1. 2
    0
      Marlin/Marlin.h
  2. 99
    87
      Marlin/Marlin_main.cpp
  3. 8
    5
      Marlin/language.h
  4. 1
    1
      Marlin/planner.cpp

+ 2
- 0
Marlin/Marlin.h View File

229
  * Debug flags - not yet widely applied
229
  * Debug flags - not yet widely applied
230
  */
230
  */
231
 enum DebugFlags {
231
 enum DebugFlags {
232
+  DEBUG_NONE          = 0,
232
   DEBUG_ECHO          = _BV(0),
233
   DEBUG_ECHO          = _BV(0),
233
   DEBUG_INFO          = _BV(1),
234
   DEBUG_INFO          = _BV(1),
234
   DEBUG_ERRORS        = _BV(2),
235
   DEBUG_ERRORS        = _BV(2),
237
   DEBUG_LEVELING      = _BV(5)
238
   DEBUG_LEVELING      = _BV(5)
238
 };
239
 };
239
 extern uint8_t marlin_debug_flags;
240
 extern uint8_t marlin_debug_flags;
241
+#define DEBUGGING(F) (marlin_debug_flags & (DEBUG_## F))
240
 
242
 
241
 extern bool Running;
243
 extern bool Running;
242
 inline bool IsRunning() { return  Running; }
244
 inline bool IsRunning() { return  Running; }

+ 99
- 87
Marlin/Marlin_main.cpp View File

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

+ 8
- 5
Marlin/language.h View File

238
 #define MSG_T_MINTEMP                       "MINTEMP triggered"
238
 #define MSG_T_MINTEMP                       "MINTEMP triggered"
239
 
239
 
240
 // Debug
240
 // Debug
241
-#define MSG_DEBUG_ECHO                      "DEBUG ECHO ENABLED"
242
-#define MSG_DEBUG_INFO                      "DEBUG INFO ENABLED"
243
-#define MSG_DEBUG_ERRORS                    "DEBUG ERRORS ENABLED"
244
-#define MSG_DEBUG_DRYRUN                    "DEBUG DRYRUN ENABLED"
245
-#define MSG_DEBUG_LEVELING                  "DEBUG LEVELING ENABLED"
241
+#define MSG_DEBUG_PREFIX                    "DEBUG: "
242
+#define MSG_DEBUG_OFF                       "off"
243
+#define MSG_DEBUG_ECHO                      "ECHO"
244
+#define MSG_DEBUG_INFO                      "INFO"
245
+#define MSG_DEBUG_ERRORS                    "ERRORS"
246
+#define MSG_DEBUG_DRYRUN                    "DRYRUN"
247
+#define MSG_DEBUG_COMMUNICATION             "COMMUNICATION"
248
+#define MSG_DEBUG_LEVELING                  "LEVELING"
246
 
249
 
247
 // LCD Menu Messages
250
 // LCD Menu Messages
248
 
251
 

+ 1
- 1
Marlin/planner.cpp View File

587
        dz = target[Z_AXIS] - position[Z_AXIS];
587
        dz = target[Z_AXIS] - position[Z_AXIS];
588
 
588
 
589
   // DRYRUN ignores all temperature constraints and assures that the extruder is instantly satisfied
589
   // DRYRUN ignores all temperature constraints and assures that the extruder is instantly satisfied
590
-  if (marlin_debug_flags & DEBUG_DRYRUN)
590
+  if (DEBUGGING(DRYRUN))
591
     position[E_AXIS] = target[E_AXIS];
591
     position[E_AXIS] = target[E_AXIS];
592
 
592
 
593
   long de = target[E_AXIS] - position[E_AXIS];
593
   long de = target[E_AXIS] - position[E_AXIS];

Loading…
Cancel
Save