From 42df4d072c429293d304c407a7ac08ac7e8cc423 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 26 Jun 2023 11:04:32 +0200 Subject: [PATCH] feat(cpn): User configurable audio mute in radio settings (#3710) * CPN: user configurable audio mute in radio settings. Supports PR #3703 * make checkbox only visible for radios with AUDIO_MUTE_GPIO pin: - All color lcd radios (including NV14) except Horus X12S - TX12, TX12MK2, ZORRO, BOXER, T8, TLITE, TPRO, LR3PRO, COMMANDO8 --- companion/src/firmwares/boards.cpp | 5 +++++ companion/src/firmwares/boards.h | 1 + companion/src/firmwares/edgetx/yaml_generalsettings.cpp | 2 ++ companion/src/firmwares/generalsettings.h | 1 + companion/src/generaledit/hardware.cpp | 8 ++++++++ companion/src/translations/companion_cs.ts | 5 +++++ companion/src/translations/companion_da.ts | 5 +++++ companion/src/translations/companion_de.ts | 5 +++++ companion/src/translations/companion_en.ts | 5 +++++ companion/src/translations/companion_es.ts | 5 +++++ companion/src/translations/companion_fi.ts | 5 +++++ companion/src/translations/companion_fr.ts | 5 +++++ companion/src/translations/companion_he.ts | 5 +++++ companion/src/translations/companion_it.ts | 5 +++++ companion/src/translations/companion_ja.ts | 5 +++++ companion/src/translations/companion_nl.ts | 5 +++++ companion/src/translations/companion_pl.ts | 5 +++++ companion/src/translations/companion_pt.ts | 5 +++++ companion/src/translations/companion_ru.ts | 5 +++++ companion/src/translations/companion_sv.ts | 5 +++++ companion/src/translations/companion_zh_CN.ts | 5 +++++ companion/src/translations/companion_zh_TW.ts | 5 +++++ 22 files changed, 102 insertions(+) diff --git a/companion/src/firmwares/boards.cpp b/companion/src/firmwares/boards.cpp index f0d0e5c5809..d969c8dd77e 100644 --- a/companion/src/firmwares/boards.cpp +++ b/companion/src/firmwares/boards.cpp @@ -561,6 +561,11 @@ int Boards::getCapability(Board::Type board, Board::Capability capability) case HasExternalModuleSupport: return (IS_STM32(board) && !IS_RADIOMASTER_T8(board)); + case HasAudioMuteGPIO: + // All color lcd (including NV14) except Horus X12S + // TX12, TX12MK2, ZORRO, BOXER, T8, TLITE, TPRO, LR3PRO, COMMANDO8 + return (IS_FAMILY_HORUS_OR_T16(board) && !IS_HORUS_X12S(board)) || IS_FAMILY_T12(board); + case SportMaxBaudRate: if (IS_FAMILY_T16(board) || IS_FLYSKY_NV14(board) || IS_TARANIS_X7_ACCESS(board) || (IS_TARANIS(board) && !IS_TARANIS_XLITE(board) && !IS_TARANIS_X7(board) && !IS_TARANIS_X9LITE(board))) diff --git a/companion/src/firmwares/boards.h b/companion/src/firmwares/boards.h index 85f0ab863d2..48e29a0bd3b 100644 --- a/companion/src/firmwares/boards.h +++ b/companion/src/firmwares/boards.h @@ -156,6 +156,7 @@ namespace Board { HasSDCard, HasInternalModuleSupport, HasExternalModuleSupport, + HasAudioMuteGPIO, SportMaxBaudRate }; diff --git a/companion/src/firmwares/edgetx/yaml_generalsettings.cpp b/companion/src/firmwares/edgetx/yaml_generalsettings.cpp index 5d241edfa6a..439f45aa351 100644 --- a/companion/src/firmwares/edgetx/yaml_generalsettings.cpp +++ b/companion/src/firmwares/edgetx/yaml_generalsettings.cpp @@ -210,6 +210,7 @@ Node convert::encode(const GeneralSettings& rhs) node["countryCode"] = rhs.countryCode; node["noJitterFilter"] = (int)rhs.noJitterFilter; node["disableRtcWarning"] = (int)rhs.rtcCheckDisable; // TODO: verify + node["audioMuteEnable"] = (int)rhs.muteIfNoSound; node["keysBacklight"] = (int)rhs.keysBacklight; node["rotEncMode"] = (int)rhs.rotEncMode; node["imperial"] = rhs.imperial; @@ -428,6 +429,7 @@ bool convert::decode(const Node& node, GeneralSettings& rhs) node["jitterFilter"] >> rhs.noJitterFilter; // PR1363 : read old name and node["noJitterFilter"] >> rhs.noJitterFilter; // new, but don't write old node["disableRtcWarning"] >> rhs.rtcCheckDisable; // TODO: verify + node["audioMuteEnable"] >> rhs.muteIfNoSound; node["keysBacklight"] >> rhs.keysBacklight; node["rotEncDirection"] >> rhs.rotEncMode; // PR2045: read old name and node["rotEncMode"] >> rhs.rotEncMode; // new, but don't write old diff --git a/companion/src/firmwares/generalsettings.h b/companion/src/firmwares/generalsettings.h index c11b2a5c4cf..1bedd3df96b 100644 --- a/companion/src/firmwares/generalsettings.h +++ b/companion/src/firmwares/generalsettings.h @@ -247,6 +247,7 @@ class GeneralSettings { unsigned int countryCode; bool noJitterFilter; bool rtcCheckDisable; + bool muteIfNoSound; bool keysBacklight; unsigned int rotEncMode; unsigned int imperial; diff --git a/companion/src/generaledit/hardware.cpp b/companion/src/generaledit/hardware.cpp index f6cae2539bc..ac778ee7d93 100644 --- a/companion/src/generaledit/hardware.cpp +++ b/companion/src/generaledit/hardware.cpp @@ -174,6 +174,14 @@ HardwarePanel::HardwarePanel(QWidget * parent, GeneralSettings & generalSettings addParams(); } + if (Boards::getCapability(board, Board::HasAudioMuteGPIO)) { + addLabel(tr("Mute if no sound")); + AutoCheckBox *muteIfNoSound = new AutoCheckBox(this); + muteIfNoSound->setField(generalSettings.muteIfNoSound, this, false); + params->append(muteIfNoSound); + addParams(); + } + if (firmware->getCapability(HasBluetooth)) { addLabel(tr("Bluetooth")); diff --git a/companion/src/translations/companion_cs.ts b/companion/src/translations/companion_cs.ts index 03ed46e1286..bb602574fd7 100644 --- a/companion/src/translations/companion_cs.ts +++ b/companion/src/translations/companion_cs.ts @@ -6196,6 +6196,11 @@ Are you sure ? ADC Filter ADC filtr + + + Mute if no sound + + Internal RF diff --git a/companion/src/translations/companion_da.ts b/companion/src/translations/companion_da.ts index b49ca8b9839..50e4ce3b6a1 100644 --- a/companion/src/translations/companion_da.ts +++ b/companion/src/translations/companion_da.ts @@ -4983,6 +4983,11 @@ Er du sikker? ADC Filter ADC-filter + + + Mute if no sound + + S.Port Power S.Port spænding diff --git a/companion/src/translations/companion_de.ts b/companion/src/translations/companion_de.ts index eaa9115a5f3..dd1fb5f639b 100644 --- a/companion/src/translations/companion_de.ts +++ b/companion/src/translations/companion_de.ts @@ -6179,6 +6179,11 @@ Sind Sie sicher? ADC Filter ADC-Filter + + + Mute if no sound + + Internal RF diff --git a/companion/src/translations/companion_en.ts b/companion/src/translations/companion_en.ts index 4f0129c8f4f..7a1a4012bb1 100644 --- a/companion/src/translations/companion_en.ts +++ b/companion/src/translations/companion_en.ts @@ -6103,6 +6103,11 @@ Are you sure ? ADC Filter + + + Mute if no sound + + Internal RF diff --git a/companion/src/translations/companion_es.ts b/companion/src/translations/companion_es.ts index c4978b75f45..658695c07c2 100644 --- a/companion/src/translations/companion_es.ts +++ b/companion/src/translations/companion_es.ts @@ -6247,6 +6247,11 @@ Esta función no puede ser deshabilitada en la radio. ADC Filter Filtro ADC + + + Mute if no sound + + Internal RF diff --git a/companion/src/translations/companion_fi.ts b/companion/src/translations/companion_fi.ts index baa56afdc4a..269ab404682 100644 --- a/companion/src/translations/companion_fi.ts +++ b/companion/src/translations/companion_fi.ts @@ -6234,6 +6234,11 @@ Are you sure ? ADC Filter + + + Mute if no sound + + Internal RF diff --git a/companion/src/translations/companion_fr.ts b/companion/src/translations/companion_fr.ts index 189ecd2e608..ebb8ef110a6 100644 --- a/companion/src/translations/companion_fr.ts +++ b/companion/src/translations/companion_fr.ts @@ -6246,6 +6246,11 @@ Cette fonction ne peut pas être désactivée sur la radio. ADC Filter Filtre ADC + + + Mute if no sound + + Internal RF diff --git a/companion/src/translations/companion_he.ts b/companion/src/translations/companion_he.ts index 3b53e8fe065..6915d32a83e 100644 --- a/companion/src/translations/companion_he.ts +++ b/companion/src/translations/companion_he.ts @@ -6103,6 +6103,11 @@ Are you sure ? ADC Filter + + + Mute if no sound + + Internal RF diff --git a/companion/src/translations/companion_it.ts b/companion/src/translations/companion_it.ts index bcb80c713fb..b06f83e97cb 100644 --- a/companion/src/translations/companion_it.ts +++ b/companion/src/translations/companion_it.ts @@ -6229,6 +6229,11 @@ Are you sure ? ADC Filter + + + Mute if no sound + + Internal RF diff --git a/companion/src/translations/companion_ja.ts b/companion/src/translations/companion_ja.ts index d3e9c9940dc..efb3ce32925 100644 --- a/companion/src/translations/companion_ja.ts +++ b/companion/src/translations/companion_ja.ts @@ -6231,6 +6231,11 @@ Are you sure ? ADC Filter ADCフィルター + + + Mute if no sound + + Internal RF diff --git a/companion/src/translations/companion_nl.ts b/companion/src/translations/companion_nl.ts index 58df6b7fcaa..7ea689ba297 100644 --- a/companion/src/translations/companion_nl.ts +++ b/companion/src/translations/companion_nl.ts @@ -6103,6 +6103,11 @@ Are you sure ? ADC Filter + + + Mute if no sound + + Internal RF diff --git a/companion/src/translations/companion_pl.ts b/companion/src/translations/companion_pl.ts index 2256b60fb6f..27d2cba96d7 100644 --- a/companion/src/translations/companion_pl.ts +++ b/companion/src/translations/companion_pl.ts @@ -6216,6 +6216,11 @@ Are you sure ? ADC Filter Filtr ADC + + + Mute if no sound + + Internal RF diff --git a/companion/src/translations/companion_pt.ts b/companion/src/translations/companion_pt.ts index 534ccc4d45c..00447e0a866 100644 --- a/companion/src/translations/companion_pt.ts +++ b/companion/src/translations/companion_pt.ts @@ -6103,6 +6103,11 @@ Are you sure ? ADC Filter + + + Mute if no sound + + Internal RF diff --git a/companion/src/translations/companion_ru.ts b/companion/src/translations/companion_ru.ts index 2fbf1a8ae0e..251181620ba 100644 --- a/companion/src/translations/companion_ru.ts +++ b/companion/src/translations/companion_ru.ts @@ -6167,6 +6167,11 @@ Are you sure ? ADC Filter + + + Mute if no sound + + Internal RF diff --git a/companion/src/translations/companion_sv.ts b/companion/src/translations/companion_sv.ts index 047eb66ecbf..7b957760a50 100644 --- a/companion/src/translations/companion_sv.ts +++ b/companion/src/translations/companion_sv.ts @@ -4983,6 +4983,11 @@ att fungera. Detta går inte att ändra från radion. ADC Filter ADC-filter + + + Mute if no sound + + S.Port Power S.Port strömkälla diff --git a/companion/src/translations/companion_zh_CN.ts b/companion/src/translations/companion_zh_CN.ts index 22a67752b44..ae67202ad56 100644 --- a/companion/src/translations/companion_zh_CN.ts +++ b/companion/src/translations/companion_zh_CN.ts @@ -6293,6 +6293,11 @@ Are you sure ? ADC Filter + + + Mute if no sound + + Internal RF diff --git a/companion/src/translations/companion_zh_TW.ts b/companion/src/translations/companion_zh_TW.ts index fc2c953119c..200c2a9887f 100644 --- a/companion/src/translations/companion_zh_TW.ts +++ b/companion/src/translations/companion_zh_TW.ts @@ -6293,6 +6293,11 @@ Are you sure ? ADC Filter + + + Mute if no sound + + Internal RF