From 6b9c4fe165ca6e20623bc35fe43abaf5f76ef4da Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Mon, 14 Mar 2022 09:51:15 +0100 Subject: [PATCH] Split UART_MODE_NONE and UART_MODE_DEBUG --- radio/src/dataconstants.h | 3 +-- radio/src/gui/gui_common.cpp | 3 +++ radio/src/storage/yaml/yaml_datastructs_funcs.cpp | 1 + radio/src/targets/horus/board.cpp | 4 +++- radio/src/targets/nv14/board.cpp | 7 ++----- radio/src/targets/taranis/board.cpp | 4 +++- radio/src/translations/cn.h.txt | 2 +- radio/src/translations/cz.h.txt | 6 +----- radio/src/translations/de.h.txt | 6 +----- radio/src/translations/en.h.txt | 6 +----- radio/src/translations/es.h.txt | 6 +----- radio/src/translations/fi.h.txt | 6 +----- radio/src/translations/fr.h.txt | 6 +----- radio/src/translations/it.h.txt | 6 +----- radio/src/translations/nl.h.txt | 6 +----- radio/src/translations/pl.h.txt | 6 +----- radio/src/translations/pt.h.txt | 6 +----- radio/src/translations/se.h.txt | 6 +----- 18 files changed, 25 insertions(+), 65 deletions(-) diff --git a/radio/src/dataconstants.h b/radio/src/dataconstants.h index 04f3410f6..8b4a9cbc9 100644 --- a/radio/src/dataconstants.h +++ b/radio/src/dataconstants.h @@ -233,12 +233,11 @@ enum UartModes { UART_MODE_LUA, UART_MODE_CLI, UART_MODE_GPS, + UART_MODE_DEBUG, UART_MODE_COUNT SKIP, UART_MODE_MAX SKIP = UART_MODE_COUNT-1 }; -#define UART_MODE_DEBUG UART_MODE_NONE - #define LEN_SWITCH_NAME 3 #define LEN_ANA_NAME 3 #define LEN_MODEL_FILENAME 16 diff --git a/radio/src/gui/gui_common.cpp b/radio/src/gui/gui_common.cpp index f90a638dd..4f4fe04b4 100644 --- a/radio/src/gui/gui_common.cpp +++ b/radio/src/gui/gui_common.cpp @@ -377,6 +377,9 @@ int hasSerialMode(int mode) bool isSerialModeAvailable(uint8_t port_nr, int mode) { + if (mode == UART_MODE_NONE) + return true; + auto p = hasSerialMode(mode); if (p >= 0 && p != port_nr) return false; return true; diff --git a/radio/src/storage/yaml/yaml_datastructs_funcs.cpp b/radio/src/storage/yaml/yaml_datastructs_funcs.cpp index d49121c2b..87483b853 100644 --- a/radio/src/storage/yaml/yaml_datastructs_funcs.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_funcs.cpp @@ -1768,6 +1768,7 @@ static const struct YamlIdStr enum_UartModes[] = { { UART_MODE_LUA, "LUA" }, { UART_MODE_CLI, "CLI" }, { UART_MODE_GPS, "GPS" }, + { UART_MODE_DEBUG, "DEBUG" }, { 0, NULL } }; diff --git a/radio/src/targets/horus/board.cpp b/radio/src/targets/horus/board.cpp index f939d2dd9..cd6a1fd22 100644 --- a/radio/src/targets/horus/board.cpp +++ b/radio/src/targets/horus/board.cpp @@ -165,7 +165,9 @@ void boardInit() __enable_irq(); - initSerialPorts(); +#if defined(DEBUG) + serialInit(SP_AUX1, UART_MODE_DEBUG); +#endif TRACE("\nHorus board started :)"); TRACE("RCC->CSR = %08x", RCC->CSR); diff --git a/radio/src/targets/nv14/board.cpp b/radio/src/targets/nv14/board.cpp index bcede129f..41f886716 100644 --- a/radio/src/targets/nv14/board.cpp +++ b/radio/src/targets/nv14/board.cpp @@ -120,11 +120,8 @@ void boardInit() __enable_irq(); #endif -#if defined(DEBUG) && defined(AUX_SERIAL) - auxSerialInit(UART_MODE_DEBUG, 0); // default serial mode (None if DEBUG not defined) -#endif -#if defined(DEBUG) && defined(AUX2_SERIAL) - aux2SerialInit(UART_MODE_DEBUG, 0); // default serial mode (None if DEBUG not defined) +#if defined(DEBUG) + serialInit(SP_AUX1, UART_MODE_DEBUG); #endif TRACE("\nNV14 board started :)"); diff --git a/radio/src/targets/taranis/board.cpp b/radio/src/targets/taranis/board.cpp index 02b773ca0..c086a3ec8 100644 --- a/radio/src/targets/taranis/board.cpp +++ b/radio/src/targets/taranis/board.cpp @@ -227,7 +227,9 @@ void boardInit() i2cInit(); usbInit(); - initSerialPorts(); +#if defined(DEBUG) + serialInit(SP_AUX1, UART_MODE_DEBUG); +#endif #if defined(HAPTIC) hapticInit(); diff --git a/radio/src/translations/cn.h.txt b/radio/src/translations/cn.h.txt index 696174330..e81825e4c 100644 --- a/radio/src/translations/cn.h.txt +++ b/radio/src/translations/cn.h.txt @@ -63,7 +63,7 @@ #define TR_TRNCHN "CH1CH2CH3CH4" #define LEN_AUX_SERIAL_MODES "\010" -#define TR_AUX_SERIAL_MODES "调试\0 " "回传镜像" "回传输入" "SBUS教练" "LUA脚本\0""CLI\0 " +#define TR_AUX_SERIAL_MODES "调试\0 " "回传镜像" "回传输入" "SBUS教练" "LUA脚本\0""CLI\0 ""GPS\0 ""Debug\0 " #define LEN_SWTYPES "\004" #define TR_SWTYPES "无\0 " "回弹" "2段\0""3段\0" diff --git a/radio/src/translations/cz.h.txt b/radio/src/translations/cz.h.txt index d95491c35..0d7a13813 100644 --- a/radio/src/translations/cz.h.txt +++ b/radio/src/translations/cz.h.txt @@ -61,11 +61,7 @@ #define TR_TRNCHN "CH1CH2CH3CH4" #define LEN_AUX_SERIAL_MODES "\015" -#if defined(CLI) || defined(DEBUG) -#define TR_AUX_SERIAL_MODES "Debug\0 ""Telem Mirror\0""Telemetry In\0""SBUS Trenér\0 ""LUA\0 ""CLI\0 " -#else -#define TR_AUX_SERIAL_MODES "VYP\0 ""Telem Mirror\0""Telemetry In\0""SBUS Trenér\0 ""LUA\0 ""CLI\0 " -#endif +#define TR_AUX_SERIAL_MODES "VYP\0 ""Telem Mirror\0""Telemetry In\0""SBUS Trenér\0 ""LUA\0 ""CLI\0 ""GPS\0 ""Debug\0 " #define LEN_SWTYPES "\013" #define TR_SWTYPES "Žádný\0 ""Bez aretace""2-polohový\0""3-polohový\0" diff --git a/radio/src/translations/de.h.txt b/radio/src/translations/de.h.txt index 08b4cf9f7..fef383bd8 100644 --- a/radio/src/translations/de.h.txt +++ b/radio/src/translations/de.h.txt @@ -62,11 +62,7 @@ #define TR_TRNCHN "CH1CH2CH3CH4" #define LEN_AUX_SERIAL_MODES "\015" -#if defined(CLI) || defined(DEBUG) -#define TR_AUX_SERIAL_MODES "Debug\0 ""Telem Mirror\0""Telemetry In\0""SBUS Eingang\0""LUA\0 ""CLI\0 " -#else -#define TR_AUX_SERIAL_MODES "AUS\0 ""Telem Mirror\0""Telemetry In\0""SBUS Eingang\0""LUA\0 ""CLI\0 " -#endif +#define TR_AUX_SERIAL_MODES "AUS\0 ""Telem Mirror\0""Telemetry In\0""SBUS Eingang\0""LUA\0 ""CLI\0 ""GPS\0 ""Debug\0 " #define LEN_SWTYPES "\006" #define TR_SWTYPES "Kein\0 ""Taster""2POS\0 ""3POS\0" diff --git a/radio/src/translations/en.h.txt b/radio/src/translations/en.h.txt index 7f13bb738..5bacdfcc9 100644 --- a/radio/src/translations/en.h.txt +++ b/radio/src/translations/en.h.txt @@ -62,11 +62,7 @@ #define TR_TRNCHN "CH1CH2CH3CH4" #define LEN_AUX_SERIAL_MODES "\015" -#if defined(CLI) || defined(DEBUG) -#define TR_AUX_SERIAL_MODES "Debug\0 ""Telem Mirror\0""Telemetry In\0""SBUS Trainer\0""LUA\0 ""CLI\0 ""GPS\0 " -#else -#define TR_AUX_SERIAL_MODES "OFF\0 ""Telem Mirror\0""Telemetry In\0""SBUS Trainer\0""LUA\0 ""CLI\0 ""GPS\0 " -#endif +#define TR_AUX_SERIAL_MODES "OFF\0 ""Telem Mirror\0""Telemetry In\0""SBUS Trainer\0""LUA\0 ""CLI\0 ""GPS\0 ""Debug\0 " #define LEN_SWTYPES "\006" #define TR_SWTYPES "None\0 ""Toggle""2POS\0 ""3POS\0" diff --git a/radio/src/translations/es.h.txt b/radio/src/translations/es.h.txt index 88bc16d12..120e2458d 100644 --- a/radio/src/translations/es.h.txt +++ b/radio/src/translations/es.h.txt @@ -62,11 +62,7 @@ #define TR_TRNCHN "CH1CH2CH3CH4" #define LEN_AUX_SERIAL_MODES "\015" -#if defined(CLI) || defined(DEBUG) -#define TR_AUX_SERIAL_MODES "Debug\0 ""Telem Mirror\0""Telemetría\0 ""Entrenador SBUS""LUA\0 ""CLI\0 " -#else -#define TR_AUX_SERIAL_MODES "OFF\0 ""Telem Mirror\0""Telemetría\0 ""Entrenador SBUS""LUA\0 ""CLI\0 " -#endif +#define TR_AUX_SERIAL_MODES "OFF\0 ""Telem Mirror\0""Telemetría\0 ""Entrenador SBUS""LUA\0 ""CLI\0 ""GPS\0 ""Debug\0 " #define LEN_SWTYPES "\007" #define TR_SWTYPES "Nada\0 ""Palanca""2POS\0 ""3POS\0 " diff --git a/radio/src/translations/fi.h.txt b/radio/src/translations/fi.h.txt index 90675ecf1..5bfc3cf9f 100644 --- a/radio/src/translations/fi.h.txt +++ b/radio/src/translations/fi.h.txt @@ -62,11 +62,7 @@ #define TR_TRNCHN "CH1CH2CH3CH4" #define LEN_AUX_SERIAL_MODES "\015" -#if defined(CLI) || defined(DEBUG) -#define TR_AUX_SERIAL_MODES "Debug\0 ""S-Port Pelik\0""Telemetry In\0""SBUS Trainer\0""LUA\0 ""CLI\0 " -#else -#define TR_AUX_SERIAL_MODES "POIS\0 ""S-Port Pelik\0""Telemetry In\0""SBUS Trainer\0""LUA\0 ""CLI\0 " -#endif +#define TR_AUX_SERIAL_MODES "POIS\0 ""S-Port Pelik\0""Telemetry In\0""SBUS Trainer\0""LUA\0 ""CLI\0 ""GPS\0 ""Debug\0 " #define LEN_SWTYPES "\006" #define TR_SWTYPES "None\0 ""Toggle""2POS\0 ""3POS\0" diff --git a/radio/src/translations/fr.h.txt b/radio/src/translations/fr.h.txt index a00ccbb54..1b35dfd65 100644 --- a/radio/src/translations/fr.h.txt +++ b/radio/src/translations/fr.h.txt @@ -65,11 +65,7 @@ #define TR_TRNCHN "CH1CH2CH3CH4" #define LEN_AUX_SERIAL_MODES "\016" -#if defined(CLI) || defined(DEBUG) -#define TR_AUX_SERIAL_MODES "Debug\0 ""Recopie Telem\0""Télémétrie In\0""Ecolage SBUS\0 ""LUA\0 ""CLI\0 " -#else -#define TR_AUX_SERIAL_MODES "OFF\0 ""Recopie Telem\0""Télémétrie In\0""Ecolage SBUS\0 ""LUA\0 ""CLI\0 " -#endif +#define TR_AUX_SERIAL_MODES "OFF\0 ""Recopie Telem\0""Télémétrie In\0""Ecolage SBUS\0 ""LUA\0 ""CLI\0 ""GPS\0 ""Debug\0 " #define LEN_SWTYPES "\006" #define TR_SWTYPES "Rien\0 ""Levier""2-POS\0""3-POS\0" diff --git a/radio/src/translations/it.h.txt b/radio/src/translations/it.h.txt index 0dc6e8a4c..ae73ad30d 100644 --- a/radio/src/translations/it.h.txt +++ b/radio/src/translations/it.h.txt @@ -63,11 +63,7 @@ #define TR_TRNCHN "ch1ch2ch3ch4" #define LEN_AUX_SERIAL_MODES "\016" -#if defined(CLI) || defined(DEBUG) -#define TR_AUX_SERIAL_MODES "Debug\0 ""Replica S-Port""Telemetria\0 ""SBUS Trainer\0 ""LUA\0 ""CLI\0 " -#else -#define TR_AUX_SERIAL_MODES "OFF\0 ""Replica S-Port""Telemetria\0 ""SBUS Trainer\0 ""LUA\0 ""CLI\0 " -#endif +#define TR_AUX_SERIAL_MODES "OFF\0 ""Replica S-Port""Telemetria\0 ""SBUS Trainer\0 ""LUA\0 ""CLI\0 ""GPS\0 ""Debug\0 " #define LEN_SWTYPES "\006" #define TR_SWTYPES "Dis.\0 ""Toggle""2POS\0 ""3POS\0" diff --git a/radio/src/translations/nl.h.txt b/radio/src/translations/nl.h.txt index a352c4958..06ff4155b 100644 --- a/radio/src/translations/nl.h.txt +++ b/radio/src/translations/nl.h.txt @@ -62,11 +62,7 @@ #define TR_TRNCHN "CH1CH2CH3CH4" #define LEN_AUX_SERIAL_MODES "\015" -#if defined(CLI) || defined(DEBUG) -#define TR_AUX_SERIAL_MODES "Debug\0 ""Telem Mirror\0""Telemetry In\0""SBUS Leerling""LUA\0 ""CLI\0 " -#else -#define TR_AUX_SERIAL_MODES "UIT\0 ""Telem Mirror\0""Telemetry In\0""SBUS Leerling""LUA\0 ""CLI\0 " -#endif +#define TR_AUX_SERIAL_MODES "UIT\0 ""Telem Mirror\0""Telemetry In\0""SBUS Leerling""LUA\0 ""CLI\0 ""GPS\0 ""Debug\0 " #define LEN_SWTYPES "\006" #define TR_SWTYPES "Geen\0 ""Wissel""2POS\0 ""3POS\0" diff --git a/radio/src/translations/pl.h.txt b/radio/src/translations/pl.h.txt index bbb62cb3e..c1d7d7fe3 100644 --- a/radio/src/translations/pl.h.txt +++ b/radio/src/translations/pl.h.txt @@ -62,11 +62,7 @@ #define TR_TRNCHN "KN1KN2KN3KN4" #define LEN_AUX_SERIAL_MODES "\015" /*13 decimal*/ -#if defined(CLI) || defined(DEBUG) -#define TR_AUX_SERIAL_MODES "Debug\0 ""S-Port Kopia ""Telemetria\0 ""Trener SBUS\0 ""LUA\0 ""CLI\0 " -#else -#define TR_AUX_SERIAL_MODES "Wyłącz\0 ""S-Port Kopia ""Telemetria\0 ""Trener SBUS\0 ""LUA\0 ""CLI\0 " -#endif +#define TR_AUX_SERIAL_MODES "Wyłącz\0 ""S-Port Kopia ""Telemetria\0 ""Trener SBUS\0 ""LUA\0 ""CLI\0 ""GPS\0 ""Debug\0 " #define LEN_SWTYPES "\006" #define TR_SWTYPES "Brak\0 ""Chwil.""2POZ\0 ""3POZ\0" diff --git a/radio/src/translations/pt.h.txt b/radio/src/translations/pt.h.txt index c83d442bd..f7344452b 100644 --- a/radio/src/translations/pt.h.txt +++ b/radio/src/translations/pt.h.txt @@ -62,11 +62,7 @@ #define TR_TRNCHN "CH1CH2CH3CH4" #define LEN_AUX_SERIAL_MODES "\017" -#if defined(CLI) || defined(DEBUG) -#define TR_AUX_SERIAL_MODES "Debug\0 ""S-Port Mirror\0 ""Telemetry\0 ""SBUS Trainer\0 ""LUA\0 ""CLI\0 " -#else -#define TR_AUX_SERIAL_MODES "OFF\0 ""S-Port Mirror\0 ""Telemetry\0 ""SBUS Trainer\0 ""LUA\0 ""CLI\0 " -#endif +#define TR_AUX_SERIAL_MODES "OFF\0 ""S-Port Mirror\0 ""Telemetry\0 ""SBUS Trainer\0 ""LUA\0 ""CLI\0 ""GPS\0 ""Debug\0 " #define LEN_SWTYPES "\006" #define TR_SWTYPES "None\0 ""Toggle""2POS\0 ""3POS\0" diff --git a/radio/src/translations/se.h.txt b/radio/src/translations/se.h.txt index e5bd294f7..eef3bcbf7 100644 --- a/radio/src/translations/se.h.txt +++ b/radio/src/translations/se.h.txt @@ -68,11 +68,7 @@ #define TR_TRNCHN "KN1KN2KN3KN4" #define LEN_AUX_SERIAL_MODES "\022" -#if defined(CLI) || defined(DEBUG) -#define TR_AUX_SERIAL_MODES "Debug\0 ""Spegling av S-Port""Telemetri\0 ""SBUS Trainer\0 ""LUA\0 ""CLI\0 " -#else -#define TR_AUX_SERIAL_MODES "Av\0 ""Spegling av S-Port""Telemetri\0 ""SBUS Trainer\0 ""LUA\0 ""CLI\0 " -#endif +#define TR_AUX_SERIAL_MODES "Av\0 ""Spegling av S-Port""Telemetri\0 ""SBUS Trainer\0 ""LUA\0 ""CLI\0 ""GPS\0 ""Debug\0 " #define LEN_SWTYPES "\006" #define TR_SWTYPES "Ingen\0""Flipp\0""2Pos\0 ""3Pos\0"