Simplify serial port redirect (#13234)

This commit is contained in:
Scott Lahteine
2019-02-23 22:53:01 -06:00
committed by GitHub
parent 88cc1d1a31
commit e15354e387
22 changed files with 575 additions and 876 deletions

View File

@ -34,46 +34,30 @@
#include "math.h"
void unified_bed_leveling::echo_name(
#if NUM_SERIAL > 1
const int8_t port/*= -1*/
#endif
) {
SERIAL_ECHOPGM_P(port, "Unified Bed Leveling");
void unified_bed_leveling::echo_name() {
SERIAL_ECHOPGM("Unified Bed Leveling");
}
void unified_bed_leveling::report_current_mesh(
#if NUM_SERIAL > 1
const int8_t port/*= -1*/
#endif
) {
void unified_bed_leveling::report_current_mesh() {
if (!leveling_is_valid()) return;
SERIAL_ECHO_MSG_P(port, " G29 I99");
SERIAL_ECHO_MSG(" G29 I99");
for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++)
if (!isnan(z_values[x][y])) {
SERIAL_ECHO_START_P(port);
SERIAL_ECHOPAIR_P(port, " M421 I", x);
SERIAL_ECHOPAIR_P(port, " J", y);
SERIAL_ECHOPAIR_F_P(port, " Z", z_values[x][y], 2);
SERIAL_EOL_P(port);
SERIAL_ECHO_START();
SERIAL_ECHOPAIR(" M421 I", x);
SERIAL_ECHOPAIR(" J", y);
SERIAL_ECHOPAIR_F(" Z", z_values[x][y], 2);
SERIAL_EOL();
serial_delay(75); // Prevent Printrun from exploding
}
}
void unified_bed_leveling::report_state(
#if NUM_SERIAL > 1
const int8_t port/*= -1*/
#endif
) {
echo_name(
#if NUM_SERIAL > 1
port
#endif
);
SERIAL_ECHOPGM_P(port, " System v" UBL_VERSION " ");
if (!planner.leveling_active) SERIAL_ECHOPGM_P(port, "in");
SERIAL_ECHOLNPGM_P(port, "active.");
void unified_bed_leveling::report_state() {
echo_name();
SERIAL_ECHOPGM(" System v" UBL_VERSION " ");
if (!planner.leveling_active) SERIAL_ECHOPGM("in");
SERIAL_ECHOLNPGM("active.");
serial_delay(50);
}

View File

@ -94,21 +94,9 @@ class unified_bed_leveling {
public:
static void echo_name(
#if NUM_SERIAL > 1
const int8_t port = -1
#endif
);
static void report_current_mesh(
#if NUM_SERIAL > 1
const int8_t port = -1
#endif
);
static void report_state(
#if NUM_SERIAL > 1
const int8_t port = -1
#endif
);
static void echo_name();
static void report_current_mesh();
static void report_state();
static void save_ubl_active_state_and_disable();
static void restore_ubl_active_state_and_leave();
static void display_map(const int) _O0;