Merge pull request #4286 from thinkyhead/rc_debug_clean

Prefix and suffix in debug output
This commit is contained in:
Scott Lahteine 2016-07-12 20:49:15 -07:00 committed by GitHub
commit 4f77adddbe

View file

@ -573,22 +573,23 @@ void serial_echopair_P(const char* s_P, unsigned long v) { serialprintPGM(s_P);
static void report_current_position(); static void report_current_position();
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
void print_xyz(const char* suffix, const float x, const float y, const float z) { void print_xyz(const char* prefix, const char* suffix, const float x, const float y, const float z) {
serialprintPGM(prefix);
SERIAL_ECHOPAIR("(", x); SERIAL_ECHOPAIR("(", x);
SERIAL_ECHOPAIR(", ", y); SERIAL_ECHOPAIR(", ", y);
SERIAL_ECHOPAIR(", ", z); SERIAL_ECHOPAIR(", ", z);
SERIAL_ECHOLNPGM(") "); SERIAL_ECHOPGM(")");
SERIAL_ECHO(suffix); serialprintPGM(suffix);
} }
void print_xyz(const char* suffix, const float xyz[]) { void print_xyz(const char* prefix,const char* suffix, const float xyz[]) {
print_xyz(suffix, xyz[X_AXIS], xyz[Y_AXIS], xyz[Z_AXIS]); print_xyz(prefix, suffix, xyz[X_AXIS], xyz[Y_AXIS], xyz[Z_AXIS]);
} }
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_FEATURE)
void print_xyz(const char* suffix, const vector_3 &xyz) { void print_xyz(const char* prefix,const char* suffix, const vector_3 &xyz) {
print_xyz(suffix, xyz.x, xyz.y, xyz.z); print_xyz(prefix, suffix, xyz.x, xyz.y, xyz.z);
} }
#endif #endif
#define DEBUG_POS(PREFIX,VAR) do{ SERIAL_ECHOPGM(PREFIX); print_xyz(" > " STRINGIFY(VAR), VAR); }while(0) #define DEBUG_POS(SUFFIX,VAR) do{ print_xyz(PSTR(STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); }while(0)
#endif #endif
#if ENABLED(DELTA) || ENABLED(SCARA) #if ENABLED(DELTA) || ENABLED(SCARA)
@ -1540,6 +1541,7 @@ static void set_axis_is_at_home(AxisEnum axis) {
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPAIR("> home_offset[axis]==", home_offset[axis]); SERIAL_ECHOPAIR("> home_offset[axis]==", home_offset[axis]);
SERIAL_EOL;
DEBUG_POS("", current_position); DEBUG_POS("", current_position);
} }
#endif #endif
@ -1653,7 +1655,7 @@ static void clean_up_after_endstop_or_probe_move() {
float old_feedrate = feedrate; float old_feedrate = feedrate;
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) print_xyz("do_blocking_move_to", x, y, z); if (DEBUGGING(LEVELING)) print_xyz(PSTR("do_blocking_move_to"), "", x, y, z);
#endif #endif
#if ENABLED(DELTA) #if ENABLED(DELTA)