From d8543ee7fe34d544f422ba507cfa92f92856f833 Mon Sep 17 00:00:00 2001 From: mikecarper Date: Sat, 29 Aug 2026 09:47:24 -0700 Subject: [PATCH] Avoid USB logging enum macro collision --- examples/companion_radio/main.cpp | 2 +- src/helpers/UsbAsciiBinarySwitch.h | 6 +++--- test/test_serial_mode_switch/test_serial_mode_switch.cpp | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index abd15090..d46ffec2 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -643,7 +643,7 @@ static void serviceUsbTerminal() { usb_terminal_discard_line = false; Serial.print("\r\nUSB logging off; ASCII terminal active\r\n> "); break; - case mesh::UsbLoggingTerminalAction::NONE: + case mesh::UsbLoggingTerminalAction::NO_ACTION: break; } #endif diff --git a/src/helpers/UsbAsciiBinarySwitch.h b/src/helpers/UsbAsciiBinarySwitch.h index 90468133..aa41ad15 100644 --- a/src/helpers/UsbAsciiBinarySwitch.h +++ b/src/helpers/UsbAsciiBinarySwitch.h @@ -93,7 +93,7 @@ public: // stream objects. In particular, an active TCP terminal owns the role CLI and // must not be displaced just because USB logging is enabled. enum class UsbLoggingTerminalAction : uint8_t { - NONE, + NO_ACTION, CLAIM_USB, RETURN_TO_BINARY, KEEP_ASCII, @@ -104,13 +104,13 @@ inline UsbLoggingTerminalAction selectUsbLoggingTerminalAction( bool usb_terminal_active, bool usb_logging_terminal_active, bool full_companion, bool network_terminal_active) { if (has_dedicated_logging_port || network_terminal_active) { - return UsbLoggingTerminalAction::NONE; + return UsbLoggingTerminalAction::NO_ACTION; } if (logging_enabled) { return UsbLoggingTerminalAction::CLAIM_USB; } if (!usb_terminal_active || !usb_logging_terminal_active) { - return UsbLoggingTerminalAction::NONE; + return UsbLoggingTerminalAction::NO_ACTION; } return full_companion ? UsbLoggingTerminalAction::KEEP_ASCII : UsbLoggingTerminalAction::RETURN_TO_BINARY; diff --git a/test/test_serial_mode_switch/test_serial_mode_switch.cpp b/test/test_serial_mode_switch/test_serial_mode_switch.cpp index 45b0822a..9a84501a 100644 --- a/test/test_serial_mode_switch/test_serial_mode_switch.cpp +++ b/test/test_serial_mode_switch/test_serial_mode_switch.cpp @@ -474,10 +474,10 @@ TEST(SerialModeSwitch, SingleTtyLoggingCannotStealNetworkTerminal) { using Action = mesh::UsbLoggingTerminalAction; EXPECT_EQ(mesh::selectUsbLoggingTerminalAction( false, true, false, false, true, true), - Action::NONE); + Action::NO_ACTION); EXPECT_EQ(mesh::selectUsbLoggingTerminalAction( false, true, false, false, false, true), - Action::NONE); + Action::NO_ACTION); } TEST(SerialModeSwitch, LoggingClaimsOnlySingleTtyUsb) { @@ -487,7 +487,7 @@ TEST(SerialModeSwitch, LoggingClaimsOnlySingleTtyUsb) { Action::CLAIM_USB); EXPECT_EQ(mesh::selectUsbLoggingTerminalAction( true, true, false, false, true, false), - Action::NONE); + Action::NO_ACTION); } TEST(SerialModeSwitch, LoggingOffRestoresTheBuildDefaultUsbMode) { @@ -500,7 +500,7 @@ TEST(SerialModeSwitch, LoggingOffRestoresTheBuildDefaultUsbMode) { Action::KEEP_ASCII); EXPECT_EQ(mesh::selectUsbLoggingTerminalAction( false, false, true, false, false, false), - Action::NONE); + Action::NO_ACTION); } TEST(SerialModeSwitch, FailedMotaRestoresOnlyItsAsciiOrigin) {