Skip to content

Commit a698ab1

Browse files
authored
feat: User configurable audio mute (#3703)
* User configurable audio mute * Some compile fixes * compil fixes * Fix possible muted on boot scenario * yaml update * reuse ! * yaml update * 'oh boy' fix
1 parent 5268ba0 commit a698ab1

32 files changed

+59
-10
lines changed

radio/src/datastructs_private.h

+6
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,7 @@ PACK(struct RadioData {
940940
NOBACKUP(int8_t varioPitch CUST(r_vPitch,w_vPitch));
941941
NOBACKUP(int8_t varioRange CUST(r_vPitch,w_vPitch));
942942
NOBACKUP(int8_t varioRepeat);
943+
943944
CustomFunctionData customFn[MAX_SPECIAL_FUNCTIONS] FUNC(cfn_is_active);
944945

945946
CUST_ATTR(auxSerialMode, r_serialMode, nullptr);
@@ -962,7 +963,12 @@ PACK(struct RadioData {
962963
#else
963964
NOBACKUP(uint8_t stickDeadZoneSpare:3 SKIP);
964965
#endif
966+
967+
#if defined(AUDIO_MUTE_GPIO)
968+
NOBACKUP(uint8_t audioMuteEnable:1);
969+
#else
965970
NOBACKUP(uint8_t spare4:1 SKIP);
971+
#endif
966972

967973
#if defined(IMU)
968974
NOBACKUP(int8_t imuMax);

radio/src/gui/colorlcd/radio_hardware.cpp

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

124+
#if defined(AUDIO_MUTE_GPIO)
125+
// Mute audio
126+
line = window->newLine(&grid);
127+
new StaticText(line, rect_t{}, STR_AUDIO_MUTE, 0, COLOR_THEME_PRIMARY1);
128+
new CheckBox(line, rect_t{}, GET_SET_DEFAULT(g_eeGeneral.audioMuteEnable));
129+
#endif
130+
124131
#if defined(HARDWARE_INTERNAL_MODULE)
125132
new Subtitle(window, rect_t{}, STR_INTERNALRF, 0, COLOR_THEME_PRIMARY1);
126133
auto intMod = new InternalModuleWindow(window);

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

+17
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ enum {
104104
ITEM_RADIO_HARDWARE_CAPACITY_CALIB,
105105
#endif
106106

107+
#if defined(AUDIO_MUTE_GPIO)
108+
ITEM_RADIO_HARDWARE_AUDIO_MUTE,
109+
#endif
110+
107111
#if !defined(PCBX9D) && !defined(PCBX9DP) && !defined(PCBX9E)
108112
ITEM_RADIO_HARDWARE_LABEL_INTERNAL_MODULE,
109113
ITEM_RADIO_HARDWARE_INTERNAL_MODULE_TYPE,
@@ -238,6 +242,12 @@ enum {
238242
#define TX_CAPACITY_MEASUREMENT_ROWS
239243
#endif
240244

245+
#if defined(AUDIO_MUTE_GPIO)
246+
#define AUDIO_MUTE_ROW 0,
247+
#else
248+
#define AUDIO_MUTE_ROW
249+
#endif
250+
241251
#if !defined(PCBX9D) && !defined(PCBX9DP) && !defined(PCBX9E)
242252
#define INTERNAL_MODULE_ROWS \
243253
LABEL(InternalModule), 0, \
@@ -314,6 +324,7 @@ void menuRadioHardware(event_t event)
314324
0 /* battery calib */,
315325
RTC_ROW
316326
TX_CAPACITY_MEASUREMENT_ROWS
327+
AUDIO_MUTE_ROW
317328
INTERNAL_MODULE_ROWS
318329
SERIAL_SAMPLE_MODE_ROWS
319330
BLUETOOTH_ROWS
@@ -522,6 +533,12 @@ void menuRadioHardware(event_t event)
522533
break;
523534
#endif
524535

536+
#if defined(AUDIO_MUTE_GPIO)
537+
case ITEM_RADIO_HARDWARE_AUDIO_MUTE:
538+
g_eeGeneral.audioMuteEnable = editCheckBox(g_eeGeneral.audioMuteEnable, HW_SETTINGS_COLUMN2, y, STR_AUDIO_MUTE, attr, event);
539+
break;
540+
#endif
541+
525542
#if !defined(PCBX9D) && !defined(PCBX9DP) && !defined(PCBX9E)
526543
case ITEM_RADIO_HARDWARE_LABEL_INTERNAL_MODULE:
527544
lcdDrawTextAlignedLeft(y, STR_INTERNALRF);

radio/src/storage/yaml/yaml_datastructs_boxer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ static const struct YamlNode struct_RadioData[] = {
426426
YAML_UNSIGNED( "rotEncMode", 2 ),
427427
YAML_SIGNED( "uartSampleMode", 2 ),
428428
YAML_PADDING( 3 ),
429-
YAML_PADDING( 1 ),
429+
YAML_UNSIGNED( "audioMuteEnable", 1 ),
430430
YAML_UNSIGNED( "radioGFDisabled", 1 ),
431431
YAML_UNSIGNED( "radioTrainerDisabled", 1 ),
432432
YAML_UNSIGNED( "modelHeliDisabled", 1 ),

radio/src/storage/yaml/yaml_datastructs_lr3pro.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ static const struct YamlNode struct_RadioData[] = {
425425
YAML_UNSIGNED( "rotEncMode", 2 ),
426426
YAML_SIGNED( "uartSampleMode", 2 ),
427427
YAML_PADDING( 3 ),
428-
YAML_PADDING( 1 ),
428+
YAML_UNSIGNED( "audioMuteEnable", 1 ),
429429
YAML_UNSIGNED( "radioGFDisabled", 1 ),
430430
YAML_UNSIGNED( "radioTrainerDisabled", 1 ),
431431
YAML_UNSIGNED( "modelHeliDisabled", 1 ),

radio/src/storage/yaml/yaml_datastructs_nv14.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ static const struct YamlNode struct_RadioData[] = {
457457
YAML_UNSIGNED( "rotEncMode", 2 ),
458458
YAML_SIGNED( "uartSampleMode", 2 ),
459459
YAML_UNSIGNED( "stickDeadZone", 3 ),
460-
YAML_PADDING( 1 ),
460+
YAML_UNSIGNED( "audioMuteEnable", 1 ),
461461
YAML_STRING("selectedTheme", 26),
462462
YAML_UNSIGNED( "radioThemesDisabled", 1 ),
463463
YAML_UNSIGNED( "radioGFDisabled", 1 ),

radio/src/storage/yaml/yaml_datastructs_t8.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ static const struct YamlNode struct_RadioData[] = {
425425
YAML_UNSIGNED( "rotEncMode", 2 ),
426426
YAML_SIGNED( "uartSampleMode", 2 ),
427427
YAML_PADDING( 3 ),
428-
YAML_PADDING( 1 ),
428+
YAML_UNSIGNED( "audioMuteEnable", 1 ),
429429
YAML_UNSIGNED( "radioGFDisabled", 1 ),
430430
YAML_UNSIGNED( "radioTrainerDisabled", 1 ),
431431
YAML_UNSIGNED( "modelHeliDisabled", 1 ),

radio/src/storage/yaml/yaml_datastructs_tlite.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ static const struct YamlNode struct_RadioData[] = {
425425
YAML_UNSIGNED( "rotEncMode", 2 ),
426426
YAML_SIGNED( "uartSampleMode", 2 ),
427427
YAML_PADDING( 3 ),
428-
YAML_PADDING( 1 ),
428+
YAML_UNSIGNED( "audioMuteEnable", 1 ),
429429
YAML_UNSIGNED( "radioGFDisabled", 1 ),
430430
YAML_UNSIGNED( "radioTrainerDisabled", 1 ),
431431
YAML_UNSIGNED( "modelHeliDisabled", 1 ),

radio/src/storage/yaml/yaml_datastructs_tpro.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ static const struct YamlNode struct_RadioData[] = {
431431
YAML_UNSIGNED( "rotEncMode", 2 ),
432432
YAML_SIGNED( "uartSampleMode", 2 ),
433433
YAML_PADDING( 3 ),
434-
YAML_PADDING( 1 ),
434+
YAML_UNSIGNED( "audioMuteEnable", 1 ),
435435
YAML_UNSIGNED( "radioGFDisabled", 1 ),
436436
YAML_UNSIGNED( "radioTrainerDisabled", 1 ),
437437
YAML_UNSIGNED( "modelHeliDisabled", 1 ),

radio/src/storage/yaml/yaml_datastructs_tx12.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ static const struct YamlNode struct_RadioData[] = {
425425
YAML_UNSIGNED( "rotEncMode", 2 ),
426426
YAML_SIGNED( "uartSampleMode", 2 ),
427427
YAML_PADDING( 3 ),
428-
YAML_PADDING( 1 ),
428+
YAML_UNSIGNED( "audioMuteEnable", 1 ),
429429
YAML_UNSIGNED( "radioGFDisabled", 1 ),
430430
YAML_UNSIGNED( "radioTrainerDisabled", 1 ),
431431
YAML_UNSIGNED( "modelHeliDisabled", 1 ),

radio/src/storage/yaml/yaml_datastructs_tx12mk2.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ static const struct YamlNode struct_RadioData[] = {
425425
YAML_UNSIGNED( "rotEncMode", 2 ),
426426
YAML_SIGNED( "uartSampleMode", 2 ),
427427
YAML_PADDING( 3 ),
428-
YAML_PADDING( 1 ),
428+
YAML_UNSIGNED( "audioMuteEnable", 1 ),
429429
YAML_UNSIGNED( "radioGFDisabled", 1 ),
430430
YAML_UNSIGNED( "radioTrainerDisabled", 1 ),
431431
YAML_UNSIGNED( "modelHeliDisabled", 1 ),

radio/src/storage/yaml/yaml_datastructs_x10.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ static const struct YamlNode struct_RadioData[] = {
486486
YAML_UNSIGNED( "rotEncMode", 2 ),
487487
YAML_SIGNED( "uartSampleMode", 2 ),
488488
YAML_PADDING( 3 ),
489-
YAML_PADDING( 1 ),
489+
YAML_UNSIGNED( "audioMuteEnable", 1 ),
490490
YAML_SIGNED( "imuMax", 8 ),
491491
YAML_SIGNED( "imuOffset", 8 ),
492492
YAML_STRING("selectedTheme", 26),

radio/src/storage/yaml/yaml_datastructs_zorro.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ static const struct YamlNode struct_RadioData[] = {
425425
YAML_UNSIGNED( "rotEncMode", 2 ),
426426
YAML_SIGNED( "uartSampleMode", 2 ),
427427
YAML_PADDING( 3 ),
428-
YAML_PADDING( 1 ),
428+
YAML_UNSIGNED( "audioMuteEnable", 1 ),
429429
YAML_UNSIGNED( "radioGFDisabled", 1 ),
430430
YAML_UNSIGNED( "radioTrainerDisabled", 1 ),
431431
YAML_UNSIGNED( "modelHeliDisabled", 1 ),

radio/src/targets/common/arm/stm32/audio_dac_driver.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ void dacInit()
120120
#if defined(AUDIO_MUTE_GPIO_PIN)
121121
void audioMute()
122122
{
123+
if(!g_eeGeneral.audioMuteEnable) return;
123124
#if defined(AUDIO_UNMUTE_DELAY)
124125
tmr10ms_t now = get_tmr10ms();
125126
if (!audioQueue.lastAudioPlayTime) {

radio/src/translations.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,7 @@ const char STR_MENU_TELEMETRY[] = TR_MENU_TELEMETRY;
691691
const char STR_MENU_DISPLAY[] = TR_MENU_DISPLAY;
692692
const char STR_MENU_OTHER[] = TR_MENU_OTHER;
693693
const char STR_MENU_INVERT[] = TR_MENU_INVERT;
694+
const char STR_AUDIO_MUTE[] = TR_AUDIO_MUTE;
694695
const char STR_JITTER_FILTER[] = TR_JITTER_FILTER;
695696
const char STR_DEAD_ZONE[] = TR_DEAD_ZONE;
696697
const char STR_RTC_CHECK[] = TR_RTC_CHECK;

radio/src/translations.h

+1
Original file line numberDiff line numberDiff line change
@@ -1085,6 +1085,7 @@ extern const char STR_MENU_TELEMETRY[];
10851085
extern const char STR_MENU_DISPLAY[];
10861086
extern const char STR_MENU_OTHER[];
10871087
extern const char STR_MENU_INVERT[];
1088+
extern const char STR_AUDIO_MUTE[];
10881089
extern const char STR_JITTER_FILTER[];
10891090
extern const char STR_DEAD_ZONE[];
10901091
extern const char STR_RTC_CHECK[];

radio/src/translations/cn.h

+1
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,7 @@
11901190
#define TR_MENU_DISPLAY "显示"
11911191
#define TR_MENU_OTHER "其它"
11921192
#define TR_MENU_INVERT "反向"
1193+
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
11931194
#define TR_JITTER_FILTER "模拟输入滤波"
11941195
#define TR_DEAD_ZONE "死区"
11951196
#define TR_RTC_CHECK TR("检查时间电池", "检查时间驱动电池电压")

radio/src/translations/cz.h

+1
Original file line numberDiff line numberDiff line change
@@ -1195,6 +1195,7 @@
11951195
#define TR_MENU_DISPLAY "DISPLAY"
11961196
#define TR_MENU_OTHER "Ostatní"
11971197
#define TR_MENU_INVERT "Invertovat"
1198+
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
11981199
#define TR_JITTER_FILTER "ADC Filtr"
11991200
#define TR_DEAD_ZONE "Dead zone"
12001201
#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
@@ -1201,6 +1201,7 @@
12011201
#define TR_MENU_DISPLAY "DISPLAY"
12021202
#define TR_MENU_OTHER "Andet"
12031203
#define TR_MENU_INVERT "Invers"
1204+
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
12041205
#define TR_JITTER_FILTER "ADC filter"
12051206
#define TR_DEAD_ZONE "Dødt område"
12061207
#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
@@ -1194,6 +1194,7 @@
11941194
#define TR_MENU_DISPLAY "TELM-SEITEN"
11951195
#define TR_MENU_OTHER "Weitere"
11961196
#define TR_MENU_INVERT "Invertieren<!>"
1197+
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
11971198
#define TR_JITTER_FILTER "ADC Filter"
11981199
#define TR_DEAD_ZONE "Dead zone"
11991200
#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
@@ -1187,6 +1187,7 @@
11871187
#define TR_MENU_DISPLAY "DISPLAY"
11881188
#define TR_MENU_OTHER "Other"
11891189
#define TR_MENU_INVERT "Invert"
1190+
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
11901191
#define TR_JITTER_FILTER "ADC filter"
11911192
#define TR_DEAD_ZONE "Dead zone"
11921193
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")

radio/src/translations/es.h

+1
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,7 @@
11961196
#define TR_MENU_DISPLAY "MONITOR"
11971197
#define TR_MENU_OTHER "Otros"
11981198
#define TR_MENU_INVERT "Invertir"
1199+
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
11991200
#define TR_JITTER_FILTER "Filtro ADC"
12001201
#define TR_DEAD_ZONE "Dead zone"
12011202
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltaje")

radio/src/translations/fi.h

+1
Original file line numberDiff line numberDiff line change
@@ -1206,6 +1206,7 @@
12061206
#define TR_MENU_DISPLAY "DISPLAY"
12071207
#define TR_MENU_OTHER "Other"
12081208
#define TR_MENU_INVERT "Invert"
1209+
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
12091210
#define TR_JITTER_FILTER "ADC Filter"
12101211
#define TR_DEAD_ZONE "Dead zone"
12111212
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")

radio/src/translations/fr.h

+1
Original file line numberDiff line numberDiff line change
@@ -1210,6 +1210,7 @@
12101210
#define TR_MENU_DISPLAY "AFFICHAGE"
12111211
#define TR_MENU_OTHER "Autres"
12121212
#define TR_MENU_INVERT "Inverser"
1213+
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
12131214
#define TR_JITTER_FILTER "Filtre ADC"
12141215
#define TR_DEAD_ZONE "Zone Neutre"
12151216
#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
@@ -1190,6 +1190,7 @@
11901190
#define TR_MENU_DISPLAY "DISPLAY"
11911191
#define TR_MENU_OTHER "Other"
11921192
#define TR_MENU_INVERT "Invert"
1193+
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
11931194
#define TR_JITTER_FILTER "ADC filter"
11941195
#define TR_DEAD_ZONE "Dead zone"
11951196
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")

radio/src/translations/it.h

+1
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,7 @@
11921192
#define TR_MENU_DISPLAY "DISPLAY"
11931193
#define TR_MENU_OTHER "Altro"
11941194
#define TR_MENU_INVERT "Inverti"
1195+
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
11951196
#define TR_JITTER_FILTER "Filtro ADC"
11961197
#define TR_DEAD_ZONE "Zona morta"
11971198
#define TR_RTC_CHECK TR("Controllo RTC", "Controllo volt. RTC")

radio/src/translations/jp.h

+1
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,7 @@
11881188
#define TR_MENU_DISPLAY "表示"
11891189
#define TR_MENU_OTHER "その他"
11901190
#define TR_MENU_INVERT "リバース"
1191+
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
11911192
#define TR_JITTER_FILTER "ADCフィルター"
11921193
#define TR_DEAD_ZONE "デッドゾーン"
11931194
#define TR_RTC_CHECK TR("Check RTC", "内蔵電池チェック")

radio/src/translations/nl.h

+1
Original file line numberDiff line numberDiff line change
@@ -1206,6 +1206,7 @@
12061206
#define TR_MENU_DISPLAY "DISPLAY"
12071207
#define TR_MENU_OTHER "Verdere"
12081208
#define TR_MENU_INVERT "Inverteer"
1209+
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
12091210
#define TR_JITTER_FILTER "ADC Filter"
12101211
#define TR_DEAD_ZONE "Dead zone"
12111212
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")

radio/src/translations/pl.h

+1
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,7 @@
11921192
#define TR_MENU_DISPLAY "DISPLAY"
11931193
#define TR_MENU_OTHER "Inny "
11941194
#define TR_MENU_INVERT "Odwróć"
1195+
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
11951196
#define TR_JITTER_FILTER "Filtr ADC"
11961197
#define TR_DEAD_ZONE "Dead zone"
11971198
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")

radio/src/translations/pt.h

+1
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,7 @@
11991199
#define TR_MENU_DISPLAY "DISPLAY"
12001200
#define TR_MENU_OTHER "Other"
12011201
#define TR_MENU_INVERT "Invert"
1202+
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
12021203
#define TR_JITTER_FILTER "ADC Filter"
12031204
#define TR_DEAD_ZONE "Dead zone"
12041205
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")

radio/src/translations/se.h

+1
Original file line numberDiff line numberDiff line change
@@ -1232,6 +1232,7 @@
12321232
#define TR_MENU_DISPLAY "DISPLAY"
12331233
#define TR_MENU_OTHER "Övrigt"
12341234
#define TR_MENU_INVERT "Invertera"
1235+
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
12351236
#define TR_JITTER_FILTER "ADC-filter"
12361237
#define TR_DEAD_ZONE "Dödläge"
12371238
#define TR_RTC_CHECK TR("Kolla RTC", "Kolla RTC-batteriet")

radio/src/translations/tw.h

+1
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,7 @@
11881188
#define TR_MENU_DISPLAY "顯示"
11891189
#define TR_MENU_OTHER "其它"
11901190
#define TR_MENU_INVERT "反向"
1191+
#define TR_AUDIO_MUTE TR("Audio mute","Mute if no sound")
11911192
#define TR_JITTER_FILTER "類比輸入濾波"
11921193
#define TR_DEAD_ZONE "死區"
11931194
#define TR_RTC_CHECK TR("檢查時間電池", "檢查時間驅動電池電壓")

0 commit comments

Comments
 (0)