Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: SF Audio amplifier mute - 2.9 edition #3741

Merged
merged 9 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions companion/src/firmwares/customfunctiondata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ QString CustomFunctionData::funcToString(const AssignFunc func, const ModelData
return tr("Disable Touch");
else if (func == FuncSetScreen)
return tr("Set Main Screen");
else if (func == FuncDisableAudioAmp)
return tr("Audio Amp Off");
else {
return QString(CPN_STR_UNKNOWN_ITEM);
}
Expand Down Expand Up @@ -255,7 +257,8 @@ bool CustomFunctionData::isFuncAvailable(const int index)
((index >= FuncRangeCheckInternalModule && index <= FuncBindExternalModule) && !fw->getCapability(DangerousFunctions)) ||
((index >= FuncAdjustGV1 && index <= FuncAdjustGVLast) && !fw->getCapability(Gvars)) ||
((index == FuncDisableTouch) && !IS_HORUS_OR_TARANIS(fw->getBoard())) ||
((index == FuncSetScreen && !Boards::getCapability(fw->getBoard(), Board::HasColorLcd)))
((index == FuncSetScreen && !Boards::getCapability(fw->getBoard(), Board::HasColorLcd)) ||
((index == FuncDisableAudioAmp && !Boards::getCapability(fw->getBoard(), Board::HasAudioMuteGPIO))))
);
return !ret;
}
Expand Down Expand Up @@ -469,7 +472,8 @@ bool CustomFunctionData::isParamAvailable() const
FuncBindInternalModule,
FuncBindExternalModule,
FuncRacingMode,
FuncDisableTouch
FuncDisableTouch,
FuncDisableAudioAmp
};

return funcList.contains(func) ? false : true;
Expand Down
1 change: 1 addition & 0 deletions companion/src/firmwares/customfunctiondata.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ enum AssignFunc {
FuncRacingMode,
FuncDisableTouch,
FuncSetScreen,
FuncDisableAudioAmp,
FuncCount,
FuncReserve = -1
};
Expand Down
1 change: 1 addition & 0 deletions companion/src/firmwares/edgetx/yaml_customfunctiondata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ static const YamlLookupTable customFnLut = {
{ FuncRacingMode, "RACING_MODE" },
{ FuncDisableTouch, "DISABLE_TOUCH" },
{ FuncSetScreen, "SET_SCREEN"},
{ FuncDisableAudioAmp, "DISABLE_AUDIO_AMP" },
};

static const YamlLookupTable trainerLut = {
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 @@ -2059,6 +2059,11 @@ Do you want to import settings from a file?</source>
<source>Set Main Screen</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="129"/>
<source>Audio Amp Off</source>
<translation>Vypnutí zesilovače zvuku</translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="216"/>
<source>Played once, not during startup</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 @@ -1796,6 +1796,11 @@ Vil du indlæse indstillinger fra en fil?</translation>
<source>Set Main Screen</source>
<translation>Indstil hoved billede</translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="129"/>
<source>Audio Amp Off</source>
<translation>Sluk audio amplifier</translation>
</message>
<message>
<source>Value</source>
<translation>Værdi</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 @@ -2064,6 +2064,11 @@ Do you want to import settings from a file?</source>
<source>Set Main Screen</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="129"/>
<source>Audio Amp Off</source>
<translation>Audio Amp AUS</translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="216"/>
<source>Played once, not during startup</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 @@ -2037,6 +2037,11 @@ Do you want to import settings from a file?</source>
<source>Set Main Screen</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="129"/>
<source>Audio Amp Off</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="216"/>
<source>Played once, not during startup</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 @@ -2064,6 +2064,11 @@ Do you want to import settings from a file?</source>
<source>Set Main Screen</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="129"/>
<source>Audio Amp Off</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="216"/>
<source>Played once, not during startup</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 @@ -2060,6 +2060,11 @@ Do you want to import settings from a file?</source>
<source>Set Main Screen</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="129"/>
<source>Audio Amp Off</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="216"/>
<source>Played once, not during startup</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 @@ -2079,6 +2079,11 @@ Voulez-vous importer les paramètres depuis un fichier?</translation>
<source>Set Main Screen</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="129"/>
<source>Audio Amp Off</source>
<translation>Désact. Ampli Audio</translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="216"/>
<source>!1x</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 @@ -2107,6 +2107,11 @@ Do you want to import settings from a file?</source>
<source>Set Main Screen</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="129"/>
<source>Audio Amp Off</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="143"/>
<source>s</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 @@ -2057,6 +2057,11 @@ Do you want to import settings from a file?</source>
<source>Set Main Screen</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="129"/>
<source>Audio Amp Off</source>
<translation>Amplificatore audio off</translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="216"/>
<source>Played once, not during startup</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 @@ -2051,6 +2051,11 @@ Do you want to import settings from a file?</source>
<source>Set Main Screen</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="129"/>
<source>Audio Amp Off</source>
<translation>オーディオアンプ OFF</translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="216"/>
<source>!1x</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 @@ -2107,6 +2107,11 @@ Do you want to import settings from a file?</source>
<source>Set Main Screen</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="129"/>
<source>Audio Amp Off</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="143"/>
<source>s</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 @@ -2041,6 +2041,11 @@ Do you want to import settings from a file?</source>
<source>Set Main Screen</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="129"/>
<source>Audio Amp Off</source>
<translation>Wycisz wzmacniacz audio</translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="216"/>
<source>Played once, not during startup</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 @@ -2107,6 +2107,11 @@ Do you want to import settings from a file?</source>
<source>Set Main Screen</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="129"/>
<source>Audio Amp Off</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="143"/>
<source>s</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 @@ -2060,6 +2060,11 @@ Do you want to import settings from a file?</source>
<source>Set Main Screen</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="129"/>
<source>Audio Amp Off</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="216"/>
<source>Played once, not during startup</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 @@ -1796,6 +1796,11 @@ Vill du hämta inställningarna från en fil?</translation>
<source>Set Main Screen</source>
<translation>Ställ in huvudskärm</translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="129"/>
<source>Audio Amp Off</source>
<translation>Audioförstärkare av</translation>
</message>
<message>
<source>Value</source>
<translation>Värde</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 @@ -2065,6 +2065,11 @@ Do you want to import settings from a file?</source>
<source>Disable Touch</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="129"/>
<source>Audio Amp Off</source>
<translation>"关闭音频功放"</translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="127"/>
<source>Set Main Screen</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 @@ -2070,6 +2070,11 @@ Do you want to import settings from a file?</source>
<source>Set Main Screen</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="129"/>
<source>Audio Amp Off</source>
<translation>關閉音頻功放</translation>
</message>
<message>
<location filename="../firmwares/customfunctiondata.cpp" line="216"/>
<source>Played once, not during startup</source>
Expand Down
3 changes: 3 additions & 0 deletions radio/src/dataconstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,9 @@ enum Functions {
FUNC_DISABLE_TOUCH,
FUNC_SET_SCREEN,
#endif
#if defined(AUDIO_MUTE_GPIO)
FUNC_DISABLE_AUDIO_AMP,
#endif
#if defined(DEBUG)
FUNC_TEST, // should remain the last before MAX as not added in Companion
#endif
Expand Down
5 changes: 5 additions & 0 deletions radio/src/functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,11 @@ void evalFunctions(const CustomFunctionData * functions, CustomFunctionsContext
newActiveFunctions |= (1u << FUNCTION_DISABLE_TOUCH);
break;
#endif
#if defined(AUDIO_MUTE_GPIO)
case FUNC_DISABLE_AUDIO_AMP:
newActiveFunctions |= (1u << FUNC_DISABLE_AUDIO_AMP);
break;
#endif
#if defined(COLORLCD)
case FUNC_SET_SCREEN:
if (isRepeatDelayElapsed(functions, functionsContext, i)) {
Expand Down
1 change: 1 addition & 0 deletions radio/src/storage/yaml/yaml_datastructs_boxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const struct YamlIdStr enum_Functions[] = {
{ FUNC_BACKLIGHT, "BACKLIGHT" },
{ FUNC_SCREENSHOT, "SCREENSHOT" },
{ FUNC_RACING_MODE, "RACING_MODE" },
{ FUNC_DISABLE_AUDIO_AMP, "DISABLE_AUDIO_AMP" },
{ 0, NULL }
};
const struct YamlIdStr enum_TimerModes[] = {
Expand Down
1 change: 1 addition & 0 deletions radio/src/storage/yaml/yaml_datastructs_lr3pro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const struct YamlIdStr enum_Functions[] = {
{ FUNC_BACKLIGHT, "BACKLIGHT" },
{ FUNC_SCREENSHOT, "SCREENSHOT" },
{ FUNC_RACING_MODE, "RACING_MODE" },
{ FUNC_DISABLE_AUDIO_AMP, "DISABLE_AUDIO_AMP" },
{ 0, NULL }
};
const struct YamlIdStr enum_TimerModes[] = {
Expand Down
1 change: 1 addition & 0 deletions radio/src/storage/yaml/yaml_datastructs_nv14.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const struct YamlIdStr enum_Functions[] = {
{ FUNC_RACING_MODE, "RACING_MODE" },
{ FUNC_DISABLE_TOUCH, "DISABLE_TOUCH" },
{ FUNC_SET_SCREEN, "SET_SCREEN" },
{ FUNC_DISABLE_AUDIO_AMP, "DISABLE_AUDIO_AMP" },
{ 0, NULL }
};
const struct YamlIdStr enum_ZoneOptionValueEnum[] = {
Expand Down
1 change: 1 addition & 0 deletions radio/src/storage/yaml/yaml_datastructs_t8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const struct YamlIdStr enum_Functions[] = {
{ FUNC_BACKLIGHT, "BACKLIGHT" },
{ FUNC_SCREENSHOT, "SCREENSHOT" },
{ FUNC_RACING_MODE, "RACING_MODE" },
{ FUNC_DISABLE_AUDIO_AMP, "DISABLE_AUDIO_AMP" },
{ 0, NULL }
};
const struct YamlIdStr enum_TimerModes[] = {
Expand Down
1 change: 1 addition & 0 deletions radio/src/storage/yaml/yaml_datastructs_tlite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const struct YamlIdStr enum_Functions[] = {
{ FUNC_BACKLIGHT, "BACKLIGHT" },
{ FUNC_SCREENSHOT, "SCREENSHOT" },
{ FUNC_RACING_MODE, "RACING_MODE" },
{ FUNC_DISABLE_AUDIO_AMP, "DISABLE_AUDIO_AMP" },
{ 0, NULL }
};
const struct YamlIdStr enum_TimerModes[] = {
Expand Down
1 change: 1 addition & 0 deletions radio/src/storage/yaml/yaml_datastructs_tpro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const struct YamlIdStr enum_Functions[] = {
{ FUNC_BACKLIGHT, "BACKLIGHT" },
{ FUNC_SCREENSHOT, "SCREENSHOT" },
{ FUNC_RACING_MODE, "RACING_MODE" },
{ FUNC_DISABLE_AUDIO_AMP, "DISABLE_AUDIO_AMP" },
{ 0, NULL }
};
const struct YamlIdStr enum_TimerModes[] = {
Expand Down
1 change: 1 addition & 0 deletions radio/src/storage/yaml/yaml_datastructs_tx12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const struct YamlIdStr enum_Functions[] = {
{ FUNC_BACKLIGHT, "BACKLIGHT" },
{ FUNC_SCREENSHOT, "SCREENSHOT" },
{ FUNC_RACING_MODE, "RACING_MODE" },
{ FUNC_DISABLE_AUDIO_AMP, "DISABLE_AUDIO_AMP" },
{ 0, NULL }
};
const struct YamlIdStr enum_TimerModes[] = {
Expand Down
1 change: 1 addition & 0 deletions radio/src/storage/yaml/yaml_datastructs_tx12mk2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const struct YamlIdStr enum_Functions[] = {
{ FUNC_BACKLIGHT, "BACKLIGHT" },
{ FUNC_SCREENSHOT, "SCREENSHOT" },
{ FUNC_RACING_MODE, "RACING_MODE" },
{ FUNC_DISABLE_AUDIO_AMP, "DISABLE_AUDIO_AMP" },
{ 0, NULL }
};
const struct YamlIdStr enum_TimerModes[] = {
Expand Down
1 change: 1 addition & 0 deletions radio/src/storage/yaml/yaml_datastructs_x10.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const struct YamlIdStr enum_Functions[] = {
{ FUNC_RACING_MODE, "RACING_MODE" },
{ FUNC_DISABLE_TOUCH, "DISABLE_TOUCH" },
{ FUNC_SET_SCREEN, "SET_SCREEN" },
{ FUNC_DISABLE_AUDIO_AMP, "DISABLE_AUDIO_AMP" },
{ 0, NULL }
};
const struct YamlIdStr enum_ZoneOptionValueEnum[] = {
Expand Down
1 change: 1 addition & 0 deletions radio/src/storage/yaml/yaml_datastructs_zorro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const struct YamlIdStr enum_Functions[] = {
{ FUNC_BACKLIGHT, "BACKLIGHT" },
{ FUNC_SCREENSHOT, "SCREENSHOT" },
{ FUNC_RACING_MODE, "RACING_MODE" },
{ FUNC_DISABLE_AUDIO_AMP, "DISABLE_AUDIO_AMP" },
{ 0, NULL }
};
const struct YamlIdStr enum_TimerModes[] = {
Expand Down
5 changes: 5 additions & 0 deletions radio/src/targets/common/arm/stm32/audio_dac_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ void audioMute()

void audioUnmute()
{
if(isFunctionActive(FUNC_DISABLE_AUDIO_AMP)) {
setMutePin(true);
return;
}

#if defined(AUDIO_UNMUTE_DELAY)
// if muted
if (getMutePin()) {
Expand Down
5 changes: 5 additions & 0 deletions radio/src/targets/nv14/audio_spi_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,11 @@ void audioMute()

void audioUnmute()
{
if(isFunctionActive(FUNC_DISABLE_AUDIO_AMP)) {
setMutePin(true);
return;
}

#if defined(AUDIO_UNMUTE_DELAY)
// if muted
if (getMutePin()) {
Expand Down
3 changes: 2 additions & 1 deletion radio/src/translations/cn.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,11 @@
#define TR_SF_SCREENSHOT "截屏"
#define TR_SF_RACING_MODE "竞速模式"
#define TR_SF_DISABLE_TOUCH "禁用触摸"
#define TR_SF_DISABLE_AUDIO_AMP "关闭音频功放"
#define TR_SF_SET_SCREEN "选择主屏"
#define TR_SF_RESERVE "[保留]"

#define TR_VFSWFUNC TR_SF_SAFETY,"教练","摇杆值存储到微调","复位","设置",TR_ADJUST_GVAR,"音量","设置失控保护","测距模式","模块对频",TR_SOUND,TR_PLAY_TRACK,TR_PLAY_VALUE,TR_SF_RESERVE,TR_SF_PLAY_SCRIPT,TR_SF_RESERVE,TR_SF_BG_MUSIC,TR_VVARIO,TR_HAPTIC,TR_SDCLOGS,"背光",TR_SF_SCREENSHOT,TR_SF_RACING_MODE,TR_SF_DISABLE_TOUCH,TR_SF_SET_SCREEN TR_SF_TEST
#define TR_VFSWFUNC TR_SF_SAFETY,"教练","摇杆值存储到微调","复位","设置",TR_ADJUST_GVAR,"音量","设置失控保护","测距模式","模块对频",TR_SOUND,TR_PLAY_TRACK,TR_PLAY_VALUE,TR_SF_RESERVE,TR_SF_PLAY_SCRIPT,TR_SF_RESERVE,TR_SF_BG_MUSIC,TR_VVARIO,TR_HAPTIC,TR_SDCLOGS,"背光",TR_SF_SCREENSHOT,TR_SF_RACING_MODE,TR_SF_DISABLE_TOUCH,TR_SF_SET_SCREEN, TR_SF_DISABLE_AUDIO_AMP TR_SF_TEST

#define TR_FSW_RESET_TELEM "回传参数"

Expand Down
Loading