Added macro menu latching setting

pull/227/head
Morgan Diepart 2023-11-18 23:03:55 +01:00 zatwierdzone przez Silvano Seva
rodzic b1fa154ad9
commit 5ec0587c48
6 zmienionych plików z 39 dodań i 11 usunięć

Wyświetl plik

@ -58,7 +58,8 @@ typedef struct
m17_can : 4; // M17 CAN m17_can : 4; // M17 CAN
uint8_t vpLevel : 3, // Voice prompt level uint8_t vpLevel : 3, // Voice prompt level
vpPhoneticSpell : 1, // Phonetic spell enabled 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 bool m17_can_rx; // Check M17 CAN on RX
char m17_dest[10]; // M17 destination char m17_dest[10]; // M17 destination
} }
@ -82,6 +83,7 @@ static const settings_t default_settings =
0, // M17 CAN 0, // M17 CAN
0, // Voice prompts off 0, // Voice prompts off
0, // Phonetic spell off 0, // Phonetic spell off
1, // Automatic latch of macro menu enabled
0, // not used 0, // not used
false, // Check M17 CAN on RX false, // Check M17 CAN on RX
"" // Empty M17 destination "" // Empty M17 destination

Wyświetl plik

@ -93,6 +93,7 @@ const stringsTable_t englishStrings =
.usedHeap = "Used heap", .usedHeap = "Used heap",
.broadcast = "ALL", .broadcast = "ALL",
.radioSettings = "Radio Settings", .radioSettings = "Radio Settings",
.frequencyOffset = "Frequency Offset" .frequencyOffset = "Frequency Offset",
.macroLatching = "Macro Latching"
}; };
#endif // ENGLISHSTRINGS_H #endif // ENGLISHSTRINGS_H

Wyświetl plik

@ -131,6 +131,7 @@ enum settingsGPSItems
enum settingsAccessibilityItems enum settingsAccessibilityItems
{ {
A_MACRO_LATCH = 0,
A_LEVEL, A_LEVEL,
A_PHONETIC, A_PHONETIC,
}; };

Wyświetl plik

@ -98,6 +98,7 @@ typedef struct
const char* broadcast; const char* broadcast;
const char* radioSettings; const char* radioSettings;
const char* frequencyOffset; const char* frequencyOffset;
const char* macroLatching;
} }
stringsTable_t; stringsTable_t;

Wyświetl plik

@ -181,6 +181,7 @@ const char * settings_m17_items[] =
const char * settings_accessibility_items[] = const char * settings_accessibility_items[] =
{ {
"Macro Latch",
"Voice", "Voice",
"Phonetic" "Phonetic"
}; };
@ -774,6 +775,14 @@ static void _ui_changeTimer(int variation)
state.settings.display_timer += variation; state.settings.display_timer += variation;
} }
static void _ui_changeMacroLatch(bool newVal)
{
state.settings.macroMenuLatch = newVal ? 1 : 0;
vp_announceSettingsOnOffToggle(&currentLanguage->macroLatching,
vp_getVoiceLevelQueueFlags(),
state.settings.macroMenuLatch);
}
static inline void _ui_changeM17Can(int variation) static inline void _ui_changeM17Can(int variation)
{ {
uint8_t can = state.settings.m17_can; uint8_t can = state.settings.m17_can;
@ -1381,6 +1390,9 @@ void ui_updateFSM(bool *sync_rtx)
if(moniPressed || macro_latched) if(moniPressed || macro_latched)
{ {
macro_menu = true; macro_menu = true;
if(state.settings.macroMenuLatch == 1)
{
// long press moni on its own latches function. // long press moni on its own latches function.
if (moniPressed && msg.long_press && !macro_latched) if (moniPressed && msg.long_press && !macro_latched)
{ {
@ -1392,6 +1404,8 @@ void ui_updateFSM(bool *sync_rtx)
macro_latched = false; macro_latched = false;
vp_beep(BEEP_FUNCTION_LATCH_OFF, LONG_BEEP); vp_beep(BEEP_FUNCTION_LATCH_OFF, LONG_BEEP);
} }
}
_ui_fsm_menuMacro(msg, sync_rtx); _ui_fsm_menuMacro(msg, sync_rtx);
return; return;
} }
@ -2317,6 +2331,9 @@ void ui_updateFSM(bool *sync_rtx)
{ {
switch(ui_state.menu_selected) switch(ui_state.menu_selected)
{ {
case A_MACRO_LATCH:
_ui_changeMacroLatch(false);
break;
case A_LEVEL: case A_LEVEL:
_ui_changeVoiceLevel(-1); _ui_changeVoiceLevel(-1);
break; break;
@ -2332,6 +2349,9 @@ void ui_updateFSM(bool *sync_rtx)
{ {
switch(ui_state.menu_selected) switch(ui_state.menu_selected)
{ {
case A_MACRO_LATCH:
_ui_changeMacroLatch(true);
break;
case A_LEVEL: case A_LEVEL:
_ui_changeVoiceLevel(1); _ui_changeVoiceLevel(1);
break; break;

Wyświetl plik

@ -439,6 +439,9 @@ int _ui_getAccessibilityValueName(char *buf, uint8_t max_len, uint8_t index)
case A_PHONETIC: case A_PHONETIC:
snprintf(buf, max_len, "%s", last_state.settings.vpPhoneticSpell ? currentLanguage->on : currentLanguage->off); snprintf(buf, max_len, "%s", last_state.settings.vpPhoneticSpell ? currentLanguage->on : currentLanguage->off);
break; break;
case A_MACRO_LATCH:
snprintf(buf, max_len, "%s", last_state.settings.macroMenuLatch ? currentLanguage->on : currentLanguage->off);
break;
} }
return 0; return 0;
} }