diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp
index b652b0ff38868a35276ad7bb9b707b26ee0d3d7b..ffe9cdc868e02ef8c25954993457bcdb2d781052 100644
--- a/Marlin/src/Marlin.cpp
+++ b/Marlin/src/Marlin.cpp
@@ -349,8 +349,6 @@
bool Running = true;
-uint8_t marlin_debug_flags = DEBUG_NONE;
-
/**
* Cartesian Current Position
* 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
void report_current_position();
void report_current_position_detail();
-#if ENABLED(DEBUG_LEVELING_FEATURE)
- void print_xyz(const char* prefix, const char* suffix, const float x, const float y, const float z) {
- serialprintPGM(prefix);
- SERIAL_CHAR('(');
- SERIAL_ECHO(x);
- SERIAL_ECHOPAIR(", ", y);
- SERIAL_ECHOPAIR(", ", z);
- SERIAL_CHAR(')');
- if (suffix) serialprintPGM(suffix); else SERIAL_EOL();
- }
-
- void print_xyz(const char* prefix, const char* suffix, const float xyz[]) {
- print_xyz(prefix, suffix, xyz[X_AXIS], xyz[Y_AXIS], xyz[Z_AXIS]);
- }
-
- #if HAS_ABL
- void print_xyz(const char* prefix, const char* suffix, const vector_3 &xyz) {
- print_xyz(prefix, suffix, xyz.x, xyz.y, xyz.z);
- }
- #endif
-
- #define DEBUG_POS(SUFFIX,VAR) do { \
- print_xyz(PSTR(" " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); }while(0)
-#endif
-
/**
* sync_plan_position
*
diff --git a/Marlin/src/Marlin.h b/Marlin/src/Marlin.h
index 4292ccddb4f311857d4f8d4f6523fd3c191cc96e..590450ea1b69bc57df353fe11957f623d4d101e7 100644
--- a/Marlin/src/Marlin.h
+++ b/Marlin/src/Marlin.h
@@ -184,9 +184,6 @@ void quickstop_stepper();
void handle_filament_runout();
#endif
-extern uint8_t marlin_debug_flags;
-#define DEBUGGING(F) (marlin_debug_flags & (DEBUG_## F))
-
extern bool Running;
inline bool IsRunning() { return Running; }
inline bool IsStopped() { return !Running; }
diff --git a/Marlin/src/core/enum.h b/Marlin/src/core/enum.h
index c02e597f8ba431cc76f28eb27e55662d596e06c5..9bee5db459a40e269fc8d030ffaeeb7a57d816ef 100644
--- a/Marlin/src/core/enum.h
+++ b/Marlin/src/core/enum.h
@@ -69,22 +69,6 @@ typedef enum {
TEMPUNIT_F
} TempUnit;
-/**
- * Debug flags
- * Not yet widely applied
- */
-enum DebugFlags {
- DEBUG_NONE = 0,
- DEBUG_ECHO = _BV(0), ///< Echo commands in order as they are processed
- DEBUG_INFO = _BV(1), ///< Print messages for code that has debug output
- DEBUG_ERRORS = _BV(2), ///< Not implemented
- DEBUG_DRYRUN = _BV(3), ///< Ignore temperature setting and E movement commands
- DEBUG_COMMUNICATION = _BV(4), ///< Not implemented
- DEBUG_LEVELING = _BV(5), ///< Print detailed output for homing and leveling
- DEBUG_MESH_ADJUST = _BV(6), ///< UBL bed leveling
- DEBUG_ALL = 0xFF
-};
-
enum EndstopEnum {
X_MIN,
Y_MIN,
diff --git a/Marlin/src/core/serial.cpp b/Marlin/src/core/serial.cpp
index 15528c4506613b83f49bc60b4d36fe509e0ab4fd..b46f398d71adb0f01be603104fa35d355e73e255 100644
--- a/Marlin/src/core/serial.cpp
+++ b/Marlin/src/core/serial.cpp
@@ -22,6 +22,8 @@
#include "serial.h"
+uint8_t marlin_debug_flags = DEBUG_NONE;
+
const char errormagic[] PROGMEM = "Error:";
const char echomagic[] PROGMEM = "echo:";
@@ -43,3 +45,27 @@ void serial_echopair_P(const char* s_P, double v) { serialprintPGM(s_P);
void serial_echopair_P(const char* s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) MYSERIAL.write(' '); }
+
+#if ENABLED(DEBUG_LEVELING_FEATURE)
+
+ void print_xyz(const char* prefix, const char* suffix, const float x, const float y, const float z) {
+ serialprintPGM(prefix);
+ SERIAL_CHAR('(');
+ SERIAL_ECHO(x);
+ SERIAL_ECHOPAIR(", ", y);
+ SERIAL_ECHOPAIR(", ", z);
+ SERIAL_CHAR(')');
+ if (suffix) serialprintPGM(suffix); else SERIAL_EOL();
+ }
+
+ void print_xyz(const char* prefix, const char* suffix, const float xyz[]) {
+ print_xyz(prefix, suffix, xyz[X_AXIS], xyz[Y_AXIS], xyz[Z_AXIS]);
+ }
+
+ #if HAS_ABL
+ void print_xyz(const char* prefix, const char* suffix, const vector_3 &xyz) {
+ print_xyz(prefix, suffix, xyz.x, xyz.y, xyz.z);
+ }
+ #endif
+
+#endif
diff --git a/Marlin/src/core/serial.h b/Marlin/src/core/serial.h
index e860c9c05ff05d244b93e4e258486ed3b0e651de..81c35a75e12af915f3c7e5022dfc9a2bb9b4d8ea 100644
--- a/Marlin/src/core/serial.h
+++ b/Marlin/src/core/serial.h
@@ -41,6 +41,26 @@
#endif
#endif
+#include "../libs/vector_3.h"
+
+/**
+ * Define debug bit-masks
+ */
+enum DebugFlags {
+ DEBUG_NONE = 0,
+ DEBUG_ECHO = _BV(0), ///< Echo commands in order as they are processed
+ DEBUG_INFO = _BV(1), ///< Print messages for code that has debug output
+ DEBUG_ERRORS = _BV(2), ///< Not implemented
+ DEBUG_DRYRUN = _BV(3), ///< Ignore temperature setting and E movement commands
+ DEBUG_COMMUNICATION = _BV(4), ///< Not implemented
+ DEBUG_LEVELING = _BV(5), ///< Print detailed output for homing and leveling
+ DEBUG_MESH_ADJUST = _BV(6), ///< UBL bed leveling
+ DEBUG_ALL = 0xFF
+};
+
+extern uint8_t marlin_debug_flags;
+#define DEBUGGING(F) (marlin_debug_flags & (DEBUG_## F))
+
extern const char echomagic[] PROGMEM;
extern const char errormagic[] PROGMEM;
@@ -100,4 +120,14 @@ void serial_spaces(uint8_t count);
//
void serialprintPGM(const char* str);
+#if ENABLED(DEBUG_LEVELING_FEATURE)
+ void print_xyz(const char* prefix, const char* suffix, const float x, const float y, const float z);
+ void print_xyz(const char* prefix, const char* suffix, const float xyz[]);
+ #if HAS_ABL
+ void print_xyz(const char* prefix, const char* suffix, const vector_3 &xyz);
+ #endif
+ #define DEBUG_POS(SUFFIX,VAR) do { \
+ print_xyz(PSTR(" " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); }while(0)
+#endif
+
#endif // __SERIAL_H__