瀏覽代碼

Move debugging to serial.*

Scott Lahteine 7 年之前
父節點
當前提交
142d8aae56
共有 5 個文件被更改,包括 56 次插入46 次删除
  1. 0
    27
      Marlin/src/Marlin.cpp
  2. 0
    3
      Marlin/src/Marlin.h
  3. 0
    16
      Marlin/src/core/enum.h
  4. 26
    0
      Marlin/src/core/serial.cpp
  5. 30
    0
      Marlin/src/core/serial.h

+ 0
- 27
Marlin/src/Marlin.cpp 查看文件

@@ -349,8 +349,6 @@
349 349
 
350 350
 bool Running = true;
351 351
 
352
-uint8_t marlin_debug_flags = DEBUG_NONE;
353
-
354 352
 /**
355 353
  * Cartesian Current Position
356 354
  *   Used to track the logical position as moves are queued.
@@ -732,31 +730,6 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s=0.0, bool no_mo
732 730
 void report_current_position();
733 731
 void report_current_position_detail();
734 732
 
735
-#if ENABLED(DEBUG_LEVELING_FEATURE)
736
-  void print_xyz(const char* prefix, const char* suffix, const float x, const float y, const float z) {
737
-    serialprintPGM(prefix);
738
-    SERIAL_CHAR('(');
739
-    SERIAL_ECHO(x);
740
-    SERIAL_ECHOPAIR(", ", y);
741
-    SERIAL_ECHOPAIR(", ", z);
742
-    SERIAL_CHAR(')');
743
-    if (suffix) serialprintPGM(suffix); else SERIAL_EOL();
744
-  }
745
-
746
-  void print_xyz(const char* prefix, const char* suffix, const float xyz[]) {
747
-    print_xyz(prefix, suffix, xyz[X_AXIS], xyz[Y_AXIS], xyz[Z_AXIS]);
748
-  }
749
-
750
-  #if HAS_ABL
751
-    void print_xyz(const char* prefix, const char* suffix, const vector_3 &xyz) {
752
-      print_xyz(prefix, suffix, xyz.x, xyz.y, xyz.z);
753
-    }
754
-  #endif
755
-
756
-  #define DEBUG_POS(SUFFIX,VAR) do { \
757
-    print_xyz(PSTR("  " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); }while(0)
758
-#endif
759
-
760 733
 /**
761 734
  * sync_plan_position
762 735
  *

+ 0
- 3
Marlin/src/Marlin.h 查看文件

@@ -184,9 +184,6 @@ void quickstop_stepper();
184 184
   void handle_filament_runout();
185 185
 #endif
186 186
 
187
-extern uint8_t marlin_debug_flags;
188
-#define DEBUGGING(F) (marlin_debug_flags & (DEBUG_## F))
189
-
190 187
 extern bool Running;
191 188
 inline bool IsRunning() { return  Running; }
192 189
 inline bool IsStopped() { return !Running; }

+ 0
- 16
Marlin/src/core/enum.h 查看文件

@@ -69,22 +69,6 @@ typedef enum {
69 69
   TEMPUNIT_F
70 70
 } TempUnit;
71 71
 
72
-/**
73
- * Debug flags
74
- * Not yet widely applied
75
- */
76
-enum DebugFlags {
77
-  DEBUG_NONE          = 0,
78
-  DEBUG_ECHO          = _BV(0), ///< Echo commands in order as they are processed
79
-  DEBUG_INFO          = _BV(1), ///< Print messages for code that has debug output
80
-  DEBUG_ERRORS        = _BV(2), ///< Not implemented
81
-  DEBUG_DRYRUN        = _BV(3), ///< Ignore temperature setting and E movement commands
82
-  DEBUG_COMMUNICATION = _BV(4), ///< Not implemented
83
-  DEBUG_LEVELING      = _BV(5), ///< Print detailed output for homing and leveling
84
-  DEBUG_MESH_ADJUST   = _BV(6), ///< UBL bed leveling
85
-  DEBUG_ALL           = 0xFF
86
-};
87
-
88 72
 enum EndstopEnum {
89 73
   X_MIN,
90 74
   Y_MIN,

+ 26
- 0
Marlin/src/core/serial.cpp 查看文件

@@ -22,6 +22,8 @@
22 22
 
23 23
 #include "serial.h"
24 24
 
25
+uint8_t marlin_debug_flags = DEBUG_NONE;
26
+
25 27
 const char errormagic[] PROGMEM = "Error:";
26 28
 const char echomagic[] PROGMEM = "echo:";
27 29
 
@@ -43,3 +45,27 @@ void serial_echopair_P(const char* s_P, double v)        { serialprintPGM(s_P);
43 45
 void serial_echopair_P(const char* s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
44 46
 
45 47
 void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) MYSERIAL.write(' '); }
48
+
49
+#if ENABLED(DEBUG_LEVELING_FEATURE)
50
+
51
+  void print_xyz(const char* prefix, const char* suffix, const float x, const float y, const float z) {
52
+    serialprintPGM(prefix);
53
+    SERIAL_CHAR('(');
54
+    SERIAL_ECHO(x);
55
+    SERIAL_ECHOPAIR(", ", y);
56
+    SERIAL_ECHOPAIR(", ", z);
57
+    SERIAL_CHAR(')');
58
+    if (suffix) serialprintPGM(suffix); else SERIAL_EOL();
59
+  }
60
+
61
+  void print_xyz(const char* prefix, const char* suffix, const float xyz[]) {
62
+    print_xyz(prefix, suffix, xyz[X_AXIS], xyz[Y_AXIS], xyz[Z_AXIS]);
63
+  }
64
+
65
+  #if HAS_ABL
66
+    void print_xyz(const char* prefix, const char* suffix, const vector_3 &xyz) {
67
+      print_xyz(prefix, suffix, xyz.x, xyz.y, xyz.z);
68
+    }
69
+  #endif
70
+
71
+#endif

+ 30
- 0
Marlin/src/core/serial.h 查看文件

@@ -41,6 +41,26 @@
41 41
   #endif
42 42
 #endif
43 43
 
44
+#include "../libs/vector_3.h"
45
+
46
+/**
47
+ * Define debug bit-masks
48
+ */
49
+enum DebugFlags {
50
+  DEBUG_NONE          = 0,
51
+  DEBUG_ECHO          = _BV(0), ///< Echo commands in order as they are processed
52
+  DEBUG_INFO          = _BV(1), ///< Print messages for code that has debug output
53
+  DEBUG_ERRORS        = _BV(2), ///< Not implemented
54
+  DEBUG_DRYRUN        = _BV(3), ///< Ignore temperature setting and E movement commands
55
+  DEBUG_COMMUNICATION = _BV(4), ///< Not implemented
56
+  DEBUG_LEVELING      = _BV(5), ///< Print detailed output for homing and leveling
57
+  DEBUG_MESH_ADJUST   = _BV(6), ///< UBL bed leveling
58
+  DEBUG_ALL           = 0xFF
59
+};
60
+
61
+extern uint8_t marlin_debug_flags;
62
+#define DEBUGGING(F) (marlin_debug_flags & (DEBUG_## F))
63
+
44 64
 extern const char echomagic[] PROGMEM;
45 65
 extern const char errormagic[] PROGMEM;
46 66
 
@@ -100,4 +120,14 @@ void serial_spaces(uint8_t count);
100 120
 //
101 121
 void serialprintPGM(const char* str);
102 122
 
123
+#if ENABLED(DEBUG_LEVELING_FEATURE)
124
+  void print_xyz(const char* prefix, const char* suffix, const float x, const float y, const float z);
125
+  void print_xyz(const char* prefix, const char* suffix, const float xyz[]);
126
+  #if HAS_ABL
127
+    void print_xyz(const char* prefix, const char* suffix, const vector_3 &xyz);
128
+  #endif
129
+  #define DEBUG_POS(SUFFIX,VAR) do { \
130
+    print_xyz(PSTR("  " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); }while(0)
131
+#endif
132
+
103 133
 #endif // __SERIAL_H__

Loading…
取消
儲存