Fix axis char printing
This commit is contained in:
parent
c8c83e9f52
commit
1bd35072cb
|
@ -144,6 +144,7 @@ void SERIAL_ECHO(T x) { SERIAL_IMPL.print(x); }
|
|||
typedef struct SerialChar { char c; SerialChar(char n) : c(n) { } } serial_char_t;
|
||||
inline void SERIAL_ECHO(serial_char_t x) { SERIAL_IMPL.write(x.c); }
|
||||
#define AS_CHAR(C) serial_char_t(C)
|
||||
#define AS_DIGIT(C) AS_CHAR('0' + (C))
|
||||
|
||||
// SERIAL_ECHO_F prints a floating point value with optional precision
|
||||
inline void SERIAL_ECHO_F(EnsureDouble x, int digit=2) { SERIAL_IMPL.print(x, digit); }
|
||||
|
|
|
@ -111,14 +111,14 @@ void FWRetract::retract(const bool retracting
|
|||
|
||||
/* // debugging
|
||||
SERIAL_ECHOLNPAIR(
|
||||
"retracting ", retracting,
|
||||
"retracting ", AS_DIGIT(retracting),
|
||||
" swapping ", swapping,
|
||||
" active extruder ", active_extruder
|
||||
);
|
||||
LOOP_L_N(i, EXTRUDERS) {
|
||||
SERIAL_ECHOLNPAIR("retracted[", i, "] ", retracted[i]);
|
||||
SERIAL_ECHOLNPAIR("retracted[", i, "] ", AS_DIGIT(retracted[i]));
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
SERIAL_ECHOLNPAIR("retracted_swap[", i, "] ", retracted_swap[i]);
|
||||
SERIAL_ECHOLNPAIR("retracted_swap[", i, "] ", AS_DIGIT(retracted_swap[i]));
|
||||
#endif
|
||||
}
|
||||
SERIAL_ECHOLNPAIR("current_position.z ", current_position.z);
|
||||
|
@ -185,13 +185,13 @@ void FWRetract::retract(const bool retracting
|
|||
#endif
|
||||
|
||||
/* // debugging
|
||||
SERIAL_ECHOLNPAIR("retracting ", retracting);
|
||||
SERIAL_ECHOLNPAIR("swapping ", swapping);
|
||||
SERIAL_ECHOLNPAIR("retracting ", AS_DIGIT(retracting));
|
||||
SERIAL_ECHOLNPAIR("swapping ", AS_DIGIT(swapping));
|
||||
SERIAL_ECHOLNPAIR("active_extruder ", active_extruder);
|
||||
LOOP_L_N(i, EXTRUDERS) {
|
||||
SERIAL_ECHOLNPAIR("retracted[", i, "] ", retracted[i]);
|
||||
SERIAL_ECHOLNPAIR("retracted[", i, "] ", AS_DIGIT(retracted[i]));
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
SERIAL_ECHOLNPAIR("retracted_swap[", i, "] ", retracted_swap[i]);
|
||||
SERIAL_ECHOLNPAIR("retracted_swap[", i, "] ", AS_DIGIT(retracted_swap[i]));
|
||||
#endif
|
||||
}
|
||||
SERIAL_ECHOLNPAIR("current_position.z ", current_position.z);
|
||||
|
@ -268,7 +268,7 @@ void FWRetract::M208_report(const bool forReplay/*=false*/) {
|
|||
|
||||
void FWRetract::M209_report(const bool forReplay/*=false*/) {
|
||||
if (!forReplay) { SERIAL_ECHO_MSG("; Auto-Retract: S=0 to disable, 1 to interpret E-only moves as retract/recover"); SERIAL_ECHO_START(); }
|
||||
SERIAL_ECHOLNPAIR(" M209 S", autoretract_enabled);
|
||||
SERIAL_ECHOLNPAIR(" M209 S", AS_DIGIT(autoretract_enabled));
|
||||
}
|
||||
|
||||
#endif // FWRETRACT_AUTORETRACT
|
||||
|
|
|
@ -612,7 +612,7 @@ void PrintJobRecovery::resume() {
|
|||
DEBUG_ECHOLNPAIR("sd_filename: ", info.sd_filename);
|
||||
DEBUG_ECHOLNPAIR("sdpos: ", info.sdpos);
|
||||
DEBUG_ECHOLNPAIR("print_job_elapsed: ", info.print_job_elapsed);
|
||||
DEBUG_ECHOLNPAIR("dryrun: ", info.flag.dryrun);
|
||||
DEBUG_ECHOLNPAIR("dryrun: ", AS_DIGIT(info.flag.dryrun));
|
||||
DEBUG_ECHOLNPAIR("allow_cold_extrusion: ", info.flag.allow_cold_extrusion);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
if (parser.seen(XYZ_CHAR(i))) {
|
||||
const float v = parser.value_linear_units();
|
||||
if (v * Z_HOME_DIR <= 0) delta_endstop_adj[i] = v;
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("delta_endstop_adj[", XYZ_CHAR(i), "] = ", delta_endstop_adj[i]);
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("delta_endstop_adj[", AS_CHAR(XYZ_CHAR(i)), "] = ", delta_endstop_adj[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@
|
|||
|
||||
HOTEND_LOOP() {
|
||||
DEBUG_ECHOPAIR_P(SP_T_STR, e);
|
||||
LOOP_XYZ(a) DEBUG_ECHOPAIR(" hotend_offset[", e, "].", XYZ_CHAR(a) | 0x20, "=", hotend_offset[e][a]);
|
||||
LOOP_XYZ(a) DEBUG_ECHOPAIR(" hotend_offset[", e, "].", AS_CHAR(XYZ_CHAR(a) | 0x20), "=", hotend_offset[e][a]);
|
||||
DEBUG_EOL();
|
||||
}
|
||||
DEBUG_EOL();
|
||||
|
|
|
@ -307,7 +307,7 @@ void GCodeParser::parse(char *p) {
|
|||
|
||||
#if ENABLED(DEBUG_GCODE_PARSER)
|
||||
if (debug) {
|
||||
SERIAL_ECHOPAIR("Got param ", param, " at index ", p - command_ptr - 1);
|
||||
SERIAL_ECHOPAIR("Got param ", AS_CHAR(param), " at index ", p - command_ptr - 1);
|
||||
if (has_val) SERIAL_ECHOPGM(" (has_val)");
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -639,7 +639,7 @@ namespace Anycubic {
|
|||
float newposition = atof(&panel_command[6]);
|
||||
|
||||
#if ACDEBUG(AC_ACTION)
|
||||
SERIAL_ECHOLNPAIR("Nudge ", panel_command[4], " axis ", newposition);
|
||||
SERIAL_ECHOLNPAIR("Nudge ", AS_CHAR(panel_command[4]), " axis ", newposition);
|
||||
#endif
|
||||
|
||||
switch (panel_command[4]) {
|
||||
|
|
|
@ -188,7 +188,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
|
||||
if (!movevalue) {
|
||||
// homing
|
||||
DEBUG_ECHOPAIR(" homing ", axiscode);
|
||||
DEBUG_ECHOPAIR(" homing ", AS_CHAR(axiscode));
|
||||
char buf[6] = "G28 X";
|
||||
buf[4] = axiscode;
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
|
@ -199,7 +199,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
}
|
||||
else {
|
||||
// movement
|
||||
DEBUG_ECHOPAIR(" move ", axiscode);
|
||||
DEBUG_ECHOPAIR(" move ", AS_CHAR(axiscode));
|
||||
bool old_relative_mode = relative_mode;
|
||||
if (!relative_mode) {
|
||||
//DEBUG_ECHOPGM(" G91");
|
||||
|
@ -235,7 +235,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
return;
|
||||
|
||||
cannotmove:
|
||||
DEBUG_ECHOLNPAIR(" cannot move ", axiscode);
|
||||
DEBUG_ECHOLNPAIR(" cannot move ", AS_CHAR(axiscode));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
|
||||
if (!movevalue) {
|
||||
// homing
|
||||
DEBUG_ECHOPAIR(" homing ", axiscode);
|
||||
DEBUG_ECHOPAIR(" homing ", AS_CHAR(axiscode));
|
||||
char buf[6] = "G28 X";
|
||||
buf[4] = axiscode;
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
|
@ -199,7 +199,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
}
|
||||
else {
|
||||
// movement
|
||||
DEBUG_ECHOPAIR(" move ", axiscode);
|
||||
DEBUG_ECHOPAIR(" move ", AS_CHAR(axiscode));
|
||||
bool old_relative_mode = relative_mode;
|
||||
if (!relative_mode) {
|
||||
//DEBUG_ECHOPGM(" G91");
|
||||
|
@ -235,7 +235,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
return;
|
||||
|
||||
cannotmove:
|
||||
DEBUG_ECHOLNPAIR(" cannot move ", axiscode);
|
||||
DEBUG_ECHOLNPAIR(" cannot move ", AS_CHAR(axiscode));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -835,7 +835,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
|
||||
if (!movevalue) {
|
||||
// homing
|
||||
DEBUG_ECHOPAIR(" homing ", axiscode);
|
||||
DEBUG_ECHOPAIR(" homing ", AS_CHAR(axiscode));
|
||||
// char buf[6] = "G28 X";
|
||||
// buf[4] = axiscode;
|
||||
|
||||
|
@ -850,14 +850,14 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
else if (movevalue == 5) {
|
||||
DEBUG_ECHOPAIR("send M84");
|
||||
char buf[6];
|
||||
snprintf_P(buf,6,PSTR("M84 %c"),axiscode);
|
||||
snprintf_P(buf,6,PSTR("M84 %c"), axiscode);
|
||||
queue.enqueue_one_now(buf);
|
||||
ForceCompleteUpdate();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// movement
|
||||
DEBUG_ECHOPAIR(" move ", axiscode);
|
||||
DEBUG_ECHOPAIR(" move ", AS_CHAR(axiscode));
|
||||
bool old_relative_mode = relative_mode;
|
||||
|
||||
if (!relative_mode) {
|
||||
|
@ -895,7 +895,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
return;
|
||||
|
||||
cannotmove:
|
||||
DEBUG_ECHOLNPAIR(" cannot move ", axiscode);
|
||||
DEBUG_ECHOLNPAIR(" cannot move ", AS_CHAR(axiscode));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
|
||||
if (!movevalue) {
|
||||
// homing
|
||||
DEBUG_ECHOPAIR(" homing ", axiscode);
|
||||
DEBUG_ECHOPAIR(" homing ", AS_CHAR(axiscode));
|
||||
char buf[6] = "G28 X";
|
||||
buf[4] = axiscode;
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
|
@ -199,7 +199,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
}
|
||||
else {
|
||||
// movement
|
||||
DEBUG_ECHOPAIR(" move ", axiscode);
|
||||
DEBUG_ECHOPAIR(" move ", AS_CHAR(axiscode));
|
||||
bool old_relative_mode = relative_mode;
|
||||
if (!relative_mode) {
|
||||
//DEBUG_ECHOPGM(" G91");
|
||||
|
@ -235,7 +235,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
return;
|
||||
|
||||
cannotmove:
|
||||
DEBUG_ECHOLNPAIR(" cannot move ", axiscode);
|
||||
DEBUG_ECHOLNPAIR(" cannot move ", AS_CHAR(axiscode));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -144,10 +144,10 @@ bool NextionTFT::ReadTFTCommand() {
|
|||
#if NEXDEBUG(N_SOME)
|
||||
uint8_t req = atoi(&nextion_command[1]);
|
||||
if (req > 7 && req != 20)
|
||||
DEBUG_ECHOLNPAIR( "> ", nextion_command[0],
|
||||
"\n> ", nextion_command[1],
|
||||
"\n> ", nextion_command[2],
|
||||
"\n> ", nextion_command[3],
|
||||
DEBUG_ECHOLNPAIR( "> ", AS_CHAR(nextion_command[0]),
|
||||
"\n> ", AS_CHAR(nextion_command[1]),
|
||||
"\n> ", AS_CHAR(nextion_command[2]),
|
||||
"\n> ", AS_CHAR(nextion_command[3]),
|
||||
"\nprinter_state:", printer_state);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -761,7 +761,7 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
|
|||
// For Cartesian / Core motion simply move to the current_position
|
||||
planner.buffer_line(current_position, fr_mm_s, axis == E_AXIS ? e_index : active_extruder);
|
||||
|
||||
//SERIAL_ECHOLNPAIR("Add planner.move with Axis ", axis, " at FR ", fr_mm_s);
|
||||
//SERIAL_ECHOLNPAIR("Add planner.move with Axis ", AS_CHAR(axis_codes[axis]), " at FR ", fr_mm_s);
|
||||
|
||||
axis = NO_AXIS;
|
||||
|
||||
|
@ -782,7 +782,7 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
|
|||
#endif
|
||||
start_time = millis() + (menu_scale < 0.99f ? 0UL : 250UL); // delay for bigger moves
|
||||
axis = move_axis;
|
||||
//SERIAL_ECHOLNPAIR("Post Move with Axis ", axis, " soon.");
|
||||
//SERIAL_ECHOLNPAIR("Post Move with Axis ", AS_CHAR(axis_codes[axis]), " soon.");
|
||||
}
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
|
|
|
@ -622,7 +622,7 @@ void restore_feedrate_and_scaling() {
|
|||
#endif
|
||||
|
||||
if (DEBUGGING(LEVELING))
|
||||
SERIAL_ECHOLNPAIR("Axis ", XYZ_CHAR(axis), " min:", soft_endstop.min[axis], " max:", soft_endstop.max[axis]);
|
||||
SERIAL_ECHOLNPAIR("Axis ", AS_CHAR(XYZ_CHAR(axis)), " min:", soft_endstop.min[axis], " max:", soft_endstop.max[axis]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1392,12 +1392,12 @@ void prepare_line_to_destination() {
|
|||
* "trusted" position).
|
||||
*/
|
||||
void set_axis_never_homed(const AxisEnum axis) {
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR(">>> set_axis_never_homed(", axis_codes[axis], ")");
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR(">>> set_axis_never_homed(", AS_CHAR(axis_codes[axis]), ")");
|
||||
|
||||
set_axis_untrusted(axis);
|
||||
set_axis_unhomed(axis);
|
||||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("<<< set_axis_never_homed(", axis_codes[axis], ")");
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("<<< set_axis_never_homed(", AS_CHAR(axis_codes[axis]), ")");
|
||||
|
||||
TERN_(I2C_POSITION_ENCODERS, I2CPEM.unhomed(axis));
|
||||
}
|
||||
|
@ -1458,7 +1458,7 @@ void prepare_line_to_destination() {
|
|||
if (ABS(phaseDelta) * planner.steps_to_mm[axis] / phasePerUStep < 0.05f)
|
||||
SERIAL_ECHOLNPAIR("Selected home phase ", home_phase[axis],
|
||||
" too close to endstop trigger phase ", phaseCurrent,
|
||||
". Pick a different phase for ", axis_codes[axis]);
|
||||
". Pick a different phase for ", AS_CHAR(axis_codes[axis]));
|
||||
|
||||
// Skip to next if target position is behind current. So it only moves away from endstop.
|
||||
if (phaseDelta < 0) phaseDelta += 1024;
|
||||
|
@ -1469,7 +1469,7 @@ void prepare_line_to_destination() {
|
|||
// Optional debug messages
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
DEBUG_ECHOLNPAIR(
|
||||
"Endstop ", axis_codes[axis], " hit at Phase:", phaseCurrent,
|
||||
"Endstop ", AS_CHAR(axis_codes[axis]), " hit at Phase:", phaseCurrent,
|
||||
" Delta:", phaseDelta, " Distance:", mmDelta
|
||||
);
|
||||
}
|
||||
|
@ -1507,7 +1507,7 @@ void prepare_line_to_destination() {
|
|||
if (!_CAN_HOME(X) && !_CAN_HOME(Y) && !_CAN_HOME(Z)) return;
|
||||
#endif
|
||||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR(">>> homeaxis(", axis_codes[axis], ")");
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR(">>> homeaxis(", AS_CHAR(axis_codes[axis]), ")");
|
||||
|
||||
const int axis_home_dir = TERN0(DUAL_X_CARRIAGE, axis == X_AXIS)
|
||||
? x_home_dir(active_extruder) : home_dir(axis);
|
||||
|
@ -1585,7 +1585,7 @@ void prepare_line_to_destination() {
|
|||
case Z_AXIS: es = Z_ENDSTOP; break;
|
||||
}
|
||||
if (TEST(endstops.state(), es)) {
|
||||
SERIAL_ECHO_MSG("Bad ", axis_codes[axis], " Endstop?");
|
||||
SERIAL_ECHO_MSG("Bad ", AS_CHAR(axis_codes[axis]), " Endstop?");
|
||||
kill(GET_TEXT(MSG_KILL_HOMING_FAILED));
|
||||
}
|
||||
#endif
|
||||
|
@ -1807,7 +1807,7 @@ void prepare_line_to_destination() {
|
|||
if (axis == Z_AXIS) fwretract.current_hop = 0.0;
|
||||
#endif
|
||||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("<<< homeaxis(", axis_codes[axis], ")");
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("<<< homeaxis(", AS_CHAR(axis_codes[axis]), ")");
|
||||
|
||||
} // homeaxis()
|
||||
|
||||
|
@ -1885,14 +1885,14 @@ void set_axis_is_at_home(const AxisEnum axis) {
|
|||
DEBUG_ECHOLNPAIR("> home_offset[", AS_CHAR(axis_codes[axis]), "] = ", home_offset[axis]);
|
||||
#endif
|
||||
DEBUG_POS("", current_position);
|
||||
DEBUG_ECHOLNPAIR("<<< set_axis_is_at_home(", axis_codes[axis], ")");
|
||||
DEBUG_ECHOLNPAIR("<<< set_axis_is_at_home(", AS_CHAR(axis_codes[axis]), ")");
|
||||
}
|
||||
}
|
||||
|
||||
#if HAS_WORKSPACE_OFFSET
|
||||
void update_workspace_offset(const AxisEnum axis) {
|
||||
workspace_offset[axis] = home_offset[axis] + position_shift[axis];
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Axis ", XYZ_CHAR(axis), " home_offset = ", home_offset[axis], " position_shift = ", position_shift[axis]);
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Axis ", AS_CHAR(XYZ_CHAR(axis)), " home_offset = ", home_offset[axis], " position_shift = ", position_shift[axis]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue