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

@ -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)