Skip to content

Commit 8f431ea

Browse files
authored
feat: User configurable audio mute (#3719)
* feat: User configurable audio mute (#3703 port to main) * chore: Add translations
1 parent 1255ff0 commit 8f431ea

30 files changed

+48
-11
lines changed

radio/src/datastructs_private.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,8 @@ PACK(struct RadioData {
952952
#else
953953
NOBACKUP(uint8_t stickDeadZoneSpare:3 SKIP);
954954
#endif
955-
NOBACKUP(uint8_t spare4:1 SKIP);
955+
956+
NOBACKUP(uint8_t audioMuteEnable:1);
956957

957958
#if defined(IMU)
958959
NOBACKUP(int8_t imuMax);

radio/src/gui/colorlcd/radio_hardware.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,13 @@ void RadioHardwarePage::build(FormWindow * window)
126126
new StaticText(line, rect_t{}, STR_JITTER_FILTER, 0, COLOR_THEME_PRIMARY1);
127127
new CheckBox(line, rect_t{}, GET_SET_INVERTED(g_eeGeneral.noJitterFilter));
128128

129+
#if defined(AUDIO_MUTE_GPIO)
130+
// Mute audio
131+
line = window->newLine(&grid);
132+
new StaticText(line, rect_t{}, STR_AUDIO_MUTE, 0, COLOR_THEME_PRIMARY1);
133+
new CheckBox(line, rect_t{}, GET_SET_DEFAULT(g_eeGeneral.audioMuteEnable));
134+
#endif
135+
129136
#if defined(HARDWARE_INTERNAL_MODULE)
130137
new Subtitle(window, rect_t{}, STR_INTERNALRF, 0, COLOR_THEME_PRIMARY1);
131138
auto intMod = new InternalModuleWindow(window);

radio/src/gui/common/stdlcd/radio_hardware.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ enum {
5757
ITEM_RADIO_HARDWARE_BATTERY_CALIB,
5858
ITEM_RADIO_HARDWARE_RTC_BATTERY,
5959
ITEM_RADIO_HARDWARE_RTC_CHECK,
60+
#if defined(AUDIO_MUTE_GPIO)
61+
ITEM_RADIO_HARDWARE_AUDIO_MUTE,
62+
#endif
6063
ITEM_RADIO_HARDWARE_LABEL_INTERNAL_MODULE,
6164
ITEM_RADIO_HARDWARE_INTERNAL_MODULE_TYPE,
6265
ITEM_RADIO_HARDWARE_INTERNAL_MODULE_BAUDRATE,
@@ -155,7 +158,9 @@ static void _init_menu_tab_array(uint8_t* tab, size_t len)
155158
tab[ITEM_RADIO_HARDWARE_BATTERY_CALIB] = 0;
156159
tab[ITEM_RADIO_HARDWARE_RTC_BATTERY] = READONLY_ROW;
157160
tab[ITEM_RADIO_HARDWARE_RTC_CHECK] = 0;
158-
161+
#if defined(AUDIO_MUTE_GPIO)
162+
tab[ITEM_RADIO_HARDWARE_AUDIO_MUTE] = 0;
163+
#endif
159164
#if defined(HARDWARE_INTERNAL_MODULE)
160165
tab[ITEM_RADIO_HARDWARE_INTERNAL_MODULE_TYPE] = 0;
161166
tab[ITEM_RADIO_HARDWARE_INTERNAL_MODULE_BAUDRATE] =
@@ -313,6 +318,12 @@ void menuRadioHardware(event_t event)
313318
}
314319
} break;
315320

321+
#if defined(AUDIO_MUTE_GPIO)
322+
case ITEM_RADIO_HARDWARE_AUDIO_MUTE:
323+
g_eeGeneral.audioMuteEnable = editCheckBox(g_eeGeneral.audioMuteEnable, HW_SETTINGS_COLUMN2, y, STR_AUDIO_MUTE, attr, event);
324+
break;
325+
#endif
326+
316327
case ITEM_RADIO_HARDWARE_INTERNAL_MODULE_BAUDRATE:
317328
lcdDrawText(INDENT_WIDTH, y, STR_BAUDRATE);
318329
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN2, y, STR_CRSF_BAUDRATE, CROSSFIRE_STORE_TO_INDEX(g_eeGeneral.internalModuleBaudrate),attr | LEFT);

radio/src/storage/yaml/yaml_datastructs_128x64.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ static const struct YamlNode struct_RadioData[] = {
345345
YAML_UNSIGNED( "rotEncMode", 2 ),
346346
YAML_SIGNED( "uartSampleMode", 2 ),
347347
YAML_PADDING( 3 ),
348-
YAML_PADDING( 1 ),
348+
YAML_UNSIGNED( "audioMuteEnable", 1 ),
349349
YAML_UNSIGNED( "radioGFDisabled", 1 ),
350350
YAML_UNSIGNED( "radioTrainerDisabled", 1 ),
351351
YAML_UNSIGNED( "modelHeliDisabled", 1 ),

radio/src/storage/yaml/yaml_datastructs_nv14.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ static const struct YamlNode struct_RadioData[] = {
378378
YAML_UNSIGNED( "rotEncMode", 2 ),
379379
YAML_SIGNED( "uartSampleMode", 2 ),
380380
YAML_UNSIGNED( "stickDeadZone", 3 ),
381-
YAML_PADDING( 1 ),
381+
YAML_UNSIGNED( "audioMuteEnable", 1 ),
382382
YAML_STRING("selectedTheme", 26),
383383
YAML_UNSIGNED( "radioThemesDisabled", 1 ),
384384
YAML_UNSIGNED( "radioGFDisabled", 1 ),

radio/src/storage/yaml/yaml_datastructs_tpro.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ static const struct YamlNode struct_RadioData[] = {
343343
YAML_UNSIGNED( "rotEncMode", 2 ),
344344
YAML_SIGNED( "uartSampleMode", 2 ),
345345
YAML_PADDING( 3 ),
346-
YAML_PADDING( 1 ),
346+
YAML_UNSIGNED( "audioMuteEnable", 1 ),
347347
YAML_UNSIGNED( "radioGFDisabled", 1 ),
348348
YAML_UNSIGNED( "radioTrainerDisabled", 1 ),
349349
YAML_UNSIGNED( "modelHeliDisabled", 1 ),

radio/src/storage/yaml/yaml_datastructs_x10.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ static const struct YamlNode struct_RadioData[] = {
384384
YAML_UNSIGNED( "rotEncMode", 2 ),
385385
YAML_SIGNED( "uartSampleMode", 2 ),
386386
YAML_PADDING( 3 ),
387-
YAML_PADDING( 1 ),
387+
YAML_UNSIGNED( "audioMuteEnable", 1 ),
388388
YAML_SIGNED( "imuMax", 8 ),
389389
YAML_SIGNED( "imuOffset", 8 ),
390390
YAML_STRING("selectedTheme", 26),

radio/src/storage/yaml/yaml_datastructs_x12s.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ static const struct YamlNode struct_RadioData[] = {
384384
YAML_UNSIGNED( "rotEncMode", 2 ),
385385
YAML_SIGNED( "uartSampleMode", 2 ),
386386
YAML_PADDING( 3 ),
387-
YAML_PADDING( 1 ),
387+
YAML_UNSIGNED( "audioMuteEnable", 1 ),
388388
YAML_SIGNED( "imuMax", 8 ),
389389
YAML_SIGNED( "imuOffset", 8 ),
390390
YAML_STRING("selectedTheme", 26),

radio/src/storage/yaml/yaml_datastructs_x9d.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ static const struct YamlNode struct_RadioData[] = {
345345
YAML_UNSIGNED( "rotEncMode", 2 ),
346346
YAML_SIGNED( "uartSampleMode", 2 ),
347347
YAML_PADDING( 3 ),
348-
YAML_PADDING( 1 ),
348+
YAML_UNSIGNED( "audioMuteEnable", 1 ),
349349
YAML_UNSIGNED( "radioGFDisabled", 1 ),
350350
YAML_UNSIGNED( "radioTrainerDisabled", 1 ),
351351
YAML_UNSIGNED( "modelHeliDisabled", 1 ),

radio/src/storage/yaml/yaml_datastructs_x9e.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ static const struct YamlNode struct_RadioData[] = {
345345
YAML_UNSIGNED( "rotEncMode", 2 ),
346346
YAML_SIGNED( "uartSampleMode", 2 ),
347347
YAML_PADDING( 3 ),
348-
YAML_PADDING( 1 ),
348+
YAML_UNSIGNED( "audioMuteEnable", 1 ),
349349
YAML_UNSIGNED( "radioGFDisabled", 1 ),
350350
YAML_UNSIGNED( "radioTrainerDisabled", 1 ),
351351
YAML_UNSIGNED( "modelHeliDisabled", 1 ),

radio/src/storage/yaml/yaml_datastructs_x9lite.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ static const struct YamlNode struct_RadioData[] = {
343343
YAML_UNSIGNED( "rotEncMode", 2 ),
344344
YAML_SIGNED( "uartSampleMode", 2 ),
345345
YAML_PADDING( 3 ),
346-
YAML_PADDING( 1 ),
346+
YAML_UNSIGNED( "audioMuteEnable", 1 ),
347347
YAML_UNSIGNED( "radioGFDisabled", 1 ),
348348
YAML_UNSIGNED( "radioTrainerDisabled", 1 ),
349349
YAML_UNSIGNED( "modelHeliDisabled", 1 ),

radio/src/storage/yaml/yaml_datastructs_xlites.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ static const struct YamlNode struct_RadioData[] = {
347347
YAML_UNSIGNED( "rotEncMode", 2 ),
348348
YAML_SIGNED( "uartSampleMode", 2 ),
349349
YAML_PADDING( 3 ),
350-
YAML_PADDING( 1 ),
350+
YAML_UNSIGNED( "audioMuteEnable", 1 ),
351351
YAML_SIGNED( "imuMax", 8 ),
352352
YAML_SIGNED( "imuOffset", 8 ),
353353
YAML_UNSIGNED( "radioGFDisabled", 1 ),

radio/src/translations.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,7 @@ const char STR_MENU_TELEMETRY[] = TR_MENU_TELEMETRY;
723723
const char STR_MENU_DISPLAY[] = TR_MENU_DISPLAY;
724724
const char STR_MENU_OTHER[] = TR_MENU_OTHER;
725725
const char STR_MENU_INVERT[] = TR_MENU_INVERT;
726+
const char STR_AUDIO_MUTE[] = TR_AUDIO_MUTE;
726727
const char STR_JITTER_FILTER[] = TR_JITTER_FILTER;
727728
const char STR_DEAD_ZONE[] = TR_DEAD_ZONE;
728729
const char STR_RTC_CHECK[] = TR_RTC_CHECK;

radio/src/translations.h

+1
Original file line numberDiff line numberDiff line change
@@ -1117,6 +1117,7 @@ extern const char STR_MENU_TELEMETRY[];
11171117
extern const char STR_MENU_DISPLAY[];
11181118
extern const char STR_MENU_OTHER[];
11191119
extern const char STR_MENU_INVERT[];
1120+
extern const char STR_AUDIO_MUTE[];
11201121
extern const char STR_JITTER_FILTER[];
11211122
extern const char STR_DEAD_ZONE[];
11221123
extern const char STR_RTC_CHECK[];

radio/src/translations/cn.h

+1
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,7 @@
10991099
#define TR_MENU_DISPLAY "显示"
11001100
#define TR_MENU_OTHER "其它"
11011101
#define TR_MENU_INVERT "反向"
1102+
#define TR_AUDIO_MUTE TR("自动静音","音频停播时自动静音")
11021103
#define TR_JITTER_FILTER "模拟输入滤波"
11031104
#define TR_DEAD_ZONE "死区"
11041105
#define TR_RTC_CHECK TR("检查时间电池", "检查时间驱动电池电压")

radio/src/translations/cz.h

+1
Original file line numberDiff line numberDiff line change
@@ -1115,6 +1115,7 @@
11151115
#define TR_MENU_DISPLAY "DISPLAY"
11161116
#define TR_MENU_OTHER "Ostatní"
11171117
#define TR_MENU_INVERT "Invertovat"
1118+
#define TR_AUDIO_MUTE TR("Ztlumení zvuku","Ztlumení, pokud není slyšet zvuk")
11181119
#define TR_JITTER_FILTER "ADC Filtr"
11191120
#define TR_DEAD_ZONE "Dead zone"
11201121
#define TR_RTC_CHECK TR("Kontr RTC", "Hlídat RTC napětí")

radio/src/translations/da.h

+1
Original file line numberDiff line numberDiff line change
@@ -1119,6 +1119,7 @@
11191119
#define TR_MENU_DISPLAY "DISPLAY"
11201120
#define TR_MENU_OTHER "Andet"
11211121
#define TR_MENU_INVERT "Invers"
1122+
#define TR_AUDIO_MUTE TR("Audio fra","Audio fra, hvis der ikke gives lyd")
11221123
#define TR_JITTER_FILTER "ADC filter"
11231124
#define TR_DEAD_ZONE "Dødt område"
11241125
#define TR_RTC_CHECK TR("Check RTC", "Check RTC spænding")

radio/src/translations/de.h

+1
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,7 @@
11091109
#define TR_MENU_DISPLAY "TELM-SEITEN"
11101110
#define TR_MENU_OTHER "Weitere"
11111111
#define TR_MENU_INVERT "Invertieren<!>"
1112+
#define TR_AUDIO_MUTE TR("Ton Stumm","Geräuschunterdrückung")
11121113
#define TR_JITTER_FILTER "ADC Filter"
11131114
#define TR_DEAD_ZONE "Dead zone"
11141115
#define TR_RTC_CHECK TR("RTC Prüfen", "RTC Spann. prüfen")

radio/src/translations/en.h

+1
Original file line numberDiff line numberDiff line change
@@ -1108,6 +1108,7 @@
11081108
#define TR_MENU_DISPLAY "DISPLAY"
11091109
#define TR_MENU_OTHER "Other"
11101110
#define TR_MENU_INVERT "Invert"
1111+
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
11111112
#define TR_JITTER_FILTER "ADC filter"
11121113
#define TR_DEAD_ZONE "Dead zone"
11131114
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")

radio/src/translations/es.h

+1
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,7 @@
11121112
#define TR_MENU_DISPLAY "MONITOR"
11131113
#define TR_MENU_OTHER "Otros"
11141114
#define TR_MENU_INVERT "Invertir"
1115+
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
11151116
#define TR_JITTER_FILTER "Filtro ADC"
11161117
#define TR_DEAD_ZONE "Dead zone"
11171118
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltaje")

radio/src/translations/fi.h

+1
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,7 @@
11241124
#define TR_MENU_DISPLAY "DISPLAY"
11251125
#define TR_MENU_OTHER "Other"
11261126
#define TR_MENU_INVERT "Invert"
1127+
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
11271128
#define TR_JITTER_FILTER "ADC Filter"
11281129
#define TR_DEAD_ZONE "Dead zone"
11291130
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")

radio/src/translations/fr.h

+1
Original file line numberDiff line numberDiff line change
@@ -1125,6 +1125,7 @@
11251125
#define TR_MENU_DISPLAY "AFFICHAGE"
11261126
#define TR_MENU_OTHER "Autres"
11271127
#define TR_MENU_INVERT "Inverser"
1128+
#define TR_AUDIO_MUTE TR("Audio muet","Muet si pas de son")
11281129
#define TR_JITTER_FILTER "Filtre ADC"
11291130
#define TR_DEAD_ZONE "Zone Neutre"
11301131
#define TR_RTC_CHECK TR("Vérif. RTC", "Vérif. pile RTC")

radio/src/translations/he.h

+1
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,7 @@
11851185
#define TR_MENU_DISPLAY "DISPLAY"
11861186
#define TR_MENU_OTHER "Other"
11871187
#define TR_MENU_INVERT "Invert"
1188+
#define TR_AUDIO_MUTE TR("השתקת קול","השתק כאשר אין סאונד")
11881189
#define TR_JITTER_FILTER "ADC filter"
11891190
#define TR_DEAD_ZONE "Dead zone"
11901191
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")

radio/src/translations/it.h

+1
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,7 @@
11051105
#define TR_MENU_DISPLAY "DISPLAY"
11061106
#define TR_MENU_OTHER "Altro"
11071107
#define TR_MENU_INVERT "Inverti"
1108+
#define TR_AUDIO_MUTE TR("Audio muto","Muto senza suono")
11081109
#define TR_JITTER_FILTER "Filtro ADC"
11091110
#define TR_DEAD_ZONE "Zona morta"
11101111
#define TR_RTC_CHECK TR("Controllo RTC", "Controllo volt. RTC")

radio/src/translations/jp.h

+1
Original file line numberDiff line numberDiff line change
@@ -1104,6 +1104,7 @@
11041104
#define TR_MENU_DISPLAY "表示"
11051105
#define TR_MENU_OTHER "その他"
11061106
#define TR_MENU_INVERT "リバース"
1107+
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
11071108
#define TR_JITTER_FILTER "ADCフィルター"
11081109
#define TR_DEAD_ZONE "デッドゾーン"
11091110
#define TR_RTC_CHECK TR("Check RTC", "内蔵電池チェック")

radio/src/translations/nl.h

+1
Original file line numberDiff line numberDiff line change
@@ -1119,6 +1119,7 @@
11191119
#define TR_MENU_DISPLAY "DISPLAY"
11201120
#define TR_MENU_OTHER "Verdere"
11211121
#define TR_MENU_INVERT "Inverteer"
1122+
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
11221123
#define TR_JITTER_FILTER "ADC Filter"
11231124
#define TR_DEAD_ZONE "Dead zone"
11241125
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")

radio/src/translations/pl.h

+1
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,7 @@
11061106
#define TR_MENU_DISPLAY "DISPLAY"
11071107
#define TR_MENU_OTHER "Inny "
11081108
#define TR_MENU_INVERT "Odwróć"
1109+
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
11091110
#define TR_JITTER_FILTER "Filtr ADC"
11101111
#define TR_DEAD_ZONE "Dead zone"
11111112
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")

radio/src/translations/pt.h

+1
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,7 @@
11141114
#define TR_MENU_DISPLAY "DISPLAY"
11151115
#define TR_MENU_OTHER "Other"
11161116
#define TR_MENU_INVERT "Invert"
1117+
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
11171118
#define TR_JITTER_FILTER "ADC Filter"
11181119
#define TR_DEAD_ZONE "Dead zone"
11191120
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")

radio/src/translations/se.h

+1
Original file line numberDiff line numberDiff line change
@@ -1146,6 +1146,7 @@
11461146
#define TR_MENU_DISPLAY "DISPLAY"
11471147
#define TR_MENU_OTHER "Övrigt"
11481148
#define TR_MENU_INVERT "Invertera"
1149+
#define TR_AUDIO_MUTE TR("Audio av","Audio av om inget ljud")
11491150
#define TR_JITTER_FILTER "ADC-filter"
11501151
#define TR_DEAD_ZONE "Dödläge"
11511152
#define TR_RTC_CHECK TR("Kolla RTC", "Kolla RTC-batteriet")

radio/src/translations/tw.h

+1
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,7 @@
11031103
#define TR_MENU_DISPLAY "顯示"
11041104
#define TR_MENU_OTHER "其它"
11051105
#define TR_MENU_INVERT "反向"
1106+
#define TR_AUDIO_MUTE TR("自動靜音","音頻停播時自動靜音")
11061107
#define TR_JITTER_FILTER "類比輸入濾波"
11071108
#define TR_DEAD_ZONE "死區"
11081109
#define TR_RTC_CHECK TR("檢查時間電池", "檢查時間驅動電池電壓")

0 commit comments

Comments
 (0)