From 1caa0d753c37e24af5bcdd0b5b47b8f9577f6f1e Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Mon, 14 Mar 2022 10:27:45 +0100 Subject: [PATCH] Restrict available UART modes to the feature enabled --- radio/src/gui/gui_common.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/radio/src/gui/gui_common.cpp b/radio/src/gui/gui_common.cpp index 4f4fe04b4..8ecec7573 100644 --- a/radio/src/gui/gui_common.cpp +++ b/radio/src/gui/gui_common.cpp @@ -380,6 +380,26 @@ bool isSerialModeAvailable(uint8_t port_nr, int mode) if (mode == UART_MODE_NONE) return true; +#if !defined(DEBUG) + if (mode == UART_MODE_DEBUG) + return false; +#endif + +#if !defined(CLI) + if (mode == UART_MODE_CLI) + return false; +#endif + +#if !defined(INTERNAL_GPS) + if (mode == UART_MODE_GPS) + return false; +#endif + +#if !defined(LUA) + if (mode == UART_MODE_LUA) + return false; +#endif + auto p = hasSerialMode(mode); if (p >= 0 && p != port_nr) return false; return true;