A single SERIAL_ECHO macro type (#12557)

This commit is contained in:
Scott Lahteine
2018-11-29 16:58:58 -06:00
committed by GitHub
parent 69d869c3d9
commit c986239837
86 changed files with 1016 additions and 1356 deletions

View File

@ -573,7 +573,7 @@ void GcodeSuite::G26() {
if (parser.seenval('B')) {
g26_bed_temp = parser.value_celsius();
if (g26_bed_temp && !WITHIN(g26_bed_temp, 40, 140)) {
SERIAL_PROTOCOLLNPGM("?Specified bed temperature not plausible (40-140C).");
SERIAL_ECHOLNPGM("?Specified bed temperature not plausible (40-140C).");
return;
}
}
@ -581,7 +581,7 @@ void GcodeSuite::G26() {
if (parser.seenval('L')) {
g26_layer_height = parser.value_linear_units();
if (!WITHIN(g26_layer_height, 0.0, 2.0)) {
SERIAL_PROTOCOLLNPGM("?Specified layer height not plausible.");
SERIAL_ECHOLNPGM("?Specified layer height not plausible.");
return;
}
}
@ -590,12 +590,12 @@ void GcodeSuite::G26() {
if (parser.has_value()) {
g26_retraction_multiplier = parser.value_float();
if (!WITHIN(g26_retraction_multiplier, 0.05, 15.0)) {
SERIAL_PROTOCOLLNPGM("?Specified Retraction Multiplier not plausible.");
SERIAL_ECHOLNPGM("?Specified Retraction Multiplier not plausible.");
return;
}
}
else {
SERIAL_PROTOCOLLNPGM("?Retraction Multiplier must be specified.");
SERIAL_ECHOLNPGM("?Retraction Multiplier must be specified.");
return;
}
}
@ -603,7 +603,7 @@ void GcodeSuite::G26() {
if (parser.seenval('S')) {
g26_nozzle = parser.value_float();
if (!WITHIN(g26_nozzle, 0.1, 1.0)) {
SERIAL_PROTOCOLLNPGM("?Specified nozzle size not plausible.");
SERIAL_ECHOLNPGM("?Specified nozzle size not plausible.");
return;
}
}
@ -613,7 +613,7 @@ void GcodeSuite::G26() {
#if HAS_LCD_MENU
g26_prime_flag = -1;
#else
SERIAL_PROTOCOLLNPGM("?Prime length must be specified when not using an LCD.");
SERIAL_ECHOLNPGM("?Prime length must be specified when not using an LCD.");
return;
#endif
}
@ -621,7 +621,7 @@ void GcodeSuite::G26() {
g26_prime_flag++;
g26_prime_length = parser.value_linear_units();
if (!WITHIN(g26_prime_length, 0.0, 25.0)) {
SERIAL_PROTOCOLLNPGM("?Specified prime length not plausible.");
SERIAL_ECHOLNPGM("?Specified prime length not plausible.");
return;
}
}
@ -630,7 +630,7 @@ void GcodeSuite::G26() {
if (parser.seenval('F')) {
g26_filament_diameter = parser.value_linear_units();
if (!WITHIN(g26_filament_diameter, 1.0, 4.0)) {
SERIAL_PROTOCOLLNPGM("?Specified filament size not plausible.");
SERIAL_ECHOLNPGM("?Specified filament size not plausible.");
return;
}
}
@ -643,7 +643,7 @@ void GcodeSuite::G26() {
if (parser.seenval('H')) {
g26_hotend_temp = parser.value_celsius();
if (!WITHIN(g26_hotend_temp, 165, 280)) {
SERIAL_PROTOCOLLNPGM("?Specified nozzle temperature not plausible.");
SERIAL_ECHOLNPGM("?Specified nozzle temperature not plausible.");
return;
}
}
@ -659,21 +659,21 @@ void GcodeSuite::G26() {
g26_repeats = parser.intval('R', GRID_MAX_POINTS + 1);
#else
if (!parser.seen('R')) {
SERIAL_PROTOCOLLNPGM("?(R)epeat must be specified when not using an LCD.");
SERIAL_ECHOLNPGM("?(R)epeat must be specified when not using an LCD.");
return;
}
else
g26_repeats = parser.has_value() ? parser.value_int() : GRID_MAX_POINTS + 1;
#endif
if (g26_repeats < 1) {
SERIAL_PROTOCOLLNPGM("?(R)epeat value not plausible; must be at least 1.");
SERIAL_ECHOLNPGM("?(R)epeat value not plausible; must be at least 1.");
return;
}
g26_x_pos = parser.seenval('X') ? RAW_X_POSITION(parser.value_linear_units()) : current_position[X_AXIS];
g26_y_pos = parser.seenval('Y') ? RAW_Y_POSITION(parser.value_linear_units()) : current_position[Y_AXIS];
if (!position_is_reachable(g26_x_pos, g26_y_pos)) {
SERIAL_PROTOCOLLNPGM("?Specified X,Y coordinate out of bounds.");
SERIAL_ECHOLNPGM("?Specified X,Y coordinate out of bounds.");
return;
}

View File

@ -95,13 +95,13 @@ void GcodeSuite::M420() {
const int16_t a = settings.calc_num_meshes();
if (!a) {
SERIAL_PROTOCOLLNPGM("?EEPROM storage not available.");
SERIAL_ECHOLNPGM("?EEPROM storage not available.");
return;
}
if (!WITHIN(storage_slot, 0, a - 1)) {
SERIAL_PROTOCOLLNPGM("?Invalid storage slot.");
SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1);
SERIAL_ECHOLNPGM("?Invalid storage slot.");
SERIAL_ECHOLNPAIR("?Use 0 to ", a - 1);
return;
}
@ -110,7 +110,7 @@ void GcodeSuite::M420() {
#else
SERIAL_PROTOCOLLNPGM("?EEPROM storage not available.");
SERIAL_ECHOLNPGM("?EEPROM storage not available.");
return;
#endif
@ -206,10 +206,8 @@ void GcodeSuite::M420() {
set_bed_leveling_enabled(to_enable);
// Error if leveling failed to enable or reenable
if (to_enable && !planner.leveling_active) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_M420_FAILED);
}
if (to_enable && !planner.leveling_active)
SERIAL_ERROR_MSG(MSG_ERR_M420_FAILED);
SERIAL_ECHO_START();
SERIAL_ECHOPGM("Bed Leveling ");

View File

@ -293,15 +293,13 @@ G29_TYPE GcodeSuite::G29() {
const bool seen_w = parser.seen('W');
if (seen_w) {
if (!leveling_is_valid()) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("No bilinear grid");
SERIAL_ERROR_MSG("No bilinear grid");
G29_RETURN(false);
}
const float rz = parser.seenval('Z') ? RAW_Z_POSITION(parser.value_linear_units()) : current_position[Z_AXIS];
if (!WITHIN(rz, -10, 10)) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("Bad Z value");
SERIAL_ERROR_MSG("Bad Z value");
G29_RETURN(false);
}
@ -343,7 +341,7 @@ G29_TYPE GcodeSuite::G29() {
verbose_level = parser.intval('V');
if (!WITHIN(verbose_level, 0, 4)) {
SERIAL_PROTOCOLLNPGM("?(V)erbose level is implausible (0-4).");
SERIAL_ECHOLNPGM("?(V)erbose level is implausible (0-4).");
G29_RETURN(false);
}
@ -364,11 +362,11 @@ G29_TYPE GcodeSuite::G29() {
if (parser.seenval('P')) abl_grid_points_x = abl_grid_points_y = parser.value_int();
if (!WITHIN(abl_grid_points_x, 2, GRID_MAX_POINTS_X)) {
SERIAL_PROTOCOLLNPGM("?Probe points (X) is implausible (2-" STRINGIFY(GRID_MAX_POINTS_X) ").");
SERIAL_ECHOLNPGM("?Probe points (X) is implausible (2-" STRINGIFY(GRID_MAX_POINTS_X) ").");
G29_RETURN(false);
}
if (!WITHIN(abl_grid_points_y, 2, GRID_MAX_POINTS_Y)) {
SERIAL_PROTOCOLLNPGM("?Probe points (Y) is implausible (2-" STRINGIFY(GRID_MAX_POINTS_Y) ").");
SERIAL_ECHOLNPGM("?Probe points (Y) is implausible (2-" STRINGIFY(GRID_MAX_POINTS_Y) ").");
G29_RETURN(false);
}
@ -410,7 +408,7 @@ G29_TYPE GcodeSuite::G29() {
|| !position_is_reachable_by_probe(right_probe_bed_position, back_probe_bed_position)
#endif
) {
SERIAL_PROTOCOLLNPGM("? (L,R,F,B) out of bounds.");
SERIAL_ECHOLNPGM("? (L,R,F,B) out of bounds.");
G29_RETURN(false);
}
@ -421,8 +419,8 @@ G29_TYPE GcodeSuite::G29() {
#endif // ABL_GRID
if (verbose_level > 0) {
SERIAL_PROTOCOLPGM("G29 Auto Bed Leveling");
if (dryrun) SERIAL_PROTOCOLPGM(" (DRYRUN)");
SERIAL_ECHOPGM("G29 Auto Bed Leveling");
if (dryrun) SERIAL_ECHOPGM(" (DRYRUN)");
SERIAL_EOL();
}
@ -491,7 +489,7 @@ G29_TYPE GcodeSuite::G29() {
// Abort current G29 procedure, go back to idle state
if (seenA && g29_in_progress) {
SERIAL_PROTOCOLLNPGM("Manual G29 aborted");
SERIAL_ECHOLNPGM("Manual G29 aborted");
#if HAS_SOFTWARE_ENDSTOPS
soft_endstops_enabled = enable_soft_endstops;
#endif
@ -504,13 +502,13 @@ G29_TYPE GcodeSuite::G29() {
// Query G29 status
if (verbose_level || seenQ) {
SERIAL_PROTOCOLPGM("Manual G29 ");
SERIAL_ECHOPGM("Manual G29 ");
if (g29_in_progress) {
SERIAL_PROTOCOLPAIR("point ", MIN(abl_probe_index + 1, abl_points));
SERIAL_PROTOCOLLNPAIR(" of ", abl_points);
SERIAL_ECHOPAIR("point ", MIN(abl_probe_index + 1, abl_points));
SERIAL_ECHOLNPAIR(" of ", abl_points);
}
else
SERIAL_PROTOCOLLNPGM("idle");
SERIAL_ECHOLNPGM("idle");
}
if (no_action) G29_RETURN(false);
@ -553,9 +551,9 @@ G29_TYPE GcodeSuite::G29() {
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {
SERIAL_PROTOCOLPAIR("Save X", xCount);
SERIAL_PROTOCOLPAIR(" Y", yCount);
SERIAL_PROTOCOLLNPAIR(" Z", measured_z + zoffset);
SERIAL_ECHOPAIR("Save X", xCount);
SERIAL_ECHOPAIR(" Y", yCount);
SERIAL_ECHOLNPAIR(" Z", measured_z + zoffset);
}
#endif
@ -609,7 +607,7 @@ G29_TYPE GcodeSuite::G29() {
// Leveling done! Fall through to G29 finishing code below
SERIAL_PROTOCOLLNPGM("Grid probing done.");
SERIAL_ECHOLNPGM("Grid probing done.");
// Re-enable software endstops, if needed
#if HAS_SOFTWARE_ENDSTOPS
@ -633,7 +631,7 @@ G29_TYPE GcodeSuite::G29() {
}
else {
SERIAL_PROTOCOLLNPGM("3-point probing done.");
SERIAL_ECHOLNPGM("3-point probing done.");
// Re-enable software endstops, if needed
#if HAS_SOFTWARE_ENDSTOPS
@ -829,18 +827,12 @@ G29_TYPE GcodeSuite::G29() {
mean /= abl_points;
if (verbose_level) {
SERIAL_PROTOCOLPGM("Eqn coefficients: a: ");
SERIAL_PROTOCOL_F(plane_equation_coefficients[0], 8);
SERIAL_PROTOCOLPGM(" b: ");
SERIAL_PROTOCOL_F(plane_equation_coefficients[1], 8);
SERIAL_PROTOCOLPGM(" d: ");
SERIAL_PROTOCOL_F(plane_equation_coefficients[2], 8);
SERIAL_ECHOPAIR_F("Eqn coefficients: a: ", plane_equation_coefficients[0], 8);
SERIAL_ECHOPAIR_F(" b: ", plane_equation_coefficients[1], 8);
SERIAL_ECHOPAIR_F(" d: ", plane_equation_coefficients[2], 8);
if (verbose_level > 2)
SERIAL_ECHOPAIR_F("\nMean of sampled points: ", mean, 8);
SERIAL_EOL();
if (verbose_level > 2) {
SERIAL_PROTOCOLPGM("Mean of sampled points: ");
SERIAL_PROTOCOL_F(mean, 8);
SERIAL_EOL();
}
}
// Create the matrix but don't correct the position yet
@ -852,7 +844,7 @@ G29_TYPE GcodeSuite::G29() {
// Show the Topography map if enabled
if (do_topography_map) {
SERIAL_PROTOCOLLNPGM("\nBed Height Topography:\n"
SERIAL_ECHOLNPGM("\nBed Height Topography:\n"
" +--- BACK --+\n"
" | |\n"
" L | (+) | R\n"
@ -879,17 +871,17 @@ G29_TYPE GcodeSuite::G29() {
NOMORE(min_diff, eqnBVector[ind] - z_tmp);
if (diff >= 0.0)
SERIAL_PROTOCOLPGM(" +"); // Include + for column alignment
SERIAL_ECHOPGM(" +"); // Include + for column alignment
else
SERIAL_PROTOCOLCHAR(' ');
SERIAL_PROTOCOL_F(diff, 5);
SERIAL_CHAR(' ');
SERIAL_ECHO_F(diff, 5);
} // xx
SERIAL_EOL();
} // yy
SERIAL_EOL();
if (verbose_level > 3) {
SERIAL_PROTOCOLLNPGM("\nCorrected Bed Height vs. Bed Topology:");
SERIAL_ECHOLNPGM("\nCorrected Bed Height vs. Bed Topology:");
for (int8_t yy = abl_grid_points_y - 1; yy >= 0; yy--) {
for (uint8_t xx = 0; xx < abl_grid_points_x; xx++) {
@ -902,11 +894,11 @@ G29_TYPE GcodeSuite::G29() {
float diff = eqnBVector[ind] - z_tmp - min_diff;
if (diff >= 0.0)
SERIAL_PROTOCOLPGM(" +");
SERIAL_ECHOPGM(" +");
// Include + for column alignment
else
SERIAL_PROTOCOLCHAR(' ');
SERIAL_PROTOCOL_F(diff, 5);
SERIAL_CHAR(' ');
SERIAL_ECHO_F(diff, 5);
} // xx
SERIAL_EOL();
} // yy

View File

@ -45,14 +45,10 @@ void GcodeSuite::M421() {
hasZ = parser.seen('Z'),
hasQ = !hasZ && parser.seen('Q');
if (!hasI || !hasJ || !(hasZ || hasQ)) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS);
}
else if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1)) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
}
if (!hasI || !hasJ || !(hasZ || hasQ))
SERIAL_ERROR_MSG(MSG_ERR_M421_PARAMETERS);
else if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1))
SERIAL_ERROR_MSG(MSG_ERR_MESH_XY);
else {
z_values[ix][iy] = parser.value_linear_units() + (hasQ ? z_values[ix][iy] : 0);
#if ENABLED(ABL_BILINEAR_SUBDIVISION)

View File

@ -39,7 +39,7 @@
#include "../../../module/stepper.h"
// Save 130 bytes with non-duplication of PSTR
inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_PROTOCOLLNPGM(" not entered."); }
inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_ECHOLNPGM(" not entered."); }
/**
* G29: Mesh-based Z probe, probes a grid and produces a
@ -64,7 +64,7 @@ void GcodeSuite::G29() {
MeshLevelingState state = (MeshLevelingState)parser.byteval('S', (int8_t)MeshReport);
if (!WITHIN(state, 0, 5)) {
SERIAL_PROTOCOLLNPGM("S out of range (0-5).");
SERIAL_ECHOLNPGM("S out of range (0-5).");
return;
}
@ -72,13 +72,13 @@ void GcodeSuite::G29() {
switch (state) {
case MeshReport:
SERIAL_PROTOCOLPGM("Mesh Bed Leveling ");
SERIAL_ECHOPGM("Mesh Bed Leveling ");
if (leveling_is_valid()) {
serialprintln_onoff(planner.leveling_active);
mbl.report_mesh();
}
else
SERIAL_PROTOCOLLNPGM("has no data.");
SERIAL_ECHOLNPGM("has no data.");
break;
case MeshStart:
@ -92,7 +92,7 @@ void GcodeSuite::G29() {
case MeshNext:
if (mbl_probe_index < 0) {
SERIAL_PROTOCOLLNPGM("Start mesh probing with \"G29 S1\" first.");
SERIAL_ECHOLNPGM("Start mesh probing with \"G29 S1\" first.");
return;
}
// For each G29 S2...
@ -130,7 +130,7 @@ void GcodeSuite::G29() {
// After recording the last point, activate home and activate
mbl_probe_index = -1;
SERIAL_PROTOCOLLNPGM("Mesh probing done.");
SERIAL_ECHOLNPGM("Mesh probing done.");
BUZZ(100, 659);
BUZZ(100, 698);
@ -154,8 +154,8 @@ void GcodeSuite::G29() {
if (parser.seenval('I')) {
ix = parser.value_int();
if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1)) {
SERIAL_PROTOCOLPAIR("I out of range (0-", int(GRID_MAX_POINTS_X - 1));
SERIAL_PROTOCOLLNPGM(")");
SERIAL_ECHOPAIR("I out of range (0-", int(GRID_MAX_POINTS_X - 1));
SERIAL_ECHOLNPGM(")");
return;
}
}
@ -165,8 +165,8 @@ void GcodeSuite::G29() {
if (parser.seenval('J')) {
iy = parser.value_int();
if (!WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1)) {
SERIAL_PROTOCOLPAIR("J out of range (0-", int(GRID_MAX_POINTS_Y - 1));
SERIAL_PROTOCOLLNPGM(")");
SERIAL_ECHOPAIR("J out of range (0-", int(GRID_MAX_POINTS_Y - 1));
SERIAL_ECHOLNPGM(")");
return;
}
}
@ -193,8 +193,8 @@ void GcodeSuite::G29() {
} // switch(state)
if (state == MeshNext) {
SERIAL_PROTOCOLPAIR("MBL G29 point ", MIN(mbl_probe_index, GRID_MAX_POINTS));
SERIAL_PROTOCOLLNPAIR(" of ", int(GRID_MAX_POINTS));
SERIAL_ECHOPAIR("MBL G29 point ", MIN(mbl_probe_index, GRID_MAX_POINTS));
SERIAL_ECHOLNPAIR(" of ", int(GRID_MAX_POINTS));
}
report_current_position();

View File

@ -48,14 +48,10 @@ void GcodeSuite::M421() {
const int8_t iy = hasJ ? parser.value_int() : hasY ? mbl.probe_index_y(RAW_Y_POSITION(parser.value_linear_units())) : -1;
const bool hasZ = parser.seen('Z'), hasQ = !hasZ && parser.seen('Q');
if (int(hasI && hasJ) + int(hasX && hasY) != 1 || !(hasZ || hasQ)) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS);
}
else if (ix < 0 || iy < 0) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
}
if (int(hasI && hasJ) + int(hasX && hasY) != 1 || !(hasZ || hasQ))
SERIAL_ERROR_MSG(MSG_ERR_M421_PARAMETERS);
else if (ix < 0 || iy < 0)
SERIAL_ERROR_MSG(MSG_ERR_MESH_XY);
else
mbl.set_z(ix, iy, parser.value_linear_units() + (hasQ ? mbl.z_values[ix][iy] : 0));
}

View File

@ -56,14 +56,10 @@ void GcodeSuite::M421() {
iy = location.y_index;
}
if (int(hasC) + int(hasI && hasJ) != 1 || !(hasZ || hasQ || hasN)) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS);
}
else if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1)) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
}
if (int(hasC) + int(hasI && hasJ) != 1 || !(hasZ || hasQ || hasN))
SERIAL_ERROR_MSG(MSG_ERR_M421_PARAMETERS);
else if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1))
SERIAL_ERROR_MSG(MSG_ERR_MESH_XY);
else
ubl.z_values[ix][iy] = hasN ? NAN : parser.value_linear_units() + (hasQ ? ubl.z_values[ix][iy] : 0);
}

View File

@ -33,7 +33,7 @@
void GcodeSuite::M49() {
g26_debug_flag ^= true;
SERIAL_PROTOCOLPGM("G26 Debug: ");
SERIAL_ECHOPGM("G26 Debug: ");
serialprintPGM(g26_debug_flag ? PSTR("On\n") : PSTR("Off\n"));
}

View File

@ -92,8 +92,7 @@
// Disallow Z homing if X or Y are unknown
if (!TEST(axis_known_position, X_AXIS) || !TEST(axis_known_position, Y_AXIS)) {
LCD_MESSAGEPGM(MSG_ERR_Z_HOMING);
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_ERR_Z_HOMING);
SERIAL_ECHO_MSG(MSG_ERR_Z_HOMING);
return;
}
@ -135,8 +134,7 @@
}
else {
LCD_MESSAGEPGM(MSG_ZPROBE_OUT);
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_ZPROBE_OUT);
SERIAL_ECHO_MSG(MSG_ZPROBE_OUT);
}
#if ENABLED(DEBUG_LEVELING_FEATURE)

View File

@ -109,28 +109,28 @@ void ac_cleanup(
}
void print_signed_float(PGM_P const prefix, const float &f) {
SERIAL_PROTOCOLPGM(" ");
SERIAL_ECHOPGM(" ");
serialprintPGM(prefix);
SERIAL_PROTOCOLCHAR(':');
SERIAL_CHAR(':');
if (f >= 0) SERIAL_CHAR('+');
SERIAL_PROTOCOL_F(f, 2);
SERIAL_ECHO_F(f, 2);
}
/**
* - Print the delta settings
*/
static void print_calibration_settings(const bool end_stops, const bool tower_angles) {
SERIAL_PROTOCOLPAIR(".Height:", delta_height);
SERIAL_ECHOPAIR(".Height:", delta_height);
if (end_stops) {
print_signed_float(PSTR("Ex"), delta_endstop_adj[A_AXIS]);
print_signed_float(PSTR("Ey"), delta_endstop_adj[B_AXIS]);
print_signed_float(PSTR("Ez"), delta_endstop_adj[C_AXIS]);
}
if (end_stops && tower_angles) {
SERIAL_PROTOCOLPAIR(" Radius:", delta_radius);
SERIAL_ECHOPAIR(" Radius:", delta_radius);
SERIAL_EOL();
SERIAL_CHAR('.');
SERIAL_PROTOCOL_SP(13);
SERIAL_ECHO_SP(13);
}
if (tower_angles) {
print_signed_float(PSTR("Tx"), delta_tower_angle_trim[A_AXIS]);
@ -138,11 +138,11 @@ static void print_calibration_settings(const bool end_stops, const bool tower_an
print_signed_float(PSTR("Tz"), delta_tower_angle_trim[C_AXIS]);
}
if ((!end_stops && tower_angles) || (end_stops && !tower_angles)) { // XOR
SERIAL_PROTOCOLPAIR(" Radius:", delta_radius);
SERIAL_ECHOPAIR(" Radius:", delta_radius);
}
#if HAS_BED_PROBE
if (!end_stops && !tower_angles) {
SERIAL_PROTOCOL_SP(30);
SERIAL_ECHO_SP(30);
print_signed_float(PSTR("Offset"), zprobe_zoffset);
}
#endif
@ -153,7 +153,7 @@ static void print_calibration_settings(const bool end_stops, const bool tower_an
* - Print the probe results
*/
static void print_calibration_results(const float z_pt[NPP + 1], const bool tower_points, const bool opposite_points) {
SERIAL_PROTOCOLPGM(". ");
SERIAL_ECHOPGM(". ");
print_signed_float(PSTR("c"), z_pt[CEN]);
if (tower_points) {
print_signed_float(PSTR(" x"), z_pt[__A]);
@ -163,7 +163,7 @@ static void print_calibration_results(const float z_pt[NPP + 1], const bool towe
if (tower_points && opposite_points) {
SERIAL_EOL();
SERIAL_CHAR('.');
SERIAL_PROTOCOL_SP(13);
SERIAL_ECHO_SP(13);
}
if (opposite_points) {
print_signed_float(PSTR("yz"), z_pt[_BC]);
@ -438,7 +438,7 @@ void GcodeSuite::G33() {
const int8_t probe_points = set_up ? 2 : parser.intval('P', DELTA_CALIBRATION_DEFAULT_POINTS);
if (!WITHIN(probe_points, -1, 10)) {
SERIAL_PROTOCOLLNPGM("?(P)oints is implausible (-1 - 10).");
SERIAL_ECHOLNPGM("?(P)oints is implausible (-1 - 10).");
return;
}
@ -446,19 +446,19 @@ void GcodeSuite::G33() {
const float calibration_precision = set_up ? Z_CLEARANCE_BETWEEN_PROBES / 5.0 : parser.floatval('C', 0.0);
if (calibration_precision < 0) {
SERIAL_PROTOCOLLNPGM("?(C)alibration precision is implausible (>=0).");
SERIAL_ECHOLNPGM("?(C)alibration precision is implausible (>=0).");
return;
}
const int8_t force_iterations = parser.intval('F', 0);
if (!WITHIN(force_iterations, 0, 30)) {
SERIAL_PROTOCOLLNPGM("?(F)orce iteration is implausible (0 - 30).");
SERIAL_ECHOLNPGM("?(F)orce iteration is implausible (0 - 30).");
return;
}
const int8_t verbose_level = parser.byteval('V', 1);
if (!WITHIN(verbose_level, 0, 3)) {
SERIAL_PROTOCOLLNPGM("?(V)erbose level is implausible (0 - 3).");
SERIAL_ECHOLNPGM("?(V)erbose level is implausible (0 - 3).");
return;
}
@ -503,14 +503,14 @@ void GcodeSuite::G33() {
delta_tower_angle_trim[C_AXIS]
};
SERIAL_PROTOCOLLNPGM("G33 Auto Calibrate");
SERIAL_ECHOLNPGM("G33 Auto Calibrate");
if (!_1p_calibration && !_0p_calibration) { // test if the outer radius is reachable
LOOP_CAL_RAD(axis) {
const float a = RADIANS(210 + (360 / NPP) * (axis - 1)),
r = delta_calibration_radius;
if (!position_is_reachable(cos(a) * r, sin(a) * r)) {
SERIAL_PROTOCOLLNPGM("?(M665 B)ed radius is implausible.");
SERIAL_ECHOLNPGM("?(M665 B)ed radius is implausible.");
return;
}
}
@ -519,8 +519,8 @@ void GcodeSuite::G33() {
// Report settings
PGM_P checkingac = PSTR("Checking... AC");
serialprintPGM(checkingac);
if (verbose_level == 0) SERIAL_PROTOCOLPGM(" (DRY-RUN)");
if (set_up) SERIAL_PROTOCOLPGM(" (SET-UP)");
if (verbose_level == 0) SERIAL_ECHOPGM(" (DRY-RUN)");
if (set_up) SERIAL_ECHOPGM(" (SET-UP)");
SERIAL_EOL();
ui.set_status_P(checkingac);
@ -540,7 +540,7 @@ void GcodeSuite::G33() {
// Probe the points
zero_std_dev_old = zero_std_dev;
if (!probe_calibration_points(z_at_pt, probe_points, towers_set, stow_after_each, set_up)) {
SERIAL_PROTOCOLLNPGM("Correct delta settings with M665 and M666");
SERIAL_ECHOLNPGM("Correct delta settings with M665 and M666");
return AC_CLEANUP();
}
zero_std_dev = std_dev_points(z_at_pt, _0p_calibration, _1p_calibration, _4p_calibration, _4p_opposite_points);
@ -665,16 +665,15 @@ void GcodeSuite::G33() {
if (verbose_level != 0) { // !dry run
if ((zero_std_dev >= test_precision && iterations > force_iterations) || zero_std_dev <= calibration_precision) { // end iterations
SERIAL_PROTOCOLPGM("Calibration OK");
SERIAL_PROTOCOL_SP(32);
SERIAL_ECHOPGM("Calibration OK");
SERIAL_ECHO_SP(32);
#if HAS_BED_PROBE
if (zero_std_dev >= test_precision && !_1p_calibration && !_0p_calibration)
SERIAL_PROTOCOLPGM("rolling back.");
SERIAL_ECHOPGM("rolling back.");
else
#endif
{
SERIAL_PROTOCOLPGM("std dev:");
SERIAL_PROTOCOL_F(zero_std_dev_min, 3);
SERIAL_ECHOPAIR_F("std dev:", zero_std_dev_min, 3);
}
SERIAL_EOL();
char mess[21];
@ -694,11 +693,9 @@ void GcodeSuite::G33() {
sprintf_P(mess, PSTR("Iteration : %02i"), (int)iterations);
else
strcpy_P(mess, PSTR("No convergence"));
SERIAL_PROTOCOL(mess);
SERIAL_PROTOCOL_SP(32);
SERIAL_PROTOCOLPGM("std dev:");
SERIAL_PROTOCOL_F(zero_std_dev, 3);
SERIAL_EOL();
SERIAL_ECHO(mess);
SERIAL_ECHO_SP(32);
SERIAL_ECHOLNPAIR_F("std dev:", zero_std_dev, 3);
ui.set_status(mess);
if (verbose_level > 1)
print_calibration_settings(_endstop_results, _angle_results);
@ -707,10 +704,8 @@ void GcodeSuite::G33() {
else { // dry run
PGM_P enddryrun = PSTR("End DRY-RUN");
serialprintPGM(enddryrun);
SERIAL_PROTOCOL_SP(35);
SERIAL_PROTOCOLPGM("std dev:");
SERIAL_PROTOCOL_F(zero_std_dev, 3);
SERIAL_EOL();
SERIAL_ECHO_SP(35);
SERIAL_ECHOLNPAIR_F("std dev:", zero_std_dev, 3);
char mess[21];
strcpy_P(mess, enddryrun);

View File

@ -263,19 +263,19 @@ void GcodeSuite::G34() {
void GcodeSuite::M422() {
const int8_t zstepper = parser.intval('S') - 1;
if (!WITHIN(zstepper, 0, Z_STEPPER_COUNT - 1)) {
SERIAL_PROTOCOLLNPGM("?(S) Z-Stepper index invalid.");
SERIAL_ECHOLNPGM("?(S) Z-Stepper index invalid.");
return;
}
const float x_pos = parser.floatval('X', z_auto_align_xpos[zstepper]);
if (!WITHIN(x_pos, X_MIN_POS, X_MAX_POS)) {
SERIAL_PROTOCOLLNPGM("?(X) out of bounds.");
SERIAL_ECHOLNPGM("?(X) out of bounds.");
return;
}
const float y_pos = parser.floatval('Y', z_auto_align_ypos[zstepper]);
if (!WITHIN(y_pos, Y_MIN_POS, Y_MAX_POS)) {
SERIAL_PROTOCOLLNPGM("?(Y) out of bounds.");
SERIAL_ECHOLNPGM("?(Y) out of bounds.");
return;
}

View File

@ -55,16 +55,16 @@ void GcodeSuite::M48() {
const int8_t verbose_level = parser.byteval('V', 1);
if (!WITHIN(verbose_level, 0, 4)) {
SERIAL_PROTOCOLLNPGM("?(V)erbose level is implausible (0-4).");
SERIAL_ECHOLNPGM("?(V)erbose level is implausible (0-4).");
return;
}
if (verbose_level > 0)
SERIAL_PROTOCOLLNPGM("M48 Z-Probe Repeatability Test");
SERIAL_ECHOLNPGM("M48 Z-Probe Repeatability Test");
const int8_t n_samples = parser.byteval('P', 10);
if (!WITHIN(n_samples, 4, 50)) {
SERIAL_PROTOCOLLNPGM("?Sample size not plausible (4-50).");
SERIAL_ECHOLNPGM("?Sample size not plausible (4-50).");
return;
}
@ -77,14 +77,14 @@ void GcodeSuite::M48() {
Y_probe_location = parser.linearval('Y', Y_current + Y_PROBE_OFFSET_FROM_EXTRUDER);
if (!position_is_reachable_by_probe(X_probe_location, Y_probe_location)) {
SERIAL_PROTOCOLLNPGM("? (X,Y) out of bounds.");
SERIAL_ECHOLNPGM("? (X,Y) out of bounds.");
return;
}
bool seen_L = parser.seen('L');
uint8_t n_legs = seen_L ? parser.value_byte() : 0;
if (n_legs > 15) {
SERIAL_PROTOCOLLNPGM("?Number of legs in movement not plausible (0-15).");
SERIAL_ECHOLNPGM("?Number of legs in movement not plausible (0-15).");
return;
}
if (n_legs == 1) n_legs = 2;
@ -98,7 +98,7 @@ void GcodeSuite::M48() {
* we don't want to use that as a starting point for each probe.
*/
if (verbose_level > 2)
SERIAL_PROTOCOLLNPGM("Positioning the probe...");
SERIAL_ECHOLNPGM("Positioning the probe...");
// Disable bed level correction in M48 because we want the raw data when we probe
@ -178,7 +178,7 @@ void GcodeSuite::M48() {
}
#endif
if (verbose_level > 3) {
SERIAL_PROTOCOLPGM("Going to:");
SERIAL_ECHOPGM("Going to:");
SERIAL_ECHOPAIR(" X", X_current);
SERIAL_ECHOPAIR(" Y", Y_current);
SERIAL_ECHOLNPAIR(" Z", current_position[Z_AXIS]);
@ -215,22 +215,15 @@ void GcodeSuite::M48() {
sigma = SQRT(sum / (n + 1));
if (verbose_level > 0) {
if (verbose_level > 1) {
SERIAL_PROTOCOL(n + 1);
SERIAL_PROTOCOLPGM(" of ");
SERIAL_PROTOCOL((int)n_samples);
SERIAL_PROTOCOLPGM(": z: ");
SERIAL_PROTOCOL_F(sample_set[n], 3);
SERIAL_ECHO(n + 1);
SERIAL_ECHOPAIR(" of ", (int)n_samples);
SERIAL_ECHOPAIR_F(": z: ", sample_set[n], 3);
if (verbose_level > 2) {
SERIAL_PROTOCOLPGM(" mean: ");
SERIAL_PROTOCOL_F(mean, 4);
SERIAL_PROTOCOLPGM(" sigma: ");
SERIAL_PROTOCOL_F(sigma, 6);
SERIAL_PROTOCOLPGM(" min: ");
SERIAL_PROTOCOL_F(min, 3);
SERIAL_PROTOCOLPGM(" max: ");
SERIAL_PROTOCOL_F(max, 3);
SERIAL_PROTOCOLPGM(" range: ");
SERIAL_PROTOCOL_F(max-min, 3);
SERIAL_ECHOPAIR_F(" mean: ", mean, 4);
SERIAL_ECHOPAIR_F(" sigma: ", sigma, 6);
SERIAL_ECHOPAIR_F(" min: ", min, 3);
SERIAL_ECHOPAIR_F(" max: ", max, 3);
SERIAL_ECHOPAIR_F(" range: ", max-min, 3);
}
SERIAL_EOL();
}
@ -242,23 +235,16 @@ void GcodeSuite::M48() {
STOW_PROBE();
if (probing_good) {
SERIAL_PROTOCOLLNPGM("Finished!");
SERIAL_ECHOLNPGM("Finished!");
if (verbose_level > 0) {
SERIAL_PROTOCOLPGM("Mean: ");
SERIAL_PROTOCOL_F(mean, 6);
SERIAL_PROTOCOLPGM(" Min: ");
SERIAL_PROTOCOL_F(min, 3);
SERIAL_PROTOCOLPGM(" Max: ");
SERIAL_PROTOCOL_F(max, 3);
SERIAL_PROTOCOLPGM(" Range: ");
SERIAL_PROTOCOL_F(max-min, 3);
SERIAL_EOL();
SERIAL_ECHOPAIR_F("Mean: ", mean, 6);
SERIAL_ECHOPAIR_F(" Min: ", min, 3);
SERIAL_ECHOPAIR_F(" Max: ", max, 3);
SERIAL_ECHOLNPAIR_F(" Range: ", max-min, 3);
}
SERIAL_PROTOCOLPGM("Standard Deviation: ");
SERIAL_PROTOCOL_F(sigma, 6);
SERIAL_EOL();
SERIAL_ECHOLNPAIR_F("Standard Deviation: ", sigma, 6);
SERIAL_EOL();
}

View File

@ -84,8 +84,7 @@
if (sumAPX == 1)
scara_home_offset[A_AXIS] = parser.value_float();
else {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("Only one of A, P, or X is allowed.");
SERIAL_ERROR_MSG("Only one of A, P, or X is allowed.");
return;
}
}
@ -96,8 +95,7 @@
if (sumBTY == 1)
scara_home_offset[B_AXIS] = parser.value_float();
else {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("Only one of B, T, or Y is allowed.");
SERIAL_ERROR_MSG("Only one of B, T, or Y is allowed.");
return;
}
}

View File

@ -93,9 +93,7 @@ void GcodeSuite::M852() {
if (!ijk) {
SERIAL_ECHO_START();
SERIAL_ECHOPGM(MSG_SKEW_FACTOR " XY: ");
SERIAL_ECHO_F(planner.skew_factor.xy, 6);
SERIAL_EOL();
SERIAL_ECHOLNPAIR_F(MSG_SKEW_FACTOR " XY: ", planner.skew_factor.xy, 6);
#if ENABLED(SKEW_CORRECTION_FOR_Z)
SERIAL_ECHOPAIR(" XZ: ", planner.skew_factor.xz);
SERIAL_ECHOLNPAIR(" YZ: ", planner.skew_factor.yz);

View File

@ -147,10 +147,8 @@ void GcodeSuite::M205() {
planner.recalculate_max_e_jerk();
#endif
}
else {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("?J out of range (0.01 to 0.3)");
}
else
SERIAL_ERROR_MSG("?J out of range (0.01 to 0.3)");
}
#endif
#if HAS_CLASSIC_JERK

View File

@ -70,10 +70,8 @@ void GcodeSuite::M301() {
#endif
SERIAL_EOL();
}
else {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_INVALID_EXTRUDER);
}
else
SERIAL_ERROR_MSG(MSG_INVALID_EXTRUDER);
}
#endif // PIDTEMP

View File

@ -89,22 +89,20 @@ inline void toggle_pins() {
inline void servo_probe_test() {
#if !(NUM_SERVOS > 0 && HAS_SERVO_0)
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("SERVO not setup");
SERIAL_ERROR_MSG("SERVO not setup");
#elif !HAS_Z_SERVO_PROBE
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("Z_PROBE_SERVO_NR not setup");
SERIAL_ERROR_MSG("Z_PROBE_SERVO_NR not setup");
#else // HAS_Z_SERVO_PROBE
const uint8_t probe_index = parser.byteval('P', Z_PROBE_SERVO_NR);
SERIAL_PROTOCOLLNPGM("Servo probe test");
SERIAL_PROTOCOLLNPAIR(". using index: ", probe_index);
SERIAL_PROTOCOLLNPAIR(". deploy angle: ", servo_angles[probe_index][0]);
SERIAL_PROTOCOLLNPAIR(". stow angle: ", servo_angles[probe_index][1]);
SERIAL_ECHOLNPGM("Servo probe test");
SERIAL_ECHOLNPAIR(". using index: ", probe_index);
SERIAL_ECHOLNPAIR(". deploy angle: ", servo_angles[probe_index][0]);
SERIAL_ECHOLNPAIR(". stow angle: ", servo_angles[probe_index][1]);
bool probe_inverting;
@ -112,14 +110,14 @@ inline void servo_probe_test() {
#define PROBE_TEST_PIN Z_MIN_PIN
SERIAL_PROTOCOLLNPAIR(". probe uses Z_MIN pin: ", PROBE_TEST_PIN);
SERIAL_PROTOCOLLNPGM(". uses Z_MIN_ENDSTOP_INVERTING (ignores Z_MIN_PROBE_ENDSTOP_INVERTING)");
SERIAL_PROTOCOLPGM(". Z_MIN_ENDSTOP_INVERTING: ");
SERIAL_ECHOLNPAIR(". probe uses Z_MIN pin: ", PROBE_TEST_PIN);
SERIAL_ECHOLNPGM(". uses Z_MIN_ENDSTOP_INVERTING (ignores Z_MIN_PROBE_ENDSTOP_INVERTING)");
SERIAL_ECHOPGM(". Z_MIN_ENDSTOP_INVERTING: ");
#if Z_MIN_ENDSTOP_INVERTING
SERIAL_PROTOCOLLNPGM("true");
SERIAL_ECHOLNPGM("true");
#else
SERIAL_PROTOCOLLNPGM("false");
SERIAL_ECHOLNPGM("false");
#endif
probe_inverting = Z_MIN_ENDSTOP_INVERTING;
@ -127,21 +125,21 @@ inline void servo_probe_test() {
#elif ENABLED(Z_MIN_PROBE_ENDSTOP)
#define PROBE_TEST_PIN Z_MIN_PROBE_PIN
SERIAL_PROTOCOLLNPAIR(". probe uses Z_MIN_PROBE_PIN: ", PROBE_TEST_PIN);
SERIAL_PROTOCOLLNPGM(". uses Z_MIN_PROBE_ENDSTOP_INVERTING (ignores Z_MIN_ENDSTOP_INVERTING)");
SERIAL_PROTOCOLPGM(". Z_MIN_PROBE_ENDSTOP_INVERTING: ");
SERIAL_ECHOLNPAIR(". probe uses Z_MIN_PROBE_PIN: ", PROBE_TEST_PIN);
SERIAL_ECHOLNPGM(". uses Z_MIN_PROBE_ENDSTOP_INVERTING (ignores Z_MIN_ENDSTOP_INVERTING)");
SERIAL_ECHOPGM(". Z_MIN_PROBE_ENDSTOP_INVERTING: ");
#if Z_MIN_PROBE_ENDSTOP_INVERTING
SERIAL_PROTOCOLLNPGM("true");
SERIAL_ECHOLNPGM("true");
#else
SERIAL_PROTOCOLLNPGM("false");
SERIAL_ECHOLNPGM("false");
#endif
probe_inverting = Z_MIN_PROBE_ENDSTOP_INVERTING;
#endif
SERIAL_PROTOCOLLNPGM(". deploy & stow 4 times");
SERIAL_ECHOLNPGM(". deploy & stow 4 times");
SET_INPUT_PULLUP(PROBE_TEST_PIN);
uint8_t i = 0;
bool deploy_state, stow_state;
@ -153,26 +151,26 @@ inline void servo_probe_test() {
safe_delay(500);
stow_state = READ(PROBE_TEST_PIN);
} while (++i < 4);
if (probe_inverting != deploy_state) SERIAL_PROTOCOLLNPGM("WARNING - INVERTING setting probably backwards");
if (probe_inverting != deploy_state) SERIAL_ECHOLNPGM("WARNING - INVERTING setting probably backwards");
if (deploy_state != stow_state) {
SERIAL_PROTOCOLLNPGM("BLTouch clone detected");
SERIAL_ECHOLNPGM("BLTouch clone detected");
if (deploy_state) {
SERIAL_PROTOCOLLNPGM(". DEPLOYED state: HIGH (logic 1)");
SERIAL_PROTOCOLLNPGM(". STOWED (triggered) state: LOW (logic 0)");
SERIAL_ECHOLNPGM(". DEPLOYED state: HIGH (logic 1)");
SERIAL_ECHOLNPGM(". STOWED (triggered) state: LOW (logic 0)");
}
else {
SERIAL_PROTOCOLLNPGM(". DEPLOYED state: LOW (logic 0)");
SERIAL_PROTOCOLLNPGM(". STOWED (triggered) state: HIGH (logic 1)");
SERIAL_ECHOLNPGM(". DEPLOYED state: LOW (logic 0)");
SERIAL_ECHOLNPGM(". STOWED (triggered) state: HIGH (logic 1)");
}
#if ENABLED(BLTOUCH)
SERIAL_PROTOCOLLNPGM("ERROR: BLTOUCH enabled - set this device up as a Z Servo Probe with inverting as true.");
SERIAL_ECHOLNPGM("ERROR: BLTOUCH enabled - set this device up as a Z Servo Probe with inverting as true.");
#endif
}
else { // measure active signal length
MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][0]); // Deploy
safe_delay(500);
SERIAL_PROTOCOLLNPGM("please trigger probe");
SERIAL_ECHOLNPGM("please trigger probe");
uint16_t probe_counter = 0;
// Allow 30 seconds max for operator to trigger probe
@ -188,11 +186,11 @@ inline void servo_probe_test() {
safe_delay(2);
if (probe_counter == 50)
SERIAL_PROTOCOLLNPGM("Z Servo Probe detected"); // >= 100mS active time
SERIAL_ECHOLNPGM("Z Servo Probe detected"); // >= 100mS active time
else if (probe_counter >= 2)
SERIAL_PROTOCOLLNPAIR("BLTouch compatible probe detected - pulse width (+/- 4mS): ", probe_counter * 2); // allow 4 - 100mS pulse
SERIAL_ECHOLNPAIR("BLTouch compatible probe detected - pulse width (+/- 4mS): ", probe_counter * 2); // allow 4 - 100mS pulse
else
SERIAL_PROTOCOLLNPGM("noise detected - please re-run test"); // less than 2mS pulse
SERIAL_ECHOLNPGM("noise detected - please re-run test"); // less than 2mS pulse
MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][1]); // Stow
@ -200,7 +198,7 @@ inline void servo_probe_test() {
} // for loop waiting for trigger
if (probe_counter == 0) SERIAL_PROTOCOLLNPGM("trigger not detected");
if (probe_counter == 0) SERIAL_ECHOLNPGM("trigger not detected");
} // measure active signal length
@ -245,9 +243,9 @@ void GcodeSuite::M43() {
// Enable or disable endstop monitoring
if (parser.seen('E')) {
endstops.monitor_flag = parser.value_bool();
SERIAL_PROTOCOLPGM("endstop monitor ");
SERIAL_ECHOPGM("endstop monitor ");
serialprintPGM(endstops.monitor_flag ? PSTR("en") : PSTR("dis"));
SERIAL_PROTOCOLLNPGM("abled");
SERIAL_ECHOLNPGM("abled");
return;
}
@ -266,7 +264,7 @@ void GcodeSuite::M43() {
// Watch until click, M108, or reset
if (parser.boolval('W')) {
SERIAL_PROTOCOLLNPGM("Watching pins");
SERIAL_ECHOLNPGM("Watching pins");
#ifdef ARDUINO_ARCH_SAM
NOLESS(first_pin, 2); // don't hijack the UART pins

View File

@ -94,9 +94,7 @@ void GcodeSuite::M502() {
* M504: Validate EEPROM Contents
*/
void GcodeSuite::M504() {
if (settings.validate(CHAT_PORT)) {
SERIAL_ECHO_START_P(command_queue_port[cmd_queue_index_r]);
SERIAL_ECHOLNPGM_P(command_queue_port[cmd_queue_index_r], "EEPROM OK");
}
if (settings.validate(CHAT_PORT))
SERIAL_ECHO_MSG_P(command_queue_port[cmd_queue_index_r], "EEPROM OK");
}
#endif

View File

@ -40,7 +40,7 @@ void GcodeSuite::M900() {
#else
const uint8_t tmp_extruder = parser.seenval('T') ? parser.value_int() : active_extruder;
if (tmp_extruder >= EXTRUDERS) {
SERIAL_PROTOCOLLNPGM("?T value out of range.");
SERIAL_ECHOLNPGM("?T value out of range.");
return;
}
#endif
@ -52,7 +52,7 @@ void GcodeSuite::M900() {
planner.extruder_advance_K[tmp_extruder] = newK;
}
else
SERIAL_PROTOCOLLNPGM("?K value out of range (0-10).");
SERIAL_ECHOLNPGM("?K value out of range (0-10).");
}
else {
SERIAL_ECHO_START();

View File

@ -63,7 +63,6 @@ void GcodeSuite::M355() {
else SERIAL_ECHOLNPAIR("Case light: ", case_light_brightness);
}
#else
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_M355_NONE);
SERIAL_ERROR_MSG(MSG_ERR_M355_NONE);
#endif
}

View File

@ -38,10 +38,8 @@ void GcodeSuite::M404() {
filament_width_nominal = parser.value_linear_units();
planner.volumetric_area_nominal = CIRCLE_AREA(filament_width_nominal * 0.5);
}
else {
SERIAL_PROTOCOLPGM("Filament dia (nominal mm):");
SERIAL_PROTOCOLLN(filament_width_nominal);
}
else
SERIAL_ECHOLNPAIR("Filament dia (nominal mm):", filament_width_nominal);
}
/**
@ -79,8 +77,7 @@ void GcodeSuite::M406() {
* M407: Get measured filament diameter on serial output
*/
void GcodeSuite::M407() {
SERIAL_PROTOCOLPGM("Filament dia (measured mm):");
SERIAL_PROTOCOLLN(filament_width_meas);
SERIAL_ECHOLNPAIR("Filament dia (measured mm):", filament_width_meas);
}
#endif // FILAMENT_WIDTH_SENSOR

View File

@ -68,13 +68,10 @@ void GcodeSuite::M261() {
uint8_t bytes = parser.byteval('B', 1);
if (i2c.addr && bytes && bytes <= TWIBUS_BUFFER_SIZE) {
if (i2c.addr && bytes && bytes <= TWIBUS_BUFFER_SIZE)
i2c.relay(bytes);
}
else {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("Bad i2c request");
}
else
SERIAL_ERROR_MSG("Bad i2c request");
}
#endif

View File

@ -45,10 +45,8 @@ void GcodeSuite::M810_819() {
if (len) {
// Set a macro
if (len > GCODE_MACROS_SLOT_SIZE) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("Macro too long.");
}
if (len > GCODE_MACROS_SLOT_SIZE)
SERIAL_ERROR_MSG("Macro too long.");
else {
char c, *s = parser.string_arg, *d = gcode_macros[index];
do {

View File

@ -790,16 +790,13 @@ void GcodeSuite::process_next_command() {
switch (busy_state) {
case IN_HANDLER:
case IN_PROCESS:
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_BUSY_PROCESSING);
SERIAL_ECHO_MSG(MSG_BUSY_PROCESSING);
break;
case PAUSED_FOR_USER:
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_BUSY_PAUSED_FOR_USER);
SERIAL_ECHO_MSG(MSG_BUSY_PAUSED_FOR_USER);
break;
case PAUSED_FOR_INPUT:
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_BUSY_PAUSED_FOR_INPUT);
SERIAL_ECHO_MSG(MSG_BUSY_PAUSED_FOR_INPUT);
break;
default:
break;

View File

@ -80,7 +80,7 @@ inline void GcodeSuite::G53() {
void G54_59(uint8_t subcode=0) {
const int8_t _space = parser.codenum - 54 + subcode;
if (gcode.select_coordinate_system(_space)) {
SERIAL_PROTOCOLLNPAIR("Select workspace ", _space);
SERIAL_ECHOLNPAIR("Select workspace ", _space);
report_current_position();
}
}

View File

@ -69,8 +69,7 @@ void GcodeSuite::M428() {
if (!WITHIN(diff[i], -20, 20) && home_dir((AxisEnum)i) > 0)
diff[i] = -current_position[i];
if (!WITHIN(diff[i], -20, 20)) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_M428_TOO_FAR);
SERIAL_ERROR_MSG(MSG_ERR_M428_TOO_FAR);
LCD_ALERTMESSAGEPGM("Err: Too far!");
BUZZ(200, 40);
return;

View File

@ -34,7 +34,7 @@
SERIAL_CHAR(' ');
SERIAL_CHAR(axis_codes[i]);
SERIAL_CHAR(':');
SERIAL_PROTOCOL(dtostrf(pos[i], 8, precision, str));
SERIAL_ECHO(dtostrf(pos[i], 8, precision, str));
}
SERIAL_EOL();
}
@ -43,7 +43,7 @@
void report_current_position_detail() {
SERIAL_PROTOCOLPGM("\nLogical:");
SERIAL_ECHOPGM("\nLogical:");
const float logical[XYZ] = {
LOGICAL_X_POSITION(current_position[X_AXIS]),
LOGICAL_Y_POSITION(current_position[Y_AXIS]),
@ -51,17 +51,17 @@
};
report_xyz(logical);
SERIAL_PROTOCOLPGM("Raw: ");
SERIAL_ECHOPGM("Raw: ");
report_xyz(current_position);
float leveled[XYZ] = { current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] };
#if HAS_LEVELING
SERIAL_PROTOCOLPGM("Leveled:");
SERIAL_ECHOPGM("Leveled:");
planner.apply_leveling(leveled);
report_xyz(leveled);
SERIAL_PROTOCOLPGM("UnLevel:");
SERIAL_ECHOPGM("UnLevel:");
float unleveled[XYZ] = { leveled[X_AXIS], leveled[Y_AXIS], leveled[Z_AXIS] };
planner.unapply_leveling(unleveled);
report_xyz(unleveled);
@ -69,9 +69,9 @@
#if IS_KINEMATIC
#if IS_SCARA
SERIAL_PROTOCOLPGM("ScaraK: ");
SERIAL_ECHOPGM("ScaraK: ");
#else
SERIAL_PROTOCOLPGM("DeltaK: ");
SERIAL_ECHOPGM("DeltaK: ");
#endif
inverse_kinematics(leveled); // writes delta[]
report_xyz(delta);
@ -79,12 +79,12 @@
planner.synchronize();
SERIAL_PROTOCOLPGM("Stepper:");
SERIAL_ECHOPGM("Stepper:");
LOOP_XYZE(i) {
SERIAL_CHAR(' ');
SERIAL_CHAR(axis_codes[i]);
SERIAL_CHAR(':');
SERIAL_PROTOCOL(stepper.position((AxisEnum)i));
SERIAL_ECHO(stepper.position((AxisEnum)i));
}
SERIAL_EOL();
@ -93,11 +93,11 @@
planner.get_axis_position_degrees(A_AXIS),
planner.get_axis_position_degrees(B_AXIS)
};
SERIAL_PROTOCOLPGM("Degrees:");
SERIAL_ECHOPGM("Degrees:");
report_xyze(deg, 2);
#endif
SERIAL_PROTOCOLPGM("FromStp:");
SERIAL_ECHOPGM("FromStp:");
get_cartesian_from_steppers(); // writes cartes[XYZ] (with forward kinematics)
const float from_steppers[XYZE] = { cartes[X_AXIS], cartes[Y_AXIS], cartes[Z_AXIS], planner.get_axis_position_mm(E_AXIS) };
report_xyze(from_steppers);
@ -108,7 +108,7 @@
from_steppers[Z_AXIS] - leveled[Z_AXIS],
from_steppers[E_AXIS] - current_position[E_AXIS]
};
SERIAL_PROTOCOLPGM("Differ: ");
SERIAL_ECHOPGM("Differ: ");
report_xyze(diff);
}

View File

@ -29,10 +29,10 @@
#if ENABLED(EXTENDED_CAPABILITIES_REPORT)
static void cap_line(PGM_P const name, bool ena=false) {
SERIAL_PROTOCOLPGM("Cap:");
SERIAL_ECHOPGM("Cap:");
serialprintPGM(name);
SERIAL_CHAR(':');
SERIAL_PROTOCOLLN(int(ena ? 1 : 0));
SERIAL_ECHOLN(int(ena ? 1 : 0));
}
#endif
@ -47,7 +47,7 @@ void GcodeSuite::M115() {
#define CAPLINE(STR,...) cap_line(PSTR(STR), __VA_ARGS__)
#endif
SERIAL_PROTOCOLLNPGM_P(port, MSG_M115_REPORT);
SERIAL_ECHOLNPGM_P(port, MSG_M115_REPORT);
#if ENABLED(EXTENDED_CAPABILITIES_REPORT)

View File

@ -37,10 +37,8 @@
*/
void GcodeSuite::M145() {
const uint8_t material = (uint8_t)parser.intval('S');
if (material >= COUNT(ui.preheat_hotend_temp)) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_MATERIAL_INDEX);
}
if (material >= COUNT(ui.preheat_hotend_temp))
SERIAL_ERROR_MSG(MSG_ERR_MATERIAL_INDEX);
else {
int v;
if (parser.seenval('H')) {

View File

@ -32,7 +32,7 @@
*/
void GcodeSuite::M250() {
if (parser.seen('C')) ui.set_contrast(parser.value_int());
SERIAL_PROTOCOLLNPAIR("LCD Contrast: ", ui.contrast);
SERIAL_ECHOLNPAIR("LCD Contrast: ", ui.contrast);
}
#endif // HAS_LCD_CONTRAST

View File

@ -293,10 +293,9 @@ void GcodeSuite::G2_G3(const bool clockwise) {
#if ENABLED(ARC_P_CIRCLES)
// P indicates number of circles to do
int8_t circles_to_do = parser.byteval('P');
if (!WITHIN(circles_to_do, 0, 100)) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_ARC_ARGS);
}
if (!WITHIN(circles_to_do, 0, 100))
SERIAL_ERROR_MSG(MSG_ERR_ARC_ARGS);
while (circles_to_do--)
plan_arc(current_position, arc_offset, clockwise);
#endif
@ -305,11 +304,8 @@ void GcodeSuite::G2_G3(const bool clockwise) {
plan_arc(destination, arc_offset, clockwise);
reset_stepper_timeout();
}
else {
// Bad arguments
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_ARC_ARGS);
}
else
SERIAL_ERROR_MSG(MSG_ERR_ARC_ARGS);
}
}

View File

@ -50,8 +50,7 @@ void GcodeSuite::G5() {
#if ENABLED(CNC_WORKSPACE_PLANES)
if (workspace_plane != PLANE_XY) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_BAD_PLANE_MODE);
SERIAL_ERROR_MSG(MSG_ERR_BAD_PLANE_MODE);
return;
}
#endif

View File

@ -55,9 +55,9 @@ void GcodeSuite::G30() {
const float measured_z = probe_pt(xpos, ypos, raise_after, 1);
if (!isnan(measured_z)) {
SERIAL_PROTOCOLPAIR_F("Bed X: ", xpos);
SERIAL_PROTOCOLPAIR_F(" Y: ", ypos);
SERIAL_PROTOCOLLNPAIR_F(" Z: ", measured_z);
SERIAL_ECHOPAIR("Bed X: ", FIXFLOAT(xpos));
SERIAL_ECHOPAIR(" Y: ", FIXFLOAT(ypos));
SERIAL_ECHOLNPAIR(" Z: ", FIXFLOAT(measured_z));
}
clean_up_after_endstop_or_probe_move();

View File

@ -108,10 +108,7 @@ void GcodeSuite::G38(const bool is_38_2) {
if (ABS(destination[i] - current_position[i]) >= G38_MINIMUM_MOVE) {
if (!parser.seenval('F')) feedrate_mm_s = homing_feedrate((AxisEnum)i);
// If G38.2 fails throw an error
if (!G38_run_probe() && is_38_2) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("Failed to reach target");
}
if (!G38_run_probe() && is_38_2) SERIAL_ERROR_MSG("Failed to reach target");
break;
}

View File

@ -32,18 +32,13 @@ void GcodeSuite::M851() {
if (parser.seenval('Z')) {
const float value = parser.value_linear_units();
if (WITHIN(value, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX))
{
zprobe_zoffset = value;
}
else {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("?Z out of range (" STRINGIFY(Z_PROBE_OFFSET_RANGE_MIN) " to " STRINGIFY(Z_PROBE_OFFSET_RANGE_MAX) ")");
}
else
SERIAL_ERROR_MSG("?Z out of range (" STRINGIFY(Z_PROBE_OFFSET_RANGE_MIN) " to " STRINGIFY(Z_PROBE_OFFSET_RANGE_MAX) ")");
return;
}
SERIAL_ECHO_START();
SERIAL_ECHOPGM(MSG_PROBE_Z_OFFSET);
SERIAL_ECHOLNPAIR(": ", zprobe_zoffset);
SERIAL_ECHOLNPAIR(MSG_PROBE_Z_OFFSET ": ", zprobe_zoffset);
}
#endif // HAS_BED_PROBE

View File

@ -221,17 +221,17 @@ void ok_to_send() {
if (port < 0) return;
#endif
if (!send_ok[cmd_queue_index_r]) return;
SERIAL_PROTOCOLPGM_P(port, MSG_OK);
SERIAL_ECHOPGM_P(port, MSG_OK);
#if ENABLED(ADVANCED_OK)
char* p = command_queue[cmd_queue_index_r];
if (*p == 'N') {
SERIAL_PROTOCOL_P(port, ' ');
SERIAL_ECHO_P(port, ' ');
SERIAL_ECHO_P(port, *p++);
while (NUMERIC_SIGNED(*p))
SERIAL_ECHO_P(port, *p++);
}
SERIAL_PROTOCOLPGM_P(port, " P"); SERIAL_PROTOCOL_P(port, int(BLOCK_BUFFER_SIZE - planner.movesplanned() - 1));
SERIAL_PROTOCOLPGM_P(port, " B"); SERIAL_PROTOCOL_P(port, BUFSIZE - commands_in_queue);
SERIAL_ECHOPGM_P(port, " P"); SERIAL_ECHO_P(port, int(BLOCK_BUFFER_SIZE - planner.movesplanned() - 1));
SERIAL_ECHOPGM_P(port, " B"); SERIAL_ECHO_P(port, BUFSIZE - commands_in_queue);
#endif
SERIAL_EOL_P(port);
}
@ -246,15 +246,15 @@ void flush_and_request_resend() {
if (port < 0) return;
#endif
SERIAL_FLUSH_P(port);
SERIAL_PROTOCOLPGM_P(port, MSG_RESEND);
SERIAL_PROTOCOLLN_P(port, gcode_LastN + 1);
SERIAL_ECHOPGM_P(port, MSG_RESEND);
SERIAL_ECHOLN_P(port, gcode_LastN + 1);
ok_to_send();
}
void gcode_line_error(PGM_P err, uint8_t port) {
SERIAL_ERROR_START_P(port);
serialprintPGM_P(port, err);
SERIAL_ERRORLN_P(port, gcode_LastN);
SERIAL_ECHOLN_P(port, gcode_LastN);
flush_and_request_resend();
serial_count[port] = 0;
}
@ -648,7 +648,7 @@ inline void get_serial_commands() {
#if ENABLED(BEZIER_CURVE_SUPPORT)
case 5:
#endif
SERIAL_ERRORLNPGM(MSG_ERR_STOPPED);
SERIAL_ECHOLNPGM(MSG_ERR_STOPPED);
LCD_MESSAGEPGM(MSG_STOPPED);
break;
}
@ -754,7 +754,7 @@ inline void get_serial_commands() {
if (IS_SD_PRINTING())
sd_count = 0; // If a sub-file was printing, continue from call point
else {
SERIAL_PROTOCOLLNPGM(MSG_FILE_PRINTED);
SERIAL_ECHOLNPGM(MSG_FILE_PRINTED);
#if ENABLED(PRINTER_EVENT_LEDS)
printerEventLEDs.onPrintCompleted();
#if HAS_RESUME_CONTINUE
@ -769,10 +769,9 @@ inline void get_serial_commands() {
#endif // PRINTER_EVENT_LEDS
}
}
else if (n == -1) {
SERIAL_ERROR_START();
SERIAL_ECHOLNPGM(MSG_SD_ERR_READ);
}
else if (n == -1)
SERIAL_ERROR_MSG(MSG_SD_ERR_READ);
if (sd_char == '#') stop_buffering = true;
sd_comment_mode = false; // for new command
@ -843,7 +842,7 @@ void advance_command_queue() {
if (strstr_P(command, PSTR("M29"))) {
// M29 closes the file
card.closefile();
SERIAL_PROTOCOLLNPGM(MSG_FILE_SAVED);
SERIAL_ECHOLNPGM(MSG_FILE_SAVED);
#if !defined(__AVR__) || !defined(USBCON)
#if ENABLED(SERIAL_STATS_DROPPED_RX)

View File

@ -50,13 +50,13 @@ void GcodeSuite::M20() {
const int16_t port = command_queue_port[cmd_queue_index_r];
#endif
SERIAL_PROTOCOLLNPGM_P(port, MSG_BEGIN_FILE_LIST);
SERIAL_ECHOLNPGM_P(port, MSG_BEGIN_FILE_LIST);
card.ls(
#if NUM_SERIAL > 1
port
#endif
);
SERIAL_PROTOCOLLNPGM_P(port, MSG_END_FILE_LIST);
SERIAL_ECHOLNPGM_P(port, MSG_END_FILE_LIST);
}
/**

View File

@ -40,15 +40,14 @@ void GcodeSuite::M105() {
#endif
#if HAS_TEMP_SENSOR
SERIAL_PROTOCOLPGM_P(port, MSG_OK);
SERIAL_ECHOPGM_P(port, MSG_OK);
thermalManager.print_heater_states(target_extruder
#if NUM_SERIAL > 1
, port
#endif
);
#else // !HAS_TEMP_SENSOR
SERIAL_ERROR_START_P(port);
SERIAL_ERRORLNPGM_P(port, MSG_ERR_NO_THERMISTORS);
SERIAL_ERROR_MSG_P(port, MSG_ERR_NO_THERMISTORS);
#endif
SERIAL_EOL_P(port);