VFO copy fix.

This commit is contained in:
Nunu 2023-12-16 16:21:07 +01:00
parent 4e976cae23
commit 7319b7a9c2
3 changed files with 44 additions and 20 deletions

View File

@ -41,6 +41,34 @@ void COMMON_SwitchVFOs()
gRequestDisplayScreen = DISPLAY_MAIN;
}
void COMMON_SwitchToVFOMode()
{
gEeprom.ScreenChannel[gEeprom.TX_VFO] = gEeprom.FreqChannel[gEeprom.TX_VFO];
#ifdef ENABLE_VOICE
gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE;
#endif
const uint8_t Vfo = gEeprom.TX_VFO;
SETTINGS_SaveVfoIndices();
RADIO_ConfigureChannel(Vfo, VFO_CONFIGURE_RELOAD);
return;
}
void COMMON_SwitchToChannelMode()
{
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;
}
}
void COMMON_SwitchVFOMode()
{
#ifdef ENABLE_NOAA
@ -51,27 +79,12 @@ void COMMON_SwitchVFOMode()
{
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;
COMMON_SwitchToVFOMode();
}
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;
else
{
//swap to channel mode
COMMON_SwitchToChannelMode();
}
}
}

View File

@ -9,5 +9,7 @@
void COMMON_KeypadLockToggle();
void COMMON_SwitchVFOs();
void COMMON_SwitchVFOMode();
void COMMON_SwitchToVFOMode();
void COMMON_SwitchToChannelMode();
#endif

View File

@ -18,6 +18,9 @@
#include "driver/backlight.h"
#include "audio.h"
#include "ui/helper.h"
#ifdef ENABLE_SPECTRUM_COPY_VFO
#include "common.h"
#endif
struct FrequencyBandInfo {
uint32_t lower;
@ -266,6 +269,12 @@ static void TuneToPeak() {
}
#ifdef ENABLE_SPECTRUM_COPY_VFO
static void ExitAndCopyToVfo() {
//if we are in the channel mode
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)){
// swap to frequency mode
COMMON_SwitchToVFOMode();
}
gTxVfo->STEP_SETTING = FREQUENCY_GetStepIdxFromStepFrequency(GetScanStep());
gTxVfo->Modulation = settings.modulationType;
// TODO: Add support for NARROW- bandwidth in VFO (settings etc)