Add HAS_MULTI_SERIAL conditional

This commit is contained in:
Scott Lahteine
2020-05-12 05:50:28 -05:00
parent f350e9d0cb
commit 6371782263
13 changed files with 37 additions and 53 deletions

View File

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