diff --git a/openrtx/include/core/settings.h b/openrtx/include/core/settings.h index 25908e3d..51916bf8 100644 --- a/openrtx/include/core/settings.h +++ b/openrtx/include/core/settings.h @@ -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 diff --git a/openrtx/include/ui/EnglishStrings.h b/openrtx/include/ui/EnglishStrings.h index 245876f2..334a2eec 100644 --- a/openrtx/include/ui/EnglishStrings.h +++ b/openrtx/include/ui/EnglishStrings.h @@ -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 diff --git a/openrtx/include/ui/ui_default.h b/openrtx/include/ui/ui_default.h index 8f0035b1..508722c8 100644 --- a/openrtx/include/ui/ui_default.h +++ b/openrtx/include/ui/ui_default.h @@ -131,6 +131,7 @@ enum settingsGPSItems enum settingsAccessibilityItems { + A_MACRO_LATCH = 0, A_LEVEL, A_PHONETIC, }; diff --git a/openrtx/include/ui/ui_strings.h b/openrtx/include/ui/ui_strings.h index d173e140..9a9061b6 100644 --- a/openrtx/include/ui/ui_strings.h +++ b/openrtx/include/ui/ui_strings.h @@ -98,6 +98,7 @@ typedef struct const char* broadcast; const char* radioSettings; const char* frequencyOffset; + const char* macroLatching; } stringsTable_t; diff --git a/openrtx/src/ui/default/ui.c b/openrtx/src/ui/default/ui.c index d4f9cf22..8f85e3b8 100644 --- a/openrtx/src/ui/default/ui.c +++ b/openrtx/src/ui/default/ui.c @@ -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; diff --git a/openrtx/src/ui/default/ui_menu.c b/openrtx/src/ui/default/ui_menu.c index 14511e7c..b365dda6 100644 --- a/openrtx/src/ui/default/ui_menu.c +++ b/openrtx/src/ui/default/ui_menu.c @@ -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; }