Unify debugging output with debug_out.h (#13388)
This commit is contained in:
@ -36,6 +36,9 @@ L6470_Marlin L6470;
|
||||
#include "../../gcode/gcode.h"
|
||||
#include "../planner.h"
|
||||
|
||||
#define DEBUG_OUT ENABLED(L6470_CHITCHAT)
|
||||
#include "../../core/debug_out.h"
|
||||
|
||||
uint8_t L6470_Marlin::dir_commands[MAX_L6470]; // array to hold direction command for each driver
|
||||
|
||||
char L6470_Marlin::index_to_axis[MAX_L6470][3] = { "X ", "Y ", "Z ", "X2", "Y2", "Z2", "Z3", "E0", "E1", "E2", "E3", "E4", "E5" };
|
||||
@ -286,16 +289,16 @@ void L6470_Marlin::set_param(uint8_t axis, uint8_t param, uint32_t value) {
|
||||
}
|
||||
|
||||
inline void echo_min_max(const char a, const float &min, const float &max) {
|
||||
L6470_CHAR(' '); L6470_CHAR(a);
|
||||
L6470_ECHOPAIR(" min = ", min);
|
||||
L6470_ECHOLNPAIR(" max = ", max);
|
||||
DEBUG_CHAR(' '); DEBUG_CHAR(a);
|
||||
DEBUG_ECHOPAIR(" min = ", min);
|
||||
DEBUG_ECHOLNPAIR(" max = ", max);
|
||||
}
|
||||
inline void echo_oct_used(const float &oct, const bool stall) {
|
||||
L6470_ECHOPAIR("over_current_threshold used : ", oct);
|
||||
DEBUG_ECHOPAIR("over_current_threshold used : ", oct);
|
||||
serialprintPGM(stall ? PSTR(" (Stall") : PSTR(" (OCD"));
|
||||
L6470_ECHOLNPGM(" threshold)");
|
||||
DEBUG_ECHOLNPGM(" threshold)");
|
||||
}
|
||||
inline void err_out_of_bounds() { L6470_ECHOLNPGM("ERROR - motion out of bounds"); }
|
||||
inline void err_out_of_bounds() { DEBUG_ECHOLNPGM("ERROR - motion out of bounds"); }
|
||||
|
||||
bool L6470_Marlin::get_user_input(uint8_t &driver_count, uint8_t axis_index[3], char axis_mon[3][3],
|
||||
float &position_max, float &position_min, float &final_feedrate, uint8_t &kval_hold,
|
||||
@ -307,7 +310,7 @@ bool L6470_Marlin::get_user_input(uint8_t &driver_count, uint8_t axis_index[3],
|
||||
uint8_t j; // general purpose counter
|
||||
|
||||
if (!all_axes_homed()) {
|
||||
L6470_ECHOLNPGM("ERROR - home all before running this command");
|
||||
DEBUG_ECHOLNPGM("ERROR - home all before running this command");
|
||||
//return true;
|
||||
}
|
||||
|
||||
@ -424,12 +427,12 @@ bool L6470_Marlin::get_user_input(uint8_t &driver_count, uint8_t axis_index[3],
|
||||
}
|
||||
|
||||
if (driver_count == 0) {
|
||||
L6470_ECHOLNPGM("ERROR - not a L6470 axis");
|
||||
DEBUG_ECHOLNPGM("ERROR - not a L6470 axis");
|
||||
return true;
|
||||
}
|
||||
|
||||
L6470_ECHOPGM("Monitoring:");
|
||||
for (j = 0; j < driver_count; j++) L6470_ECHOPAIR(" ", axis_mon[j]);
|
||||
DEBUG_ECHOPGM("Monitoring:");
|
||||
for (j = 0; j < driver_count; j++) DEBUG_ECHOPAIR(" ", axis_mon[j]);
|
||||
L6470_EOL();
|
||||
|
||||
// now have a list of driver(s) to monitor
|
||||
@ -440,14 +443,14 @@ bool L6470_Marlin::get_user_input(uint8_t &driver_count, uint8_t axis_index[3],
|
||||
|
||||
kval_hold = parser.byteval('K');
|
||||
if (kval_hold) {
|
||||
L6470_ECHOLNPAIR("kval_hold = ", kval_hold);
|
||||
DEBUG_ECHOLNPAIR("kval_hold = ", kval_hold);
|
||||
for (j = 0; j < driver_count; j++)
|
||||
set_param(axis_index[j], L6470_KVAL_HOLD, kval_hold);
|
||||
}
|
||||
else {
|
||||
// only print the KVAL_HOLD from one of the drivers
|
||||
kval_hold = get_param(axis_index[0], L6470_KVAL_HOLD);
|
||||
L6470_ECHOLNPAIR("KVAL_HOLD = ", kval_hold);
|
||||
DEBUG_ECHOLNPAIR("KVAL_HOLD = ", kval_hold);
|
||||
}
|
||||
|
||||
//
|
||||
@ -474,7 +477,7 @@ bool L6470_Marlin::get_user_input(uint8_t &driver_count, uint8_t axis_index[3],
|
||||
OCD_TH_actual = (OCD_TH_val_local + 1) * 375;
|
||||
}
|
||||
|
||||
L6470_ECHOLNPAIR("over_current_threshold specified: ", over_current_threshold);
|
||||
DEBUG_ECHOLNPAIR("over_current_threshold specified: ", over_current_threshold);
|
||||
echo_oct_used(STALL_TH_actual, true);
|
||||
echo_oct_used(OCD_TH_actual, false);
|
||||
|
||||
@ -547,13 +550,13 @@ void L6470_Marlin::error_status_decode(const uint16_t status, const uint8_t axis
|
||||
char temp_buf[10];
|
||||
say_axis(axis);
|
||||
sprintf_P(temp_buf, PSTR(" %4x "), status);
|
||||
L6470_ECHO(temp_buf);
|
||||
DEBUG_ECHO(temp_buf);
|
||||
print_bin(status);
|
||||
L6470_ECHOPGM(" THERMAL: ");
|
||||
DEBUG_ECHOPGM(" THERMAL: ");
|
||||
serialprintPGM((status & STATUS_TH_SD) ? PSTR("SHUTDOWN") : (status & STATUS_TH_WRN) ? PSTR("WARNING ") : PSTR("OK "));
|
||||
L6470_ECHOPGM(" OVERCURRENT: ");
|
||||
DEBUG_ECHOPGM(" OVERCURRENT: ");
|
||||
echo_yes_no(status & STATUS_OCD);
|
||||
L6470_ECHOPGM(" STALL: ");
|
||||
DEBUG_ECHOPGM(" STALL: ");
|
||||
echo_yes_no(status & (STATUS_STEP_LOSS_A | STATUS_STEP_LOSS_B));
|
||||
L6470_EOL();
|
||||
#else
|
||||
@ -642,14 +645,14 @@ void L6470_Marlin::error_status_decode(const uint16_t status, const uint8_t axis
|
||||
if (driver_L6470_data[j].com_counter == 0) { // warn user when it first happens
|
||||
driver_L6470_data[j].com_counter++;
|
||||
append_stepper_err(p, stepper_index, PSTR(" - communications lost\n"));
|
||||
L6470_ECHO(temp_buf);
|
||||
DEBUG_ECHO(temp_buf);
|
||||
}
|
||||
else {
|
||||
driver_L6470_data[j].com_counter++;
|
||||
if (driver_L6470_data[j].com_counter > 240) { // remind of com problem about every 2 minutes
|
||||
driver_L6470_data[j].com_counter = 1;
|
||||
append_stepper_err(p, stepper_index, PSTR(" - still no communications\n"));
|
||||
L6470_ECHO(temp_buf);
|
||||
DEBUG_ECHO(temp_buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -657,7 +660,7 @@ void L6470_Marlin::error_status_decode(const uint16_t status, const uint8_t axis
|
||||
if (driver_L6470_data[j].com_counter) { // comms re-established
|
||||
driver_L6470_data[j].com_counter = 0;
|
||||
append_stepper_err(p, stepper_index, PSTR(" - communications re-established\n.. setting all drivers to default values\n"));
|
||||
L6470_ECHO(temp_buf);
|
||||
DEBUG_ECHO(temp_buf);
|
||||
init_to_defaults();
|
||||
}
|
||||
else {
|
||||
@ -718,7 +721,7 @@ void L6470_Marlin::error_status_decode(const uint16_t status, const uint8_t axis
|
||||
p += sprintf_P(p, PSTR("%c\n"), ' ');
|
||||
#endif
|
||||
|
||||
L6470_ECHOLN(temp_buf); // print the error message
|
||||
DEBUG_ECHOLN(temp_buf); // print the error message
|
||||
}
|
||||
else {
|
||||
driver_L6470_data[j].is_ot = false;
|
||||
|
@ -25,26 +25,6 @@
|
||||
|
||||
#include <L6470.h>
|
||||
|
||||
#if ENABLED(L6470_CHITCHAT)
|
||||
#define L6470_EOL() SERIAL_EOL()
|
||||
#define L6470_CHAR(C) SERIAL_CHAR(C)
|
||||
#define L6470_ECHO(V) SERIAL_ECHO(V)
|
||||
#define L6470_ECHOLN(V) SERIAL_ECHOLN(V)
|
||||
#define L6470_ECHOPGM(S) SERIAL_ECHOPGM(S)
|
||||
#define L6470_ECHOLNPGM(S) SERIAL_ECHOLNPGM(S)
|
||||
#define L6470_ECHOPAIR(S,V) SERIAL_ECHOPAIR(S,V)
|
||||
#define L6470_ECHOLNPAIR(S,V) SERIAL_ECHOLNPAIR(S,V)
|
||||
#else
|
||||
#define L6470_EOL() NOOP
|
||||
#define L6470_CHAR(C) NOOP
|
||||
#define L6470_ECHO(V) NOOP
|
||||
#define L6470_ECHOLN(V) NOOP
|
||||
#define L6470_ECHOPGM(S) NOOP
|
||||
#define L6470_ECHOLNPGM(S) NOOP
|
||||
#define L6470_ECHOPAIR(S,V) NOOP
|
||||
#define L6470_ECHOLNPAIR(S,V) NOOP
|
||||
#endif
|
||||
|
||||
#define L6470_GETPARAM(P,Q) stepper##Q.GetParam(P)
|
||||
|
||||
#define MAX_L6470 (7 + MAX_EXTRUDERS) // Maximum number of axes in Marlin
|
||||
|
Reference in New Issue
Block a user