Browse Source

✅ Custom logging for MBL

Scott Lahteine 4 years ago
parent
commit
b6f720ca1a
2 changed files with 18 additions and 9 deletions
  1. 5
    9
      Marlin/src/gcode/bedlevel/abl/G29.cpp
  2. 13
    0
      Marlin/src/gcode/bedlevel/mbl/G29.cpp

+ 5
- 9
Marlin/src/gcode/bedlevel/abl/G29.cpp View File

217
  *     There's no extra effect if you have a fixed Z probe.
217
  *     There's no extra effect if you have a fixed Z probe.
218
  */
218
  */
219
 G29_TYPE GcodeSuite::G29() {
219
 G29_TYPE GcodeSuite::G29() {
220
+  DEBUG_SECTION(log_G29, "G29", DEBUGGING(LEVELING));
221
+
220
   TERN_(PROBE_MANUALLY, static) G29_State abl;
222
   TERN_(PROBE_MANUALLY, static) G29_State abl;
221
 
223
 
222
   TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE));
224
   TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE));
227
 
229
 
228
   // G29 Q is also available if debugging
230
   // G29 Q is also available if debugging
229
   #if ENABLED(DEBUG_LEVELING_FEATURE)
231
   #if ENABLED(DEBUG_LEVELING_FEATURE)
230
-    const uint8_t old_debug_flags = marlin_debug_flags;
231
-    if (seenQ) marlin_debug_flags |= MARLIN_DEBUG_LEVELING;
232
-    DEBUG_SECTION(log_G29, "G29", DEBUGGING(LEVELING));
233
-    if (DEBUGGING(LEVELING)) log_machine_info();
234
-    marlin_debug_flags = old_debug_flags;
232
+    if (seenQ || DEBUGGING(LEVELING)) log_machine_info();
235
     if (DISABLED(PROBE_MANUALLY) && seenQ) G29_RETURN(false);
233
     if (DISABLED(PROBE_MANUALLY) && seenQ) G29_RETURN(false);
236
   #endif
234
   #endif
237
 
235
 
472
     // Query G29 status
470
     // Query G29 status
473
     if (abl.verbose_level || seenQ) {
471
     if (abl.verbose_level || seenQ) {
474
       SERIAL_ECHOPGM("Manual G29 ");
472
       SERIAL_ECHOPGM("Manual G29 ");
475
-      if (g29_in_progress) {
476
-        SERIAL_ECHOPAIR("point ", _MIN(abl.abl_probe_index + 1, abl.abl_points));
477
-        SERIAL_ECHOLNPAIR(" of ", abl.abl_points);
478
-      }
473
+      if (g29_in_progress)
474
+        SERIAL_ECHOLNPAIR("point ", _MIN(abl.abl_probe_index + 1, abl.abl_points), " of ", abl.abl_points);
479
       else
475
       else
480
         SERIAL_ECHOLNPGM("idle");
476
         SERIAL_ECHOLNPGM("idle");
481
     }
477
     }

+ 13
- 0
Marlin/src/gcode/bedlevel/mbl/G29.cpp View File

42
   #include "../../../lcd/extui/ui_api.h"
42
   #include "../../../lcd/extui/ui_api.h"
43
 #endif
43
 #endif
44
 
44
 
45
+#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
46
+#include "../../../core/debug_out.h"
47
+
45
 // Save 130 bytes with non-duplication of PSTR
48
 // Save 130 bytes with non-duplication of PSTR
46
 inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_ECHOLNPGM(" not entered."); }
49
 inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_ECHOLNPGM(" not entered."); }
47
 
50
 
59
  *  S5              Reset and disable mesh
62
  *  S5              Reset and disable mesh
60
  */
63
  */
61
 void GcodeSuite::G29() {
64
 void GcodeSuite::G29() {
65
+  DEBUG_SECTION(log_G29, "G29", true);
66
+
67
+  // G29 Q is also available if debugging
68
+  #if ENABLED(DEBUG_LEVELING_FEATURE)
69
+    const bool seenQ = parser.seen_test('Q');
70
+    if (seenQ || DEBUGGING(LEVELING)) {
71
+      log_machine_info();
72
+      if (seenQ) return;
73
+    }
74
+  #endif
62
 
75
 
63
   TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE));
76
   TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE));
64
 
77
 

Loading…
Cancel
Save