Move debugging to serial.*
This commit is contained in:
parent
a1e2b5da70
commit
142d8aae56
5 changed files with 56 additions and 46 deletions
|
@ -349,8 +349,6 @@
|
||||||
|
|
||||||
bool Running = true;
|
bool Running = true;
|
||||||
|
|
||||||
uint8_t marlin_debug_flags = DEBUG_NONE;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cartesian Current Position
|
* Cartesian Current Position
|
||||||
* Used to track the logical position as moves are queued.
|
* 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();
|
||||||
void report_current_position_detail();
|
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
|
* sync_plan_position
|
||||||
*
|
*
|
||||||
|
|
|
@ -184,9 +184,6 @@ void quickstop_stepper();
|
||||||
void handle_filament_runout();
|
void handle_filament_runout();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern uint8_t marlin_debug_flags;
|
|
||||||
#define DEBUGGING(F) (marlin_debug_flags & (DEBUG_## F))
|
|
||||||
|
|
||||||
extern bool Running;
|
extern bool Running;
|
||||||
inline bool IsRunning() { return Running; }
|
inline bool IsRunning() { return Running; }
|
||||||
inline bool IsStopped() { return !Running; }
|
inline bool IsStopped() { return !Running; }
|
||||||
|
|
|
@ -69,22 +69,6 @@ typedef enum {
|
||||||
TEMPUNIT_F
|
TEMPUNIT_F
|
||||||
} TempUnit;
|
} 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 {
|
enum EndstopEnum {
|
||||||
X_MIN,
|
X_MIN,
|
||||||
Y_MIN,
|
Y_MIN,
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
|
|
||||||
|
uint8_t marlin_debug_flags = DEBUG_NONE;
|
||||||
|
|
||||||
const char errormagic[] PROGMEM = "Error:";
|
const char errormagic[] PROGMEM = "Error:";
|
||||||
const char echomagic[] PROGMEM = "echo:";
|
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_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(' '); }
|
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
|
||||||
|
|
|
@ -41,6 +41,26 @@
|
||||||
#endif
|
#endif
|
||||||
#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 echomagic[] PROGMEM;
|
||||||
extern const char errormagic[] PROGMEM;
|
extern const char errormagic[] PROGMEM;
|
||||||
|
|
||||||
|
@ -100,4 +120,14 @@ void serial_spaces(uint8_t count);
|
||||||
//
|
//
|
||||||
void serialprintPGM(const char* str);
|
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__
|
#endif // __SERIAL_H__
|
||||||
|
|
Reference in a new issue