Browse Source

Echo all debug levels in M111, default to DEBUG_NONE

Redo of #3268 by @jbrazio
Scott Lahteine 8 years ago
parent
commit
4402760739
3 changed files with 40 additions and 24 deletions
  1. 1
    0
      Marlin/Marlin.h
  2. 31
    19
      Marlin/Marlin_main.cpp
  3. 8
    5
      Marlin/language.h

+ 1
- 0
Marlin/Marlin.h View File

@@ -229,6 +229,7 @@ void Stop();
229 229
  * Debug flags - not yet widely applied
230 230
  */
231 231
 enum DebugFlags {
232
+  DEBUG_NONE          = 0,
232 233
   DEBUG_ECHO          = _BV(0),
233 234
   DEBUG_INFO          = _BV(1),
234 235
   DEBUG_ERRORS        = _BV(2),

+ 31
- 19
Marlin/Marlin_main.cpp View File

@@ -250,7 +250,7 @@
250 250
 
251 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 255
 static float feedrate = 1500.0, saved_feedrate;
256 256
 float current_position[NUM_AXIS] = { 0.0 };
@@ -4346,27 +4346,39 @@ inline void gcode_M110() {
4346 4346
  * M111: Set the debug level
4347 4347
  */
4348 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 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 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
 /**

+ 8
- 5
Marlin/language.h View File

@@ -238,11 +238,14 @@
238 238
 #define MSG_T_MINTEMP                       "MINTEMP triggered"
239 239
 
240 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 250
 // LCD Menu Messages
248 251
 

Loading…
Cancel
Save