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

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