Browse Source

Move debugging to serial.*

Scott Lahteine 8 years ago
parent
commit
142d8aae56
5 changed files with 56 additions and 46 deletions
  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 View File

349
 
349
 
350
 bool Running = true;
350
 bool Running = true;
351
 
351
 
352
-uint8_t marlin_debug_flags = DEBUG_NONE;
353
-
354
 /**
352
 /**
355
  * Cartesian Current Position
353
  * Cartesian Current Position
356
  *   Used to track the logical position as moves are queued.
354
  *   Used to track the logical position as moves are queued.
732
 void report_current_position();
730
 void report_current_position();
733
 void report_current_position_detail();
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
  * sync_plan_position
734
  * sync_plan_position
762
  *
735
  *

+ 0
- 3
Marlin/src/Marlin.h View File

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

+ 0
- 16
Marlin/src/core/enum.h View File

69
   TEMPUNIT_F
69
   TEMPUNIT_F
70
 } TempUnit;
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
 enum EndstopEnum {
72
 enum EndstopEnum {
89
   X_MIN,
73
   X_MIN,
90
   Y_MIN,
74
   Y_MIN,

+ 26
- 0
Marlin/src/core/serial.cpp View File

22
 
22
 
23
 #include "serial.h"
23
 #include "serial.h"
24
 
24
 
25
+uint8_t marlin_debug_flags = DEBUG_NONE;
26
+
25
 const char errormagic[] PROGMEM = "Error:";
27
 const char errormagic[] PROGMEM = "Error:";
26
 const char echomagic[] PROGMEM = "echo:";
28
 const char echomagic[] PROGMEM = "echo:";
27
 
29
 
43
 void serial_echopair_P(const char* s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
45
 void serial_echopair_P(const char* s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
44
 
46
 
45
 void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) MYSERIAL.write(' '); }
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 View File

41
   #endif
41
   #endif
42
 #endif
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
 extern const char echomagic[] PROGMEM;
64
 extern const char echomagic[] PROGMEM;
45
 extern const char errormagic[] PROGMEM;
65
 extern const char errormagic[] PROGMEM;
46
 
66
 
100
 //
120
 //
101
 void serialprintPGM(const char* str);
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
 #endif // __SERIAL_H__
133
 #endif // __SERIAL_H__

Loading…
Cancel
Save