kopia lustrzana https://github.com/OpenRTX/OpenRTX
Added macro menu latching setting
rodzic
b1fa154ad9
commit
5ec0587c48
|
@ -58,7 +58,8 @@ typedef struct
|
|||
m17_can : 4; // M17 CAN
|
||||
uint8_t vpLevel : 3, // Voice prompt level
|
||||
vpPhoneticSpell : 1, // Phonetic spell enabled
|
||||
_reserved : 4;
|
||||
macroMenuLatch : 1, // Automatic latch of macro menu
|
||||
_reserved : 3;
|
||||
bool m17_can_rx; // Check M17 CAN on RX
|
||||
char m17_dest[10]; // M17 destination
|
||||
}
|
||||
|
@ -82,6 +83,7 @@ static const settings_t default_settings =
|
|||
0, // M17 CAN
|
||||
0, // Voice prompts off
|
||||
0, // Phonetic spell off
|
||||
1, // Automatic latch of macro menu enabled
|
||||
0, // not used
|
||||
false, // Check M17 CAN on RX
|
||||
"" // Empty M17 destination
|
||||
|
|
|
@ -93,6 +93,7 @@ const stringsTable_t englishStrings =
|
|||
.usedHeap = "Used heap",
|
||||
.broadcast = "ALL",
|
||||
.radioSettings = "Radio Settings",
|
||||
.frequencyOffset = "Frequency Offset"
|
||||
.frequencyOffset = "Frequency Offset",
|
||||
.macroLatching = "Macro Latching"
|
||||
};
|
||||
#endif // ENGLISHSTRINGS_H
|
||||
|
|
|
@ -131,6 +131,7 @@ enum settingsGPSItems
|
|||
|
||||
enum settingsAccessibilityItems
|
||||
{
|
||||
A_MACRO_LATCH = 0,
|
||||
A_LEVEL,
|
||||
A_PHONETIC,
|
||||
};
|
||||
|
|
|
@ -98,6 +98,7 @@ typedef struct
|
|||
const char* broadcast;
|
||||
const char* radioSettings;
|
||||
const char* frequencyOffset;
|
||||
const char* macroLatching;
|
||||
}
|
||||
stringsTable_t;
|
||||
|
||||
|
|
|
@ -181,6 +181,7 @@ const char * settings_m17_items[] =
|
|||
|
||||
const char * settings_accessibility_items[] =
|
||||
{
|
||||
"Macro Latch",
|
||||
"Voice",
|
||||
"Phonetic"
|
||||
};
|
||||
|
@ -774,6 +775,14 @@ static void _ui_changeTimer(int variation)
|
|||
state.settings.display_timer += variation;
|
||||
}
|
||||
|
||||
static void _ui_changeMacroLatch(bool newVal)
|
||||
{
|
||||
state.settings.macroMenuLatch = newVal ? 1 : 0;
|
||||
vp_announceSettingsOnOffToggle(¤tLanguage->macroLatching,
|
||||
vp_getVoiceLevelQueueFlags(),
|
||||
state.settings.macroMenuLatch);
|
||||
}
|
||||
|
||||
static inline void _ui_changeM17Can(int variation)
|
||||
{
|
||||
uint8_t can = state.settings.m17_can;
|
||||
|
@ -1381,17 +1390,22 @@ void ui_updateFSM(bool *sync_rtx)
|
|||
if(moniPressed || macro_latched)
|
||||
{
|
||||
macro_menu = true;
|
||||
// long press moni on its own latches function.
|
||||
if (moniPressed && msg.long_press && !macro_latched)
|
||||
|
||||
if(state.settings.macroMenuLatch == 1)
|
||||
{
|
||||
macro_latched = true;
|
||||
vp_beep(BEEP_FUNCTION_LATCH_ON, LONG_BEEP);
|
||||
}
|
||||
else if (moniPressed && macro_latched)
|
||||
{
|
||||
macro_latched = false;
|
||||
vp_beep(BEEP_FUNCTION_LATCH_OFF, LONG_BEEP);
|
||||
// long press moni on its own latches function.
|
||||
if (moniPressed && msg.long_press && !macro_latched)
|
||||
{
|
||||
macro_latched = true;
|
||||
vp_beep(BEEP_FUNCTION_LATCH_ON, LONG_BEEP);
|
||||
}
|
||||
else if (moniPressed && macro_latched)
|
||||
{
|
||||
macro_latched = false;
|
||||
vp_beep(BEEP_FUNCTION_LATCH_OFF, LONG_BEEP);
|
||||
}
|
||||
}
|
||||
|
||||
_ui_fsm_menuMacro(msg, sync_rtx);
|
||||
return;
|
||||
}
|
||||
|
@ -2317,6 +2331,9 @@ void ui_updateFSM(bool *sync_rtx)
|
|||
{
|
||||
switch(ui_state.menu_selected)
|
||||
{
|
||||
case A_MACRO_LATCH:
|
||||
_ui_changeMacroLatch(false);
|
||||
break;
|
||||
case A_LEVEL:
|
||||
_ui_changeVoiceLevel(-1);
|
||||
break;
|
||||
|
@ -2332,6 +2349,9 @@ void ui_updateFSM(bool *sync_rtx)
|
|||
{
|
||||
switch(ui_state.menu_selected)
|
||||
{
|
||||
case A_MACRO_LATCH:
|
||||
_ui_changeMacroLatch(true);
|
||||
break;
|
||||
case A_LEVEL:
|
||||
_ui_changeVoiceLevel(1);
|
||||
break;
|
||||
|
|
|
@ -439,6 +439,9 @@ int _ui_getAccessibilityValueName(char *buf, uint8_t max_len, uint8_t index)
|
|||
case A_PHONETIC:
|
||||
snprintf(buf, max_len, "%s", last_state.settings.vpPhoneticSpell ? currentLanguage->on : currentLanguage->off);
|
||||
break;
|
||||
case A_MACRO_LATCH:
|
||||
snprintf(buf, max_len, "%s", last_state.settings.macroMenuLatch ? currentLanguage->on : currentLanguage->off);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue