Add HAS_MULTI_SERIAL conditional
This commit is contained in:
@ -34,7 +34,7 @@
|
||||
*/
|
||||
void GcodeSuite::M118() {
|
||||
bool hasE = false, hasA = false;
|
||||
#if NUM_SERIAL > 1
|
||||
#if HAS_MULTI_SERIAL
|
||||
int8_t port = -1; // Assume no redirect
|
||||
#endif
|
||||
char *p = parser.string_arg;
|
||||
@ -44,7 +44,7 @@ void GcodeSuite::M118() {
|
||||
switch (p[0]) {
|
||||
case 'A': hasA = true; break;
|
||||
case 'E': hasE = true; break;
|
||||
#if NUM_SERIAL > 1
|
||||
#if HAS_MULTI_SERIAL
|
||||
case 'P': port = p[1] - '0'; break;
|
||||
#endif
|
||||
}
|
||||
@ -52,7 +52,7 @@ void GcodeSuite::M118() {
|
||||
while (*p == ' ') ++p;
|
||||
}
|
||||
|
||||
#if NUM_SERIAL > 1
|
||||
#if HAS_MULTI_SERIAL
|
||||
const int8_t old_serial = serial_port_index;
|
||||
if (WITHIN(port, 0, NUM_SERIAL))
|
||||
serial_port_index = (
|
||||
@ -69,7 +69,5 @@ void GcodeSuite::M118() {
|
||||
if (hasA) SERIAL_ECHOPGM("// ");
|
||||
SERIAL_ECHOLN(p);
|
||||
|
||||
#if NUM_SERIAL > 1
|
||||
serial_port_index = old_serial;
|
||||
#endif
|
||||
TERN_(HAS_MULTI_SERIAL, serial_port_index = old_serial);
|
||||
}
|
||||
|
Reference in New Issue
Block a user