diff --git a/app/action.c b/app/action.c index c8911ca..194ddb6 100644 --- a/app/action.c +++ b/app/action.c @@ -437,5 +437,8 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) case ACTION_OPT_A_B: COMMON_SwitchVFOs(); break; + case ACTION_OPT_VFO_MR: + COMMON_SwitchVFOMode(); + break; } } diff --git a/app/common.c b/app/common.c index c3ff6ef..cb05689 100644 --- a/app/common.c +++ b/app/common.c @@ -34,4 +34,39 @@ void COMMON_SwitchVFOs() gScheduleDualWatch = true; gRequestDisplayScreen = DISPLAY_MAIN; +} + +void COMMON_SwitchVFOMode() +{ +#ifdef ENABLE_NOAA + if (gEeprom.VFO_OPEN && IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE)) +#else + if (gEeprom.VFO_OPEN) +#endif + { + if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) + { // swap to frequency mode + gEeprom.ScreenChannel[gEeprom.TX_VFO] = gEeprom.FreqChannel[gEeprom.TX_VFO]; + #ifdef ENABLE_VOICE + gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE; + #endif + gRequestSaveVFO = true; + gVfoConfigureMode = VFO_CONFIGURE_RELOAD; + return; + } + + uint8_t Channel = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_VFO], 1, false, 0); + if (Channel != 0xFF) + { // swap to channel mode + gEeprom.ScreenChannel[gEeprom.TX_VFO] = Channel; + #ifdef ENABLE_VOICE + AUDIO_SetVoiceID(0, VOICE_ID_CHANNEL_MODE); + AUDIO_SetDigitVoice(1, Channel + 1); + gAnotherVoiceID = (VOICE_ID_t)0xFE; + #endif + gRequestSaveVFO = true; + gVfoConfigureMode = VFO_CONFIGURE_RELOAD; + return; + } + } } \ No newline at end of file diff --git a/app/common.h b/app/common.h index 506d3c2..97ea9dc 100644 --- a/app/common.h +++ b/app/common.h @@ -8,5 +8,6 @@ void COMMON_KeypadLockToggle(); void COMMON_SwitchVFOs(); +void COMMON_SwitchVFOMode(); #endif \ No newline at end of file diff --git a/app/main.c b/app/main.c index 3c76e04..1dd3c1f 100644 --- a/app/main.c +++ b/app/main.c @@ -183,37 +183,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) break; case KEY_3: - #ifdef ENABLE_NOAA - if (gEeprom.VFO_OPEN && IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE)) - #else - if (gEeprom.VFO_OPEN) - #endif - { - if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) - { // swap to frequency mode - gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_VFO]; - #ifdef ENABLE_VOICE - gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE; - #endif - gRequestSaveVFO = true; - gVfoConfigureMode = VFO_CONFIGURE_RELOAD; - break; - } - - uint8_t Channel = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_VFO], 1, false, 0); - if (Channel != 0xFF) - { // swap to channel mode - gEeprom.ScreenChannel[Vfo] = Channel; - #ifdef ENABLE_VOICE - AUDIO_SetVoiceID(0, VOICE_ID_CHANNEL_MODE); - AUDIO_SetDigitVoice(1, Channel + 1); - gAnotherVoiceID = (VOICE_ID_t)0xFE; - #endif - gRequestSaveVFO = true; - gVfoConfigureMode = VFO_CONFIGURE_RELOAD; - break; - } - } + COMMON_SwitchVFOMode(); if (beep) gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; diff --git a/settings.h b/settings.h index 6436092..87912a5 100644 --- a/settings.h +++ b/settings.h @@ -82,6 +82,7 @@ enum { ACTION_OPT_1750, ACTION_OPT_KEYLOCK, ACTION_OPT_A_B, + ACTION_OPT_VFO_MR, ACTION_OPT_LEN }; diff --git a/ui/menu.c b/ui/menu.c index c541e02..478d10d 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -351,6 +351,7 @@ const t_sidefunction SIDEFUNCTIONS[] = #endif {"LOCK\nKEYPAD", ACTION_OPT_KEYLOCK}, {"SWITCH\nVFO", ACTION_OPT_A_B}, + {"VFO/MR", ACTION_OPT_VFO_MR}, }; const t_sidefunction* gSubMenu_SIDEFUNCTIONS = SIDEFUNCTIONS; const uint8_t gSubMenu_SIDEFUNCTIONS_size = ARRAY_SIZE(SIDEFUNCTIONS);