Refactor serial class with templates (#20783)
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user