Skip to content

Commit

Permalink
feat(cpn): User configurable audio mute in radio settings (#3735)
Browse files Browse the repository at this point in the history
* 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

* chore: Add Companion translations

---------

Co-authored-by: Michael <mha1@users.noreply.github.com>
  • Loading branch information
pfeerick and mha1 authored Jul 1, 2023
1 parent 461dcc9 commit 632eceb
Show file tree
Hide file tree
Showing 22 changed files with 102 additions and 0 deletions.
5 changes: 5 additions & 0 deletions companion/src/firmwares/boards.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
1 change: 1 addition & 0 deletions companion/src/firmwares/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ namespace Board {
HasSDCard,
HasInternalModuleSupport,
HasExternalModuleSupport,
HasAudioMuteGPIO,
SportMaxBaudRate
};

Expand Down
2 changes: 2 additions & 0 deletions companion/src/firmwares/edgetx/yaml_generalsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ Node convert<GeneralSettings>::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;
Expand Down Expand Up @@ -428,6 +429,7 @@ bool convert<GeneralSettings>::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
Expand Down
1 change: 1 addition & 0 deletions companion/src/firmwares/generalsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ class GeneralSettings {
unsigned int countryCode;
bool noJitterFilter;
bool rtcCheckDisable;
bool muteIfNoSound;
bool keysBacklight;
unsigned int rotEncMode;
unsigned int imperial;
Expand Down
8 changes: 8 additions & 0 deletions companion/src/generaledit/hardware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"));

Expand Down
5 changes: 5 additions & 0 deletions companion/src/translations/companion_cs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6196,6 +6196,11 @@ Are you sure ?</source>
<source>ADC Filter</source>
<translation type="unfinished">ADC filtr</translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="178"/>
<source>Mute if no sound</source>
<translation>Ztlumení, pokud není slyšet zvuk</translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="198"/>
<source>Internal RF</source>
Expand Down
5 changes: 5 additions & 0 deletions companion/src/translations/companion_da.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4983,6 +4983,11 @@ Er du sikker?</translation>
<source>ADC Filter</source>
<translation>ADC-filter</translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="178"/>
<source>Mute if no sound</source>
<translation>Audio fra, hvis der ikke gives lyd</translation>
</message>
<message>
<source>S.Port Power</source>
<translation>S.Port spænding</translation>
Expand Down
5 changes: 5 additions & 0 deletions companion/src/translations/companion_de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6179,6 +6179,11 @@ Sind Sie sicher?</translation>
<source>ADC Filter</source>
<translation type="unfinished">ADC-Filter</translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="178"/>
<source>Mute if no sound</source>
<translation>Geräuschunterdrückung</translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="198"/>
<source>Internal RF</source>
Expand Down
5 changes: 5 additions & 0 deletions companion/src/translations/companion_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6103,6 +6103,11 @@ Are you sure ?</source>
<source>ADC Filter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="178"/>
<source>Mute if no sound</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="198"/>
<source>Internal RF</source>
Expand Down
5 changes: 5 additions & 0 deletions companion/src/translations/companion_es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6247,6 +6247,11 @@ Esta función no puede ser deshabilitada en la radio.
<source>ADC Filter</source>
<translation type="unfinished">Filtro ADC</translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="178"/>
<source>Mute if no sound</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="198"/>
<source>Internal RF</source>
Expand Down
5 changes: 5 additions & 0 deletions companion/src/translations/companion_fi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6234,6 +6234,11 @@ Are you sure ?</source>
<source>ADC Filter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="178"/>
<source>Mute if no sound</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="198"/>
<source>Internal RF</source>
Expand Down
5 changes: 5 additions & 0 deletions companion/src/translations/companion_fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6246,6 +6246,11 @@ Cette fonction ne peut pas être désactivée sur la radio.
<source>ADC Filter</source>
<translation type="unfinished">Filtre ADC</translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="178"/>
<source>Mute if no sound</source>
<translation>Muet si pas de son</translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="198"/>
<source>Internal RF</source>
Expand Down
5 changes: 5 additions & 0 deletions companion/src/translations/companion_he.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6103,6 +6103,11 @@ Are you sure ?</source>
<source>ADC Filter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="178"/>
<source>Mute if no sound</source>
<translation>השתקת קול</translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="198"/>
<source>Internal RF</source>
Expand Down
5 changes: 5 additions & 0 deletions companion/src/translations/companion_it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6229,6 +6229,11 @@ Are you sure ?</source>
<source>ADC Filter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="178"/>
<source>Mute if no sound</source>
<translation>Muto senza suono</translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="198"/>
<source>Internal RF</source>
Expand Down
5 changes: 5 additions & 0 deletions companion/src/translations/companion_ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6231,6 +6231,11 @@ Are you sure ?</source>
<source>ADC Filter</source>
<translation type="unfinished">ADCフィルター</translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="178"/>
<source>Mute if no sound</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="198"/>
<source>Internal RF</source>
Expand Down
5 changes: 5 additions & 0 deletions companion/src/translations/companion_nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6103,6 +6103,11 @@ Are you sure ?</source>
<source>ADC Filter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="178"/>
<source>Mute if no sound</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="198"/>
<source>Internal RF</source>
Expand Down
5 changes: 5 additions & 0 deletions companion/src/translations/companion_pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6216,6 +6216,11 @@ Are you sure ?</source>
<source>ADC Filter</source>
<translation type="unfinished">Filtr ADC</translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="178"/>
<source>Mute if no sound</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="198"/>
<source>Internal RF</source>
Expand Down
5 changes: 5 additions & 0 deletions companion/src/translations/companion_pt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6103,6 +6103,11 @@ Are you sure ?</source>
<source>ADC Filter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="178"/>
<source>Mute if no sound</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="198"/>
<source>Internal RF</source>
Expand Down
5 changes: 5 additions & 0 deletions companion/src/translations/companion_ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6167,6 +6167,11 @@ Are you sure ?</source>
<source>ADC Filter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="178"/>
<source>Mute if no sound</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="198"/>
<source>Internal RF</source>
Expand Down
5 changes: 5 additions & 0 deletions companion/src/translations/companion_sv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4983,6 +4983,11 @@ att fungera. Detta går inte att ändra från radion.
<source>ADC Filter</source>
<translation>ADC-filter</translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="178"/>
<source>Mute if no sound</source>
<translation>Audio av om inget ljud</translation>
</message>
<message>
<source>S.Port Power</source>
<translation>S.Port strömkälla</translation>
Expand Down
5 changes: 5 additions & 0 deletions companion/src/translations/companion_zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6293,6 +6293,11 @@ Are you sure ?</source>
<source>ADC Filter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="178"/>
<source>Mute if no sound</source>
<translation>音频停播时自动静音</translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="198"/>
<source>Internal RF</source>
Expand Down
5 changes: 5 additions & 0 deletions companion/src/translations/companion_zh_TW.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6293,6 +6293,11 @@ Are you sure ?</source>
<source>ADC Filter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="178"/>
<source>Mute if no sound</source>
<translation>音頻停播時自動靜音</translation>
</message>
<message>
<location filename="../generaledit/hardware.cpp" line="198"/>
<source>Internal RF</source>
Expand Down

0 comments on commit 632eceb

Please sign in to comment.