Skip to content

Commit

Permalink
feat: User configurable audio mute (#3703 port to main)
Browse files Browse the repository at this point in the history
  • Loading branch information
3djc committed Jun 26, 2023
1 parent 0743b33 commit d611839
Show file tree
Hide file tree
Showing 30 changed files with 48 additions and 11 deletions.
3 changes: 2 additions & 1 deletion radio/src/datastructs_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,8 @@ PACK(struct RadioData {
#else
NOBACKUP(uint8_t stickDeadZoneSpare:3 SKIP);
#endif
NOBACKUP(uint8_t spare4:1 SKIP);

NOBACKUP(uint8_t audioMuteEnable:1);

#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 @@ -126,6 +126,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
13 changes: 12 additions & 1 deletion radio/src/gui/common/stdlcd/radio_hardware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ enum {
ITEM_RADIO_HARDWARE_BATTERY_CALIB,
ITEM_RADIO_HARDWARE_RTC_BATTERY,
ITEM_RADIO_HARDWARE_RTC_CHECK,
#if defined(AUDIO_MUTE_GPIO)
ITEM_RADIO_HARDWARE_AUDIO_MUTE,
#endif
ITEM_RADIO_HARDWARE_LABEL_INTERNAL_MODULE,
ITEM_RADIO_HARDWARE_INTERNAL_MODULE_TYPE,
ITEM_RADIO_HARDWARE_INTERNAL_MODULE_BAUDRATE,
Expand Down Expand Up @@ -155,7 +158,9 @@ static void _init_menu_tab_array(uint8_t* tab, size_t len)
tab[ITEM_RADIO_HARDWARE_BATTERY_CALIB] = 0;
tab[ITEM_RADIO_HARDWARE_RTC_BATTERY] = READONLY_ROW;
tab[ITEM_RADIO_HARDWARE_RTC_CHECK] = 0;

#if defined(AUDIO_MUTE_GPIO)
tab[ITEM_RADIO_HARDWARE_AUDIO_MUTE] = 0;
#endif
#if defined(HARDWARE_INTERNAL_MODULE)
tab[ITEM_RADIO_HARDWARE_INTERNAL_MODULE_TYPE] = 0;
tab[ITEM_RADIO_HARDWARE_INTERNAL_MODULE_BAUDRATE] =
Expand Down Expand Up @@ -313,6 +318,12 @@ void menuRadioHardware(event_t event)
}
} break;

#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

case ITEM_RADIO_HARDWARE_INTERNAL_MODULE_BAUDRATE:
lcdDrawText(INDENT_WIDTH, y, STR_BAUDRATE);
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN2, y, STR_CRSF_BAUDRATE, CROSSFIRE_STORE_TO_INDEX(g_eeGeneral.internalModuleBaudrate),attr | LEFT);
Expand Down
2 changes: 1 addition & 1 deletion radio/src/storage/yaml/yaml_datastructs_128x64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,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 @@ -378,7 +378,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_tpro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,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 @@ -384,7 +384,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_x12s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,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_x9d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,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_x9e.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,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_x9lite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,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_xlites.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,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_UNSIGNED( "radioGFDisabled", 1 ),
Expand Down
1 change: 1 addition & 0 deletions radio/src/translations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,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 @@ -1117,6 +1117,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 @@ -1104,6 +1104,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 @@ -1120,6 +1120,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 @@ -1124,6 +1124,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 @@ -1114,6 +1114,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 @@ -1113,6 +1113,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 @@ -1117,6 +1117,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 @@ -1129,6 +1129,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 @@ -1130,6 +1130,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 @@ -1110,6 +1110,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 @@ -1109,6 +1109,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 @@ -1124,6 +1124,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 @@ -1111,6 +1111,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 @@ -1119,6 +1119,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 @@ -1151,6 +1151,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 @@ -1108,6 +1108,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

0 comments on commit d611839

Please sign in to comment.