Refactor serial class with templates (#20783)

This commit is contained in:
X-Ryl669
2021-01-28 09:02:06 +01:00
committed by GitHub
parent c929fb52dd
commit 3f01b222b2
64 changed files with 782 additions and 948 deletions

View File

@ -53,21 +53,14 @@ void GcodeSuite::M118() {
}
#if HAS_MULTI_SERIAL
const serial_index_t old_serial = serial_port_index;
const int8_t old_serial = multiSerial.portMask;
if (WITHIN(port, 0, NUM_SERIAL))
serial_port_index = (
port == 0 ? SERIAL_BOTH
: port == 1 ? 0
#if HAS_MULTI_SERIAL
: port == 2 ? 1
#endif
: SERIAL_PORT
);
multiSerial.portMask = port ? _BV(port - 1) : SERIAL_ALL;
#endif
if (hasE) SERIAL_ECHO_START();
if (hasA) SERIAL_ECHOPGM("//");
SERIAL_ECHOLN(p);
TERN_(HAS_MULTI_SERIAL, serial_port_index = old_serial);
TERN_(HAS_MULTI_SERIAL, multiSerial.portMask = old_serial);
}