Rename RX_CHANNEL and TX_CHANNEL to RX_VFO and TX_VFO to be much less confusing

This commit is contained in:
OneOfEleven 2023-10-05 01:07:04 +01:00
parent d632698428
commit e042b21e65
14 changed files with 111 additions and 98 deletions

View File

@ -206,7 +206,7 @@ void ACTION_Scan(bool bRestart)
#endif #endif
// clear the other vfo's rssi level (to hide the antenna symbol) // clear the other vfo's rssi level (to hide the antenna symbol)
gVFO_RSSI_bar_level[(gEeprom.RX_CHANNEL + 1) & 1u] = 0; gVFO_RSSI_bar_level[(gEeprom.RX_VFO + 1) & 1u] = 0;
// let the user see DW is not active // let the user see DW is not active
gDualWatchActive = false; gDualWatchActive = false;

View File

@ -122,7 +122,7 @@ static void APP_CheckForIncoming(void)
FUNCTION_Select(FUNCTION_INCOMING); FUNCTION_Select(FUNCTION_INCOMING);
//gUpdateDisplay = true; //gUpdateDisplay = true;
updateRSSI(gEeprom.RX_CHANNEL); updateRSSI(gEeprom.RX_VFO);
gUpdateRSSI = true; gUpdateRSSI = true;
} }
@ -138,7 +138,7 @@ static void APP_CheckForIncoming(void)
FUNCTION_Select(FUNCTION_INCOMING); FUNCTION_Select(FUNCTION_INCOMING);
//gUpdateDisplay = true; //gUpdateDisplay = true;
updateRSSI(gEeprom.RX_CHANNEL); updateRSSI(gEeprom.RX_VFO);
gUpdateRSSI = true; gUpdateRSSI = true;
} }
return; return;
@ -160,7 +160,7 @@ static void APP_CheckForIncoming(void)
FUNCTION_Select(FUNCTION_INCOMING); FUNCTION_Select(FUNCTION_INCOMING);
//gUpdateDisplay = true; //gUpdateDisplay = true;
updateRSSI(gEeprom.RX_CHANNEL); updateRSSI(gEeprom.RX_VFO);
gUpdateRSSI = true; gUpdateRSSI = true;
} }
@ -178,7 +178,7 @@ static void APP_CheckForIncoming(void)
FUNCTION_Select(FUNCTION_INCOMING); FUNCTION_Select(FUNCTION_INCOMING);
//gUpdateDisplay = true; //gUpdateDisplay = true;
updateRSSI(gEeprom.RX_CHANNEL); updateRSSI(gEeprom.RX_VFO);
gUpdateRSSI = true; gUpdateRSSI = true;
} }
} }
@ -468,7 +468,7 @@ static void APP_HandleFunction(void)
void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix) void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
{ {
const unsigned int chan = gEeprom.RX_CHANNEL; const unsigned int chan = gEeprom.RX_VFO;
// const unsigned int chan = gRxVfo->CHANNEL_SAVE; // const unsigned int chan = gRxVfo->CHANNEL_SAVE;
if (gSetting_KILLED) if (gSetting_KILLED)
@ -679,7 +679,7 @@ static void MR_NextChannel(void)
// dual watch is enabled - include the other VFO in the scan // dual watch is enabled - include the other VFO in the scan
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
{ {
chan = (gEeprom.RX_CHANNEL + 1) & 1u; chan = (gEeprom.RX_VFO + 1) & 1u;
chan = gEeprom.ScreenChannel[chan]; chan = gEeprom.ScreenChannel[chan];
if (IS_MR_CHANNEL(chan)) if (IS_MR_CHANNEL(chan))
{ {
@ -713,10 +713,10 @@ static void MR_NextChannel(void)
if (gNextMrChannel != prev_chan) if (gNextMrChannel != prev_chan)
{ {
gEeprom.MrChannel[ gEeprom.RX_CHANNEL] = gNextMrChannel; gEeprom.MrChannel[ gEeprom.RX_VFO] = gNextMrChannel;
gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = gNextMrChannel; gEeprom.ScreenChannel[gEeprom.RX_VFO] = gNextMrChannel;
RADIO_ConfigureChannel(gEeprom.RX_CHANNEL, VFO_CONFIGURE_RELOAD); RADIO_ConfigureChannel(gEeprom.RX_VFO, VFO_CONFIGURE_RELOAD);
RADIO_SetupRegisters(true); RADIO_SetupRegisters(true);
gUpdateDisplay = true; gUpdateDisplay = true;
@ -749,11 +749,11 @@ static void DUALWATCH_Alternate(void)
if (gIsNoaaMode) if (gIsNoaaMode)
{ {
if (IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) || IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[1])) if (IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) || IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[1]))
gEeprom.RX_CHANNEL = (gEeprom.RX_CHANNEL + 1) & 1; gEeprom.RX_VFO = (gEeprom.RX_VFO + 1) & 1;
else else
gEeprom.RX_CHANNEL = 0; gEeprom.RX_VFO = 0;
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_CHANNEL]; gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_VFO];
if (gEeprom.VfoInfo[0].CHANNEL_SAVE >= NOAA_CHANNEL_FIRST) if (gEeprom.VfoInfo[0].CHANNEL_SAVE >= NOAA_CHANNEL_FIRST)
NOAA_IncreaseChannel(); NOAA_IncreaseChannel();
@ -761,8 +761,8 @@ static void DUALWATCH_Alternate(void)
else else
#endif #endif
{ // toggle between VFO's { // toggle between VFO's
gEeprom.RX_CHANNEL = (gEeprom.RX_CHANNEL + 1) & 1; gEeprom.RX_VFO = (gEeprom.RX_VFO + 1) & 1;
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_CHANNEL]; gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_VFO];
if (!gDualWatchActive) if (!gDualWatchActive)
{ // let the user see DW is active { // let the user see DW is active
@ -1250,7 +1250,7 @@ void APP_Update(void)
if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF || gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF || gUpdateRSSI) if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF || gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF || gUpdateRSSI)
{ // dual watch mode, go back to sleep { // dual watch mode, go back to sleep
updateRSSI(gEeprom.RX_CHANNEL); updateRSSI(gEeprom.RX_VFO);
// go back to sleep // go back to sleep
@ -1410,9 +1410,9 @@ void APP_TimeSlice10ms(void)
#endif #endif
#ifdef ENABLE_AM_FIX #ifdef ENABLE_AM_FIX
// if (gEeprom.VfoInfo[gEeprom.RX_CHANNEL].AM_mode && gSetting_AM_fix) // if (gEeprom.VfoInfo[gEeprom.RX_VFO].AM_mode && gSetting_AM_fix)
if (gRxVfo->AM_mode && gSetting_AM_fix) if (gRxVfo->AM_mode && gSetting_AM_fix)
AM_fix_10ms(gEeprom.RX_CHANNEL); AM_fix_10ms(gEeprom.RX_VFO);
#endif #endif
if (UART_IsCommandAvailable()) if (UART_IsCommandAvailable())
@ -1800,7 +1800,7 @@ void APP_TimeSlice500ms(void)
if (gCurrentFunction != FUNCTION_TRANSMIT) if (gCurrentFunction != FUNCTION_TRANSMIT)
{ {
if (gCurrentFunction != FUNCTION_POWER_SAVE) if (gCurrentFunction != FUNCTION_POWER_SAVE)
updateRSSI(gEeprom.RX_CHANNEL); updateRSSI(gEeprom.RX_VFO);
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
if ((gFM_ScanState == FM_SCAN_OFF || gAskToSave) && gCssScanMode == CSS_SCAN_MODE_OFF) if ((gFM_ScanState == FM_SCAN_OFF || gAskToSave) && gCssScanMode == CSS_SCAN_MODE_OFF)
@ -2110,10 +2110,10 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
if (gFlagSaveChannel) if (gFlagSaveChannel)
{ {
SETTINGS_SaveChannel(gTxVfo->CHANNEL_SAVE, gEeprom.TX_CHANNEL, gTxVfo, gFlagSaveChannel); SETTINGS_SaveChannel(gTxVfo->CHANNEL_SAVE, gEeprom.TX_VFO, gTxVfo, gFlagSaveChannel);
gFlagSaveChannel = false; gFlagSaveChannel = false;
RADIO_ConfigureChannel(gEeprom.TX_CHANNEL, VFO_CONFIGURE); RADIO_ConfigureChannel(gEeprom.TX_VFO, VFO_CONFIGURE);
RADIO_SetupRegisters(true); RADIO_SetupRegisters(true);
GUI_SelectNextDisplay(DISPLAY_MAIN); GUI_SelectNextDisplay(DISPLAY_MAIN);
@ -2435,7 +2435,7 @@ Skip:
{ {
if (!bKeyHeld) if (!bKeyHeld)
{ {
SETTINGS_SaveChannel(gTxVfo->CHANNEL_SAVE, gEeprom.TX_CHANNEL, gTxVfo, gRequestSaveChannel); SETTINGS_SaveChannel(gTxVfo->CHANNEL_SAVE, gEeprom.TX_VFO, gTxVfo, gRequestSaveChannel);
if (gScreenToDisplay != DISPLAY_SCANNER) if (gScreenToDisplay != DISPLAY_SCANNER)
if (gVfoConfigureMode == VFO_CONFIGURE_NONE) // 'if' is so as we don't wipe out previously setting this variable elsewhere if (gVfoConfigureMode == VFO_CONFIGURE_NONE) // 'if' is so as we don't wipe out previously setting this variable elsewhere
@ -2460,7 +2460,7 @@ Skip:
RADIO_ConfigureChannel(1, gVfoConfigureMode); RADIO_ConfigureChannel(1, gVfoConfigureMode);
} }
else else
RADIO_ConfigureChannel(gEeprom.TX_CHANNEL, gVfoConfigureMode); RADIO_ConfigureChannel(gEeprom.TX_VFO, gVfoConfigureMode);
if (gRequestDisplayScreen == DISPLAY_INVALID) if (gRequestDisplayScreen == DISPLAY_INVALID)
gRequestDisplayScreen = DISPLAY_MAIN; gRequestDisplayScreen = DISPLAY_MAIN;

View File

@ -38,7 +38,7 @@
static void processFKeyFunction(const KEY_Code_t Key, const bool beep) static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
{ {
uint8_t Band; uint8_t Band;
uint8_t Vfo = gEeprom.TX_CHANNEL; uint8_t Vfo = gEeprom.TX_VFO;
switch (Key) switch (Key)
{ {
@ -99,7 +99,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B) if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B)
gEeprom.DUAL_WATCH = DUAL_WATCH_CHAN_A; gEeprom.DUAL_WATCH = DUAL_WATCH_CHAN_A;
else else
gEeprom.TX_CHANNEL = (Vfo + 1) & 1u; gEeprom.TX_VFO = (Vfo + 1) & 1u;
gRequestSaveSettings = 1; gRequestSaveSettings = 1;
gFlagReconfigureVfos = true; gFlagReconfigureVfos = true;
@ -122,7 +122,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
{ // swap to frequency mode { // swap to frequency mode
gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_CHANNEL]; gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_VFO];
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE; gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE;
#endif #endif
@ -131,7 +131,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
break; break;
} }
Channel = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_CHANNEL], 1, false, 0); Channel = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_VFO], 1, false, 0);
if (Channel != 0xFF) if (Channel != 0xFF)
{ // swap to channel mode { // swap to channel mode
gEeprom.ScreenChannel[Vfo] = Channel; gEeprom.ScreenChannel[Vfo] = Channel;
@ -166,24 +166,24 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
case KEY_5: case KEY_5:
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE)) if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
{ {
gEeprom.ScreenChannel[Vfo] = gEeprom.NoaaChannel[gEeprom.TX_CHANNEL]; gEeprom.ScreenChannel[Vfo] = gEeprom.NoaaChannel[gEeprom.TX_VFO];
} }
else else
{ {
gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_CHANNEL]; gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_VFO];
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE; gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE;
#endif #endif
} }
gRequestSaveVFO = true; gRequestSaveVFO = true;
gVfoConfigureMode = VFO_CONFIGURE_RELOAD; gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
#else #else
// toggle the selected channels scanlist setting // toggle the selected channels scanlist setting
if (gScreenToDisplay != DISPLAY_SCANNER) if (gScreenToDisplay != DISPLAY_SCANNER)
{ {
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
@ -207,9 +207,9 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
gFlagResetVfos = true; gFlagResetVfos = true;
} }
} }
#endif #endif
break; break;
case KEY_6: case KEY_6:
@ -220,7 +220,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
#ifdef ENABLE_VOX #ifdef ENABLE_VOX
ACTION_Vox(); ACTION_Vox();
#else #else
// TODO: make use of this function key // TODO: make use of this function key
@ -305,7 +305,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
if (!gWasFKeyPressed) if (!gWasFKeyPressed)
{ // F-key wasn't pressed { // F-key wasn't pressed
const uint8_t Vfo = gEeprom.TX_CHANNEL; const uint8_t Vfo = gEeprom.TX_VFO;
gKeyInputCountdown = key_input_timeout_500ms; gKeyInputCountdown = key_input_timeout_500ms;
@ -554,31 +554,44 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
gUpdateStatus = true; gUpdateStatus = true;
#ifdef ENABLE_COPY_CHAN_TO_VFO #ifdef ENABLE_COPY_CHAN_TO_VFO
if (gEeprom.VFO_OPEN && if (gEeprom.VFO_OPEN &&
gScanState == SCAN_OFF && gScanState == SCAN_OFF &&
gCssScanMode == CSS_SCAN_MODE_OFF) gCssScanMode == CSS_SCAN_MODE_OFF)
{ // copy channel to VFO { // copy channel to VFO
const unsigned int vfo = (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL; //const unsigned int vfo = (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
unsigned int vfo = gEeprom.TX_VFO;
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_B)
vfo = 1;
else
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_A)
vfo = 0;
else
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B)
vfo = 1;
else
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_A)
vfo = 0;
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF)
vfo = (vfo + 1) & 1u;
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo])) if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo]))
{ { // swap to the VFO
const unsigned int channel = FREQ_CHANNEL_FIRST + gEeprom.VfoInfo[vfo].Band; const unsigned int channel = FREQ_CHANNEL_FIRST + gEeprom.VfoInfo[vfo].Band;
gEeprom.ScreenChannel[vfo] = channel; gEeprom.ScreenChannel[vfo] = channel;
gEeprom.VfoInfo[vfo].CHANNEL_SAVE = channel; gEeprom.VfoInfo[vfo].CHANNEL_SAVE = channel;
gEeprom.TX_VFO = vfo;
// swap to the VFO
gEeprom.TX_CHANNEL = vfo;
gEeprom.RX_CHANNEL = vfo;
RADIO_SelectVfos(); RADIO_SelectVfos();
RADIO_ApplyOffset(gRxVfo); RADIO_ApplyOffset(gRxVfo);
RADIO_ConfigureSquelchAndOutputPower(gRxVfo); RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
RADIO_SetupRegisters(true); RADIO_SetupRegisters(true);
//SETTINGS_SaveChannel(channel, gEeprom.RX_CHANNEL, gRxVfo, 1); //SETTINGS_SaveChannel(channel, gEeprom.RX_VFO, gRxVfo, 1);
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
gUpdateStatus = true; gUpdateStatus = true;
@ -589,7 +602,7 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
{ {
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
} }
#endif #endif
} }
} }
@ -697,7 +710,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction) static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
{ {
uint8_t Channel = gEeprom.ScreenChannel[gEeprom.TX_CHANNEL]; uint8_t Channel = gEeprom.ScreenChannel[gEeprom.TX_VFO];
if (bKeyHeld || !bKeyPressed) if (bKeyHeld || !bKeyPressed)
{ {
@ -762,8 +775,8 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
if (Channel == Next) if (Channel == Next)
return; return;
gEeprom.MrChannel[gEeprom.TX_CHANNEL] = Next; gEeprom.MrChannel[gEeprom.TX_VFO] = Next;
gEeprom.ScreenChannel[gEeprom.TX_CHANNEL] = Next; gEeprom.ScreenChannel[gEeprom.TX_VFO] = Next;
if (!bKeyHeld) if (!bKeyHeld)
{ {
@ -776,9 +789,9 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
else else
{ {
Channel = NOAA_CHANNEL_FIRST + NUMBER_AddWithWraparound(gEeprom.ScreenChannel[gEeprom.TX_CHANNEL] - NOAA_CHANNEL_FIRST, Direction, 0, 9); Channel = NOAA_CHANNEL_FIRST + NUMBER_AddWithWraparound(gEeprom.ScreenChannel[gEeprom.TX_VFO] - NOAA_CHANNEL_FIRST, Direction, 0, 9);
gEeprom.NoaaChannel[gEeprom.TX_CHANNEL] = Channel; gEeprom.NoaaChannel[gEeprom.TX_VFO] = Channel;
gEeprom.ScreenChannel[gEeprom.TX_CHANNEL] = Channel; gEeprom.ScreenChannel[gEeprom.TX_VFO] = Channel;
} }
#endif #endif

View File

@ -472,7 +472,7 @@ void MENU_AcceptSetting(void)
#if 0 #if 0
gEeprom.MrChannel[0] = gSubMenuSelection; gEeprom.MrChannel[0] = gSubMenuSelection;
#else #else
gEeprom.MrChannel[gEeprom.TX_CHANNEL] = gSubMenuSelection; gEeprom.MrChannel[gEeprom.TX_VFO] = gSubMenuSelection;
#endif #endif
gRequestSaveChannel = 2; gRequestSaveChannel = 2;
gVfoConfigureMode = VFO_CONFIGURE_RELOAD; gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
@ -492,7 +492,7 @@ void MENU_AcceptSetting(void)
// save the channel name // save the channel name
memset(gTxVfo->Name, 0, sizeof(gTxVfo->Name)); memset(gTxVfo->Name, 0, sizeof(gTxVfo->Name));
memmove(gTxVfo->Name, edit, 10); memmove(gTxVfo->Name, edit, 10);
SETTINGS_SaveChannel(gSubMenuSelection, gEeprom.TX_CHANNEL, gTxVfo, 3); SETTINGS_SaveChannel(gSubMenuSelection, gEeprom.TX_VFO, gTxVfo, 3);
gFlagReconfigureVfos = true; gFlagReconfigureVfos = true;
return; return;
@ -921,12 +921,12 @@ void MENU_ShowCurrentSetting(void)
#if 0 #if 0
gSubMenuSelection = gEeprom.MrChannel[0]; gSubMenuSelection = gEeprom.MrChannel[0];
#else #else
gSubMenuSelection = gEeprom.MrChannel[gEeprom.TX_CHANNEL]; gSubMenuSelection = gEeprom.MrChannel[gEeprom.TX_VFO];
#endif #endif
break; break;
case MENU_MEM_NAME: case MENU_MEM_NAME:
gSubMenuSelection = gEeprom.MrChannel[gEeprom.TX_CHANNEL]; gSubMenuSelection = gEeprom.MrChannel[gEeprom.TX_VFO];
break; break;
case MENU_SAVE: case MENU_SAVE:
@ -1106,7 +1106,7 @@ void MENU_ShowCurrentSetting(void)
#if 0 #if 0
gSubMenuSelection = RADIO_FindNextChannel(gEeprom.MrChannel[0], 1, false, 1); gSubMenuSelection = RADIO_FindNextChannel(gEeprom.MrChannel[0], 1, false, 1);
#else #else
gSubMenuSelection = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_CHANNEL], 1, false, 1); gSubMenuSelection = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_VFO], 1, false, 1);
#endif #endif
break; break;

View File

@ -250,16 +250,16 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
{ {
Channel = gScanChannel; Channel = gScanChannel;
gEeprom.MrChannel[gEeprom.TX_CHANNEL] = Channel; gEeprom.MrChannel[gEeprom.TX_VFO] = Channel;
} }
else else
{ {
Channel = gTxVfo->Band + FREQ_CHANNEL_FIRST; Channel = gTxVfo->Band + FREQ_CHANNEL_FIRST;
gEeprom.FreqChannel[gEeprom.TX_CHANNEL] = Channel; gEeprom.FreqChannel[gEeprom.TX_VFO] = Channel;
} }
gTxVfo->CHANNEL_SAVE = Channel; gTxVfo->CHANNEL_SAVE = Channel;
gEeprom.ScreenChannel[gEeprom.TX_CHANNEL] = Channel; gEeprom.ScreenChannel[gEeprom.TX_VFO] = Channel;
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
gAnotherVoiceID = VOICE_ID_CONFIRM; gAnotherVoiceID = VOICE_ID_CONFIRM;
#endif #endif
@ -430,10 +430,10 @@ void SCANNER_Stop(void)
{ {
if (IS_MR_CHANNEL(gNextMrChannel)) if (IS_MR_CHANNEL(gNextMrChannel))
{ {
gEeprom.MrChannel[gEeprom.RX_CHANNEL] = gRestoreMrChannel; gEeprom.MrChannel[gEeprom.RX_VFO] = gRestoreMrChannel;
gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = Previous; gEeprom.ScreenChannel[gEeprom.RX_VFO] = Previous;
RADIO_ConfigureChannel(gEeprom.RX_CHANNEL, VFO_CONFIGURE_RELOAD); RADIO_ConfigureChannel(gEeprom.RX_VFO, VFO_CONFIGURE_RELOAD);
} }
else else
{ {
@ -450,7 +450,7 @@ void SCANNER_Stop(void)
{ {
RADIO_ApplyOffset(gRxVfo); RADIO_ApplyOffset(gRxVfo);
RADIO_ConfigureSquelchAndOutputPower(gRxVfo); RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
SETTINGS_SaveChannel(gRxVfo->CHANNEL_SAVE, gEeprom.RX_CHANNEL, gRxVfo, 1); SETTINGS_SaveChannel(gRxVfo->CHANNEL_SAVE, gEeprom.RX_VFO, gRxVfo, 1);
return; return;
} }

View File

@ -385,7 +385,7 @@ static void CMD_052F(const uint8_t *pBuffer)
gEeprom.DUAL_WATCH = DUAL_WATCH_OFF; gEeprom.DUAL_WATCH = DUAL_WATCH_OFF;
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF; gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
gEeprom.RX_CHANNEL = 0; gEeprom.RX_VFO = 0;
gEeprom.DTMF_SIDE_TONE = false; gEeprom.DTMF_SIDE_TONE = false;
gEeprom.VfoInfo[0].FrequencyReverse = false; gEeprom.VfoInfo[0].FrequencyReverse = false;
gEeprom.VfoInfo[0].pRX = &gEeprom.VfoInfo[0].freq_config_RX; gEeprom.VfoInfo[0].pRX = &gEeprom.VfoInfo[0].freq_config_RX;

View File

@ -616,7 +616,7 @@ void BOARD_EEPROM_Init(void)
#endif #endif
gEeprom.ROGER = (Data[1] < 3) ? Data[1] : ROGER_MODE_OFF; gEeprom.ROGER = (Data[1] < 3) ? Data[1] : ROGER_MODE_OFF;
gEeprom.REPEATER_TAIL_TONE_ELIMINATION = (Data[2] < 11) ? Data[2] : 0; gEeprom.REPEATER_TAIL_TONE_ELIMINATION = (Data[2] < 11) ? Data[2] : 0;
gEeprom.TX_CHANNEL = (Data[3] < 2) ? Data[3] : 0; gEeprom.TX_VFO = (Data[3] < 2) ? Data[3] : 0;
// 0ED0..0ED7 // 0ED0..0ED7
EEPROM_ReadBuffer(0x0ED0, Data, 8); EEPROM_ReadBuffer(0x0ED0, Data, 8);

Binary file not shown.

Binary file not shown.

2
main.c
View File

@ -193,7 +193,7 @@ void Main(void)
AUDIO_SetVoiceID(0, VOICE_ID_WELCOME); AUDIO_SetVoiceID(0, VOICE_ID_WELCOME);
Channel = gEeprom.ScreenChannel[gEeprom.TX_CHANNEL]; Channel = gEeprom.ScreenChannel[gEeprom.TX_VFO];
if (IS_MR_CHANNEL(Channel)) if (IS_MR_CHANNEL(Channel))
{ {
AUDIO_SetVoiceID(1, VOICE_ID_CHANNEL_MODE); AUDIO_SetVoiceID(1, VOICE_ID_CHANNEL_MODE);

26
radio.c
View File

@ -517,30 +517,30 @@ void RADIO_ApplyOffset(VFO_Info_t *pInfo)
static void RADIO_SelectCurrentVfo(void) static void RADIO_SelectCurrentVfo(void)
{ {
gCurrentVfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gRxVfo : &gEeprom.VfoInfo[gEeprom.TX_CHANNEL]; gCurrentVfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gRxVfo : &gEeprom.VfoInfo[gEeprom.TX_VFO];
} }
void RADIO_SelectVfos(void) void RADIO_SelectVfos(void)
{ {
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_B) if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_B)
gEeprom.TX_CHANNEL = 1; gEeprom.TX_VFO = 1;
else else
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_A) if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_A)
gEeprom.TX_CHANNEL = 0; gEeprom.TX_VFO = 0;
else else
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B) if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B)
gEeprom.TX_CHANNEL = 1; gEeprom.TX_VFO = 1;
else else
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_A) if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_A)
gEeprom.TX_CHANNEL = 0; gEeprom.TX_VFO = 0;
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF)
gEeprom.RX_CHANNEL = gEeprom.TX_CHANNEL; gEeprom.RX_VFO = gEeprom.TX_VFO;
else else
gEeprom.RX_CHANNEL = (gEeprom.TX_CHANNEL == 0) ? 1 : 0; gEeprom.RX_VFO = (gEeprom.TX_VFO == 0) ? 1 : 0;
gTxVfo = &gEeprom.VfoInfo[gEeprom.TX_CHANNEL]; gTxVfo = &gEeprom.VfoInfo[gEeprom.TX_VFO];
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_CHANNEL]; gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_VFO];
RADIO_SelectCurrentVfo(); RADIO_SelectCurrentVfo();
} }
@ -878,8 +878,8 @@ void RADIO_SetVfoState(VfoState_t State)
} }
else else
{ {
unsigned int chan = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gRxVfoIsActive) ? (gEeprom.RX_CHANNEL + 1) & 1 : gEeprom.RX_CHANNEL; // 1of11 unsigned int chan = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gRxVfoIsActive) ? (gEeprom.RX_VFO + 1) & 1 : gEeprom.RX_VFO; // 1of11
chan = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.TX_CHANNEL : chan; chan = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.TX_VFO : chan;
VfoState[chan] = State; VfoState[chan] = State;
} }
@ -903,8 +903,8 @@ void RADIO_PrepareTX(void)
if (!gRxVfoIsActive) if (!gRxVfoIsActive)
{ // use the TX vfo { // use the TX vfo
gEeprom.RX_CHANNEL = gEeprom.TX_CHANNEL; gEeprom.RX_VFO = gEeprom.TX_VFO;
gRxVfo = &gEeprom.VfoInfo[gEeprom.TX_CHANNEL]; gRxVfo = &gEeprom.VfoInfo[gEeprom.TX_VFO];
gRxVfoIsActive = true; gRxVfoIsActive = true;
} }

View File

@ -133,7 +133,7 @@ void SETTINGS_SaveSettings(void)
#endif #endif
State[1] = gEeprom.ROGER; State[1] = gEeprom.ROGER;
State[2] = gEeprom.REPEATER_TAIL_TONE_ELIMINATION; State[2] = gEeprom.REPEATER_TAIL_TONE_ELIMINATION;
State[3] = gEeprom.TX_CHANNEL; State[3] = gEeprom.TX_VFO;
EEPROM_WriteBuffer(0x0EA8, State); EEPROM_WriteBuffer(0x0EA8, State);
State[0] = gEeprom.DTMF_SIDE_TONE; State[0] = gEeprom.DTMF_SIDE_TONE;

View File

@ -121,8 +121,8 @@ typedef struct {
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
uint8_t NoaaChannel[2]; uint8_t NoaaChannel[2];
#endif #endif
uint8_t RX_CHANNEL; uint8_t RX_VFO;
uint8_t TX_CHANNEL; uint8_t TX_VFO;
uint8_t field7_0xa; uint8_t field7_0xa;
uint8_t field8_0xb; uint8_t field8_0xb;

View File

@ -332,8 +332,8 @@ void UI_DisplayMain(void)
for (vfo_num = 0; vfo_num < 2; vfo_num++) for (vfo_num = 0; vfo_num < 2; vfo_num++)
{ {
const unsigned int line = (vfo_num == 0) ? line0 : line1; const unsigned int line = (vfo_num == 0) ? line0 : line1;
uint8_t channel = gEeprom.TX_CHANNEL; uint8_t channel = gEeprom.TX_VFO;
// uint8_t tx_channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL; // uint8_t tx_channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
const bool same_vfo = (channel == vfo_num) ? true : false; const bool same_vfo = (channel == vfo_num) ? true : false;
uint8_t *p_line0 = gFrameBuffer[line + 0]; uint8_t *p_line0 = gFrameBuffer[line + 0];
uint8_t *p_line1 = gFrameBuffer[line + 1]; uint8_t *p_line1 = gFrameBuffer[line + 1];
@ -350,7 +350,7 @@ void UI_DisplayMain(void)
} }
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gRxVfoIsActive) if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gRxVfoIsActive)
channel = gEeprom.RX_CHANNEL; // we're currently monitoring the other VFO channel = gEeprom.RX_VFO; // we're currently monitoring the other VFO
if (channel != vfo_num) if (channel != vfo_num)
{ {
@ -428,7 +428,7 @@ void UI_DisplayMain(void)
else else
#endif #endif
{ {
channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL; channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
if (channel == vfo_num) if (channel == vfo_num)
{ // show the TX symbol { // show the TX symbol
mode = 1; mode = 1;
@ -446,7 +446,7 @@ void UI_DisplayMain(void)
if ((gCurrentFunction == FUNCTION_RECEIVE || if ((gCurrentFunction == FUNCTION_RECEIVE ||
gCurrentFunction == FUNCTION_MONITOR || gCurrentFunction == FUNCTION_MONITOR ||
gCurrentFunction == FUNCTION_INCOMING) && gCurrentFunction == FUNCTION_INCOMING) &&
gEeprom.RX_CHANNEL == vfo_num) gEeprom.RX_VFO == vfo_num)
{ {
#ifdef ENABLE_SMALL_BOLD #ifdef ENABLE_SMALL_BOLD
UI_PrintStringSmallBold("RX", 14, 0, line); UI_PrintStringSmallBold("RX", 14, 0, line);
@ -459,7 +459,7 @@ void UI_DisplayMain(void)
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num])) if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
{ // channel mode { // channel mode
const unsigned int x = 2; const unsigned int x = 2;
const bool inputting = (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != vfo_num) ? false : true; const bool inputting = (gInputBoxIndex == 0 || gEeprom.TX_VFO != vfo_num) ? false : true;
if (!inputting) if (!inputting)
NUMBER_ToDigits(gEeprom.ScreenChannel[vfo_num] + 1, String); // show the memory channel number NUMBER_ToDigits(gEeprom.ScreenChannel[vfo_num] + 1, String); // show the memory channel number
else else
@ -479,7 +479,7 @@ void UI_DisplayMain(void)
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
else else
{ {
if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != vfo_num) if (gInputBoxIndex == 0 || gEeprom.TX_VFO != vfo_num)
{ // channel number { // channel number
sprintf(String, "N%u", 1 + gEeprom.ScreenChannel[vfo_num] - NOAA_CHANNEL_FIRST); sprintf(String, "N%u", 1 + gEeprom.ScreenChannel[vfo_num] - NOAA_CHANNEL_FIRST);
} }
@ -498,7 +498,7 @@ void UI_DisplayMain(void)
#ifdef ENABLE_ALARM #ifdef ENABLE_ALARM
if (gCurrentFunction == FUNCTION_TRANSMIT && gAlarmState == ALARM_STATE_ALARM) if (gCurrentFunction == FUNCTION_TRANSMIT && gAlarmState == ALARM_STATE_ALARM)
{ {
channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL; channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
if (channel == vfo_num) if (channel == vfo_num)
state = VFO_STATE_ALARM; state = VFO_STATE_ALARM;
} }
@ -511,7 +511,7 @@ void UI_DisplayMain(void)
UI_PrintString(state_list[state], 31, 0, line, 8); UI_PrintString(state_list[state], 31, 0, line, 8);
} }
else else
if (gInputBoxIndex > 0 && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]) && gEeprom.TX_CHANNEL == vfo_num) if (gInputBoxIndex > 0 && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]) && gEeprom.TX_VFO == vfo_num)
{ // user entering a frequency { // user entering a frequency
UI_DisplayFrequency(gInputBox, 32, line, true, false); UI_DisplayFrequency(gInputBox, 32, line, true, false);
@ -522,7 +522,7 @@ void UI_DisplayMain(void)
uint32_t frequency = gEeprom.VfoInfo[vfo_num].pRX->Frequency; uint32_t frequency = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
if (gCurrentFunction == FUNCTION_TRANSMIT) if (gCurrentFunction == FUNCTION_TRANSMIT)
{ // transmitting { // transmitting
channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL; channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
if (channel == vfo_num) if (channel == vfo_num)
frequency = gEeprom.VfoInfo[vfo_num].pTX->Frequency; frequency = gEeprom.VfoInfo[vfo_num].pTX->Frequency;
} }
@ -722,14 +722,14 @@ void UI_DisplayMain(void)
#endif #endif
#if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA) #if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA)
if (rx && gEeprom.VfoInfo[gEeprom.RX_CHANNEL].AM_mode && gSetting_AM_fix) if (rx && gEeprom.VfoInfo[gEeprom.RX_VFO].AM_mode && gSetting_AM_fix)
{ {
if (gScreenToDisplay != DISPLAY_MAIN || if (gScreenToDisplay != DISPLAY_MAIN ||
gDTMF_CallState != DTMF_CALL_STATE_NONE) gDTMF_CallState != DTMF_CALL_STATE_NONE)
return; return;
center_line = CENTER_LINE_AM_FIX_DATA; center_line = CENTER_LINE_AM_FIX_DATA;
AM_fix_print_data(gEeprom.RX_CHANNEL, String); AM_fix_print_data(gEeprom.RX_VFO, String);
UI_PrintStringSmall(String, 2, 0, 3); UI_PrintStringSmall(String, 2, 0, 3);
} }
else else
@ -739,7 +739,7 @@ void UI_DisplayMain(void)
if (rx) if (rx)
{ {
center_line = CENTER_LINE_RSSI; center_line = CENTER_LINE_RSSI;
UI_DisplayRSSIBar(gCurrentRSSI[gEeprom.RX_CHANNEL], false); UI_DisplayRSSIBar(gCurrentRSSI[gEeprom.RX_VFO], false);
} }
else else
#endif #endif