Преглед изворни кода

✅ Custom logging for MBL

Scott Lahteine пре 4 година
родитељ
комит
b6f720ca1a
2 измењених фајлова са 18 додато и 9 уклоњено
  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 Прегледај датотеку

@@ -217,6 +217,8 @@ public:
217 217
  *     There's no extra effect if you have a fixed Z probe.
218 218
  */
219 219
 G29_TYPE GcodeSuite::G29() {
220
+  DEBUG_SECTION(log_G29, "G29", DEBUGGING(LEVELING));
221
+
220 222
   TERN_(PROBE_MANUALLY, static) G29_State abl;
221 223
 
222 224
   TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE));
@@ -227,11 +229,7 @@ G29_TYPE GcodeSuite::G29() {
227 229
 
228 230
   // G29 Q is also available if debugging
229 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 233
     if (DISABLED(PROBE_MANUALLY) && seenQ) G29_RETURN(false);
236 234
   #endif
237 235
 
@@ -472,10 +470,8 @@ G29_TYPE GcodeSuite::G29() {
472 470
     // Query G29 status
473 471
     if (abl.verbose_level || seenQ) {
474 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 475
       else
480 476
         SERIAL_ECHOLNPGM("idle");
481 477
     }

+ 13
- 0
Marlin/src/gcode/bedlevel/mbl/G29.cpp Прегледај датотеку

@@ -42,6 +42,9 @@
42 42
   #include "../../../lcd/extui/ui_api.h"
43 43
 #endif
44 44
 
45
+#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
46
+#include "../../../core/debug_out.h"
47
+
45 48
 // Save 130 bytes with non-duplication of PSTR
46 49
 inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_ECHOLNPGM(" not entered."); }
47 50
 
@@ -59,6 +62,16 @@ inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_ECHOLNPGM("
59 62
  *  S5              Reset and disable mesh
60 63
  */
61 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 76
   TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE));
64 77
 

Loading…
Откажи
Сачувај