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

feat: User configurable audio mute #3703

Merged
merged 8 commits into from
Jun 26, 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
6 changes: 6 additions & 0 deletions radio/src/datastructs_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,7 @@ PACK(struct RadioData {
NOBACKUP(int8_t varioPitch CUST(r_vPitch,w_vPitch));
NOBACKUP(int8_t varioRange CUST(r_vPitch,w_vPitch));
NOBACKUP(int8_t varioRepeat);

CustomFunctionData customFn[MAX_SPECIAL_FUNCTIONS] FUNC(cfn_is_active);

CUST_ATTR(auxSerialMode, r_serialMode, nullptr);
Expand All @@ -962,7 +963,12 @@ PACK(struct RadioData {
#else
NOBACKUP(uint8_t stickDeadZoneSpare:3 SKIP);
#endif

#if defined(AUDIO_MUTE_GPIO)
NOBACKUP(uint8_t audioMuteEnable:1);
#else
NOBACKUP(uint8_t spare4:1 SKIP);
#endif

#if defined(IMU)
NOBACKUP(int8_t imuMax);
Expand Down
7 changes: 7 additions & 0 deletions radio/src/gui/colorlcd/radio_hardware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ void RadioHardwarePage::build(FormWindow * window)
new StaticText(line, rect_t{}, STR_JITTER_FILTER, 0, COLOR_THEME_PRIMARY1);
new CheckBox(line, rect_t{}, GET_SET_INVERTED(g_eeGeneral.noJitterFilter));

#if defined(AUDIO_MUTE_GPIO)
// Mute audio
line = window->newLine(&grid);
new StaticText(line, rect_t{}, STR_AUDIO_MUTE, 0, COLOR_THEME_PRIMARY1);
new CheckBox(line, rect_t{}, GET_SET_DEFAULT(g_eeGeneral.audioMuteEnable));
#endif

#if defined(HARDWARE_INTERNAL_MODULE)
new Subtitle(window, rect_t{}, STR_INTERNALRF, 0, COLOR_THEME_PRIMARY1);
auto intMod = new InternalModuleWindow(window);
Expand Down
17 changes: 17 additions & 0 deletions radio/src/gui/common/stdlcd/radio_hardware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ enum {
ITEM_RADIO_HARDWARE_CAPACITY_CALIB,
#endif

#if defined(AUDIO_MUTE_GPIO)
ITEM_RADIO_HARDWARE_AUDIO_MUTE,
#endif

#if !defined(PCBX9D) && !defined(PCBX9DP) && !defined(PCBX9E)
ITEM_RADIO_HARDWARE_LABEL_INTERNAL_MODULE,
ITEM_RADIO_HARDWARE_INTERNAL_MODULE_TYPE,
Expand Down Expand Up @@ -238,6 +242,12 @@ enum {
#define TX_CAPACITY_MEASUREMENT_ROWS
#endif

#if defined(AUDIO_MUTE_GPIO)
#define AUDIO_MUTE_ROW 0,
#else
#define AUDIO_MUTE_ROW
#endif

#if !defined(PCBX9D) && !defined(PCBX9DP) && !defined(PCBX9E)
#define INTERNAL_MODULE_ROWS \
LABEL(InternalModule), 0, \
Expand Down Expand Up @@ -314,6 +324,7 @@ void menuRadioHardware(event_t event)
0 /* battery calib */,
RTC_ROW
TX_CAPACITY_MEASUREMENT_ROWS
AUDIO_MUTE_ROW
INTERNAL_MODULE_ROWS
SERIAL_SAMPLE_MODE_ROWS
BLUETOOTH_ROWS
Expand Down Expand Up @@ -522,6 +533,12 @@ void menuRadioHardware(event_t event)
break;
#endif

#if defined(AUDIO_MUTE_GPIO)
case ITEM_RADIO_HARDWARE_AUDIO_MUTE:
g_eeGeneral.audioMuteEnable = editCheckBox(g_eeGeneral.audioMuteEnable, HW_SETTINGS_COLUMN2, y, STR_AUDIO_MUTE, attr, event);
break;
#endif

#if !defined(PCBX9D) && !defined(PCBX9DP) && !defined(PCBX9E)
case ITEM_RADIO_HARDWARE_LABEL_INTERNAL_MODULE:
lcdDrawTextAlignedLeft(y, STR_INTERNALRF);
Expand Down
2 changes: 1 addition & 1 deletion radio/src/storage/yaml/yaml_datastructs_boxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "rotEncMode", 2 ),
YAML_SIGNED( "uartSampleMode", 2 ),
YAML_PADDING( 3 ),
YAML_PADDING( 1 ),
YAML_UNSIGNED( "audioMuteEnable", 1 ),
YAML_UNSIGNED( "radioGFDisabled", 1 ),
YAML_UNSIGNED( "radioTrainerDisabled", 1 ),
YAML_UNSIGNED( "modelHeliDisabled", 1 ),
Expand Down
2 changes: 1 addition & 1 deletion radio/src/storage/yaml/yaml_datastructs_lr3pro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "rotEncMode", 2 ),
YAML_SIGNED( "uartSampleMode", 2 ),
YAML_PADDING( 3 ),
YAML_PADDING( 1 ),
YAML_UNSIGNED( "audioMuteEnable", 1 ),
YAML_UNSIGNED( "radioGFDisabled", 1 ),
YAML_UNSIGNED( "radioTrainerDisabled", 1 ),
YAML_UNSIGNED( "modelHeliDisabled", 1 ),
Expand Down
2 changes: 1 addition & 1 deletion radio/src/storage/yaml/yaml_datastructs_nv14.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "rotEncMode", 2 ),
YAML_SIGNED( "uartSampleMode", 2 ),
YAML_UNSIGNED( "stickDeadZone", 3 ),
YAML_PADDING( 1 ),
YAML_UNSIGNED( "audioMuteEnable", 1 ),
YAML_STRING("selectedTheme", 26),
YAML_UNSIGNED( "radioThemesDisabled", 1 ),
YAML_UNSIGNED( "radioGFDisabled", 1 ),
Expand Down
2 changes: 1 addition & 1 deletion radio/src/storage/yaml/yaml_datastructs_t8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "rotEncMode", 2 ),
YAML_SIGNED( "uartSampleMode", 2 ),
YAML_PADDING( 3 ),
YAML_PADDING( 1 ),
YAML_UNSIGNED( "audioMuteEnable", 1 ),
YAML_UNSIGNED( "radioGFDisabled", 1 ),
YAML_UNSIGNED( "radioTrainerDisabled", 1 ),
YAML_UNSIGNED( "modelHeliDisabled", 1 ),
Expand Down
2 changes: 1 addition & 1 deletion radio/src/storage/yaml/yaml_datastructs_tlite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "rotEncMode", 2 ),
YAML_SIGNED( "uartSampleMode", 2 ),
YAML_PADDING( 3 ),
YAML_PADDING( 1 ),
YAML_UNSIGNED( "audioMuteEnable", 1 ),
YAML_UNSIGNED( "radioGFDisabled", 1 ),
YAML_UNSIGNED( "radioTrainerDisabled", 1 ),
YAML_UNSIGNED( "modelHeliDisabled", 1 ),
Expand Down
2 changes: 1 addition & 1 deletion radio/src/storage/yaml/yaml_datastructs_tpro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "rotEncMode", 2 ),
YAML_SIGNED( "uartSampleMode", 2 ),
YAML_PADDING( 3 ),
YAML_PADDING( 1 ),
YAML_UNSIGNED( "audioMuteEnable", 1 ),
YAML_UNSIGNED( "radioGFDisabled", 1 ),
YAML_UNSIGNED( "radioTrainerDisabled", 1 ),
YAML_UNSIGNED( "modelHeliDisabled", 1 ),
Expand Down
2 changes: 1 addition & 1 deletion radio/src/storage/yaml/yaml_datastructs_tx12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "rotEncMode", 2 ),
YAML_SIGNED( "uartSampleMode", 2 ),
YAML_PADDING( 3 ),
YAML_PADDING( 1 ),
YAML_UNSIGNED( "audioMuteEnable", 1 ),
YAML_UNSIGNED( "radioGFDisabled", 1 ),
YAML_UNSIGNED( "radioTrainerDisabled", 1 ),
YAML_UNSIGNED( "modelHeliDisabled", 1 ),
Expand Down
2 changes: 1 addition & 1 deletion radio/src/storage/yaml/yaml_datastructs_tx12mk2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "rotEncMode", 2 ),
YAML_SIGNED( "uartSampleMode", 2 ),
YAML_PADDING( 3 ),
YAML_PADDING( 1 ),
YAML_UNSIGNED( "audioMuteEnable", 1 ),
YAML_UNSIGNED( "radioGFDisabled", 1 ),
YAML_UNSIGNED( "radioTrainerDisabled", 1 ),
YAML_UNSIGNED( "modelHeliDisabled", 1 ),
Expand Down
2 changes: 1 addition & 1 deletion radio/src/storage/yaml/yaml_datastructs_x10.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "rotEncMode", 2 ),
YAML_SIGNED( "uartSampleMode", 2 ),
YAML_PADDING( 3 ),
YAML_PADDING( 1 ),
YAML_UNSIGNED( "audioMuteEnable", 1 ),
YAML_SIGNED( "imuMax", 8 ),
YAML_SIGNED( "imuOffset", 8 ),
YAML_STRING("selectedTheme", 26),
Expand Down
2 changes: 1 addition & 1 deletion radio/src/storage/yaml/yaml_datastructs_zorro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "rotEncMode", 2 ),
YAML_SIGNED( "uartSampleMode", 2 ),
YAML_PADDING( 3 ),
YAML_PADDING( 1 ),
YAML_UNSIGNED( "audioMuteEnable", 1 ),
YAML_UNSIGNED( "radioGFDisabled", 1 ),
YAML_UNSIGNED( "radioTrainerDisabled", 1 ),
YAML_UNSIGNED( "modelHeliDisabled", 1 ),
Expand Down
1 change: 1 addition & 0 deletions radio/src/targets/common/arm/stm32/audio_dac_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ void dacInit()
#if defined(AUDIO_MUTE_GPIO_PIN)
void audioMute()
{
if(!g_eeGeneral.audioMuteEnable) return;
#if defined(AUDIO_UNMUTE_DELAY)
tmr10ms_t now = get_tmr10ms();
if (!audioQueue.lastAudioPlayTime) {
Expand Down
1 change: 1 addition & 0 deletions radio/src/translations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ const char STR_MENU_TELEMETRY[] = TR_MENU_TELEMETRY;
const char STR_MENU_DISPLAY[] = TR_MENU_DISPLAY;
const char STR_MENU_OTHER[] = TR_MENU_OTHER;
const char STR_MENU_INVERT[] = TR_MENU_INVERT;
const char STR_AUDIO_MUTE[] = TR_AUDIO_MUTE;
const char STR_JITTER_FILTER[] = TR_JITTER_FILTER;
const char STR_DEAD_ZONE[] = TR_DEAD_ZONE;
const char STR_RTC_CHECK[] = TR_RTC_CHECK;
Expand Down
1 change: 1 addition & 0 deletions radio/src/translations.h
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,7 @@ extern const char STR_MENU_TELEMETRY[];
extern const char STR_MENU_DISPLAY[];
extern const char STR_MENU_OTHER[];
extern const char STR_MENU_INVERT[];
extern const char STR_AUDIO_MUTE[];
extern const char STR_JITTER_FILTER[];
extern const char STR_DEAD_ZONE[];
extern const char STR_RTC_CHECK[];
Expand Down
1 change: 1 addition & 0 deletions radio/src/translations/cn.h
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,7 @@
#define TR_MENU_DISPLAY "显示"
#define TR_MENU_OTHER "其它"
#define TR_MENU_INVERT "反向"
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
#define TR_JITTER_FILTER "模拟输入滤波"
#define TR_DEAD_ZONE "死区"
#define TR_RTC_CHECK TR("检查时间电池", "检查时间驱动电池电压")
Expand Down
1 change: 1 addition & 0 deletions radio/src/translations/cz.h
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,7 @@
#define TR_MENU_DISPLAY "DISPLAY"
#define TR_MENU_OTHER "Ostatní"
#define TR_MENU_INVERT "Invertovat"
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
#define TR_JITTER_FILTER "ADC Filtr"
#define TR_DEAD_ZONE "Dead zone"
#define TR_RTC_CHECK TR("Kontr RTC", "Hlídat RTC napětí")
Expand Down
1 change: 1 addition & 0 deletions radio/src/translations/da.h
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,7 @@
#define TR_MENU_DISPLAY "DISPLAY"
#define TR_MENU_OTHER "Andet"
#define TR_MENU_INVERT "Invers"
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
#define TR_JITTER_FILTER "ADC filter"
#define TR_DEAD_ZONE "Dødt område"
#define TR_RTC_CHECK TR("Check RTC", "Check RTC spænding")
Expand Down
1 change: 1 addition & 0 deletions radio/src/translations/de.h
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,7 @@
#define TR_MENU_DISPLAY "TELM-SEITEN"
#define TR_MENU_OTHER "Weitere"
#define TR_MENU_INVERT "Invertieren<!>"
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
#define TR_JITTER_FILTER "ADC Filter"
#define TR_DEAD_ZONE "Dead zone"
#define TR_RTC_CHECK TR("RTC Prüfen", "RTC Spann. prüfen")
Expand Down
1 change: 1 addition & 0 deletions radio/src/translations/en.h
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,7 @@
#define TR_MENU_DISPLAY "DISPLAY"
#define TR_MENU_OTHER "Other"
#define TR_MENU_INVERT "Invert"
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
#define TR_JITTER_FILTER "ADC filter"
#define TR_DEAD_ZONE "Dead zone"
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")
Expand Down
1 change: 1 addition & 0 deletions radio/src/translations/es.h
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,7 @@
#define TR_MENU_DISPLAY "MONITOR"
#define TR_MENU_OTHER "Otros"
#define TR_MENU_INVERT "Invertir"
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
#define TR_JITTER_FILTER "Filtro ADC"
#define TR_DEAD_ZONE "Dead zone"
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltaje")
Expand Down
1 change: 1 addition & 0 deletions radio/src/translations/fi.h
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,7 @@
#define TR_MENU_DISPLAY "DISPLAY"
#define TR_MENU_OTHER "Other"
#define TR_MENU_INVERT "Invert"
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
#define TR_JITTER_FILTER "ADC Filter"
#define TR_DEAD_ZONE "Dead zone"
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")
Expand Down
1 change: 1 addition & 0 deletions radio/src/translations/fr.h
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,7 @@
#define TR_MENU_DISPLAY "AFFICHAGE"
#define TR_MENU_OTHER "Autres"
#define TR_MENU_INVERT "Inverser"
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
#define TR_JITTER_FILTER "Filtre ADC"
#define TR_DEAD_ZONE "Zone Neutre"
#define TR_RTC_CHECK TR("Vérif. RTC", "Vérif. pile RTC")
Expand Down
1 change: 1 addition & 0 deletions radio/src/translations/he.h
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,7 @@
#define TR_MENU_DISPLAY "DISPLAY"
#define TR_MENU_OTHER "Other"
#define TR_MENU_INVERT "Invert"
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
#define TR_JITTER_FILTER "ADC filter"
#define TR_DEAD_ZONE "Dead zone"
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")
Expand Down
1 change: 1 addition & 0 deletions radio/src/translations/it.h
Original file line number Diff line number Diff line change
Expand Up @@ -1192,6 +1192,7 @@
#define TR_MENU_DISPLAY "DISPLAY"
#define TR_MENU_OTHER "Altro"
#define TR_MENU_INVERT "Inverti"
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
#define TR_JITTER_FILTER "Filtro ADC"
#define TR_DEAD_ZONE "Zona morta"
#define TR_RTC_CHECK TR("Controllo RTC", "Controllo volt. RTC")
Expand Down
1 change: 1 addition & 0 deletions radio/src/translations/jp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1188,6 +1188,7 @@
#define TR_MENU_DISPLAY "表示"
#define TR_MENU_OTHER "その他"
#define TR_MENU_INVERT "リバース"
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
#define TR_JITTER_FILTER "ADCフィルター"
#define TR_DEAD_ZONE "デッドゾーン"
#define TR_RTC_CHECK TR("Check RTC", "内蔵電池チェック")
Expand Down
1 change: 1 addition & 0 deletions radio/src/translations/nl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,7 @@
#define TR_MENU_DISPLAY "DISPLAY"
#define TR_MENU_OTHER "Verdere"
#define TR_MENU_INVERT "Inverteer"
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
#define TR_JITTER_FILTER "ADC Filter"
#define TR_DEAD_ZONE "Dead zone"
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")
Expand Down
1 change: 1 addition & 0 deletions radio/src/translations/pl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1192,6 +1192,7 @@
#define TR_MENU_DISPLAY "DISPLAY"
#define TR_MENU_OTHER "Inny "
#define TR_MENU_INVERT "Odwróć"
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
#define TR_JITTER_FILTER "Filtr ADC"
#define TR_DEAD_ZONE "Dead zone"
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")
Expand Down
1 change: 1 addition & 0 deletions radio/src/translations/pt.h
Original file line number Diff line number Diff line change
Expand Up @@ -1199,6 +1199,7 @@
#define TR_MENU_DISPLAY "DISPLAY"
#define TR_MENU_OTHER "Other"
#define TR_MENU_INVERT "Invert"
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
#define TR_JITTER_FILTER "ADC Filter"
#define TR_DEAD_ZONE "Dead zone"
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")
Expand Down
1 change: 1 addition & 0 deletions radio/src/translations/se.h
Original file line number Diff line number Diff line change
Expand Up @@ -1232,6 +1232,7 @@
#define TR_MENU_DISPLAY "DISPLAY"
#define TR_MENU_OTHER "Övrigt"
#define TR_MENU_INVERT "Invertera"
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
#define TR_JITTER_FILTER "ADC-filter"
#define TR_DEAD_ZONE "Dödläge"
#define TR_RTC_CHECK TR("Kolla RTC", "Kolla RTC-batteriet")
Expand Down
1 change: 1 addition & 0 deletions radio/src/translations/tw.h
Original file line number Diff line number Diff line change
Expand Up @@ -1188,6 +1188,7 @@
#define TR_MENU_DISPLAY "顯示"
#define TR_MENU_OTHER "其它"
#define TR_MENU_INVERT "反向"
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
#define TR_JITTER_FILTER "類比輸入濾波"
#define TR_DEAD_ZONE "死區"
#define TR_RTC_CHECK TR("檢查時間電池", "檢查時間驅動電池電壓")
Expand Down