diff --git a/app/action.c b/app/action.c index c931d4fb..7036ebdf 100644 --- a/app/action.c +++ b/app/action.c @@ -206,7 +206,7 @@ void ACTION_Scan(bool bRestart) #endif // 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 gDualWatchActive = false; diff --git a/app/app.c b/app/app.c index 302546a2..d65abc39 100644 --- a/app/app.c +++ b/app/app.c @@ -122,7 +122,7 @@ static void APP_CheckForIncoming(void) FUNCTION_Select(FUNCTION_INCOMING); //gUpdateDisplay = true; - updateRSSI(gEeprom.RX_CHANNEL); + updateRSSI(gEeprom.RX_VFO); gUpdateRSSI = true; } @@ -138,7 +138,7 @@ static void APP_CheckForIncoming(void) FUNCTION_Select(FUNCTION_INCOMING); //gUpdateDisplay = true; - updateRSSI(gEeprom.RX_CHANNEL); + updateRSSI(gEeprom.RX_VFO); gUpdateRSSI = true; } return; @@ -160,7 +160,7 @@ static void APP_CheckForIncoming(void) FUNCTION_Select(FUNCTION_INCOMING); //gUpdateDisplay = true; - updateRSSI(gEeprom.RX_CHANNEL); + updateRSSI(gEeprom.RX_VFO); gUpdateRSSI = true; } @@ -178,7 +178,7 @@ static void APP_CheckForIncoming(void) FUNCTION_Select(FUNCTION_INCOMING); //gUpdateDisplay = true; - updateRSSI(gEeprom.RX_CHANNEL); + updateRSSI(gEeprom.RX_VFO); gUpdateRSSI = true; } } @@ -468,7 +468,7 @@ static void APP_HandleFunction(void) 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; if (gSetting_KILLED) @@ -679,7 +679,7 @@ static void MR_NextChannel(void) // dual watch is enabled - include the other VFO in the scan if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) { - chan = (gEeprom.RX_CHANNEL + 1) & 1u; + chan = (gEeprom.RX_VFO + 1) & 1u; chan = gEeprom.ScreenChannel[chan]; if (IS_MR_CHANNEL(chan)) { @@ -713,10 +713,10 @@ static void MR_NextChannel(void) if (gNextMrChannel != prev_chan) { - gEeprom.MrChannel[ gEeprom.RX_CHANNEL] = gNextMrChannel; - gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = gNextMrChannel; + gEeprom.MrChannel[ gEeprom.RX_VFO] = 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); gUpdateDisplay = true; @@ -749,11 +749,11 @@ static void DUALWATCH_Alternate(void) if (gIsNoaaMode) { 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 - 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) NOAA_IncreaseChannel(); @@ -761,8 +761,8 @@ static void DUALWATCH_Alternate(void) else #endif { // toggle between VFO's - gEeprom.RX_CHANNEL = (gEeprom.RX_CHANNEL + 1) & 1; - gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_CHANNEL]; + gEeprom.RX_VFO = (gEeprom.RX_VFO + 1) & 1; + gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_VFO]; if (!gDualWatchActive) { // 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) { // dual watch mode, go back to sleep - updateRSSI(gEeprom.RX_CHANNEL); + updateRSSI(gEeprom.RX_VFO); // go back to sleep @@ -1410,9 +1410,9 @@ void APP_TimeSlice10ms(void) #endif #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) - AM_fix_10ms(gEeprom.RX_CHANNEL); + AM_fix_10ms(gEeprom.RX_VFO); #endif if (UART_IsCommandAvailable()) @@ -1800,7 +1800,7 @@ void APP_TimeSlice500ms(void) if (gCurrentFunction != FUNCTION_TRANSMIT) { if (gCurrentFunction != FUNCTION_POWER_SAVE) - updateRSSI(gEeprom.RX_CHANNEL); + updateRSSI(gEeprom.RX_VFO); #ifdef ENABLE_FMRADIO 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) { - SETTINGS_SaveChannel(gTxVfo->CHANNEL_SAVE, gEeprom.TX_CHANNEL, gTxVfo, gFlagSaveChannel); + SETTINGS_SaveChannel(gTxVfo->CHANNEL_SAVE, gEeprom.TX_VFO, gTxVfo, gFlagSaveChannel); gFlagSaveChannel = false; - RADIO_ConfigureChannel(gEeprom.TX_CHANNEL, VFO_CONFIGURE); + RADIO_ConfigureChannel(gEeprom.TX_VFO, VFO_CONFIGURE); RADIO_SetupRegisters(true); GUI_SelectNextDisplay(DISPLAY_MAIN); @@ -2435,7 +2435,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool 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 (gVfoConfigureMode == VFO_CONFIGURE_NONE) // 'if' is so as we don't wipe out previously setting this variable elsewhere @@ -2460,7 +2460,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) RADIO_ConfigureChannel(1, gVfoConfigureMode); } else - RADIO_ConfigureChannel(gEeprom.TX_CHANNEL, gVfoConfigureMode); + RADIO_ConfigureChannel(gEeprom.TX_VFO, gVfoConfigureMode); if (gRequestDisplayScreen == DISPLAY_INVALID) gRequestDisplayScreen = DISPLAY_MAIN; diff --git a/app/main.c b/app/main.c index 1e09acda..ed8fc8af 100644 --- a/app/main.c +++ b/app/main.c @@ -38,7 +38,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) { uint8_t Band; - uint8_t Vfo = gEeprom.TX_CHANNEL; + uint8_t Vfo = gEeprom.TX_VFO; 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) gEeprom.DUAL_WATCH = DUAL_WATCH_CHAN_A; else - gEeprom.TX_CHANNEL = (Vfo + 1) & 1u; + gEeprom.TX_VFO = (Vfo + 1) & 1u; gRequestSaveSettings = 1; gFlagReconfigureVfos = true; @@ -122,7 +122,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) { // swap to frequency mode - gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_CHANNEL]; + gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_VFO]; #ifdef ENABLE_VOICE gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE; #endif @@ -131,7 +131,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) 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) { // swap to channel mode gEeprom.ScreenChannel[Vfo] = Channel; @@ -166,24 +166,24 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) case KEY_5: #ifdef ENABLE_NOAA - + 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 { - gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_CHANNEL]; + gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_VFO]; #ifdef ENABLE_VOICE gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE; #endif } gRequestSaveVFO = true; gVfoConfigureMode = VFO_CONFIGURE_RELOAD; - + #else // toggle the selected channels scanlist setting - + if (gScreenToDisplay != DISPLAY_SCANNER) { if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) @@ -207,9 +207,9 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) gFlagResetVfos = true; } } - + #endif - + break; case KEY_6: @@ -220,7 +220,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) #ifdef ENABLE_VOX ACTION_Vox(); #else - + // 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) { // F-key wasn't pressed - const uint8_t Vfo = gEeprom.TX_CHANNEL; + const uint8_t Vfo = gEeprom.TX_VFO; gKeyInputCountdown = key_input_timeout_500ms; @@ -554,31 +554,44 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld) gUpdateStatus = true; #ifdef ENABLE_COPY_CHAN_TO_VFO - + if (gEeprom.VFO_OPEN && gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF) { // 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])) - { + { // swap to the VFO + const unsigned int channel = FREQ_CHANNEL_FIRST + gEeprom.VfoInfo[vfo].Band; gEeprom.ScreenChannel[vfo] = channel; gEeprom.VfoInfo[vfo].CHANNEL_SAVE = channel; - - // swap to the VFO - gEeprom.TX_CHANNEL = vfo; - gEeprom.RX_CHANNEL = vfo; + gEeprom.TX_VFO = vfo; + RADIO_SelectVfos(); RADIO_ApplyOffset(gRxVfo); RADIO_ConfigureSquelchAndOutputPower(gRxVfo); RADIO_SetupRegisters(true); - - //SETTINGS_SaveChannel(channel, gEeprom.RX_CHANNEL, gRxVfo, 1); - + + //SETTINGS_SaveChannel(channel, gEeprom.RX_VFO, gRxVfo, 1); + gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; gUpdateStatus = true; @@ -589,7 +602,7 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld) { gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; } - + #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) { - uint8_t Channel = gEeprom.ScreenChannel[gEeprom.TX_CHANNEL]; + uint8_t Channel = gEeprom.ScreenChannel[gEeprom.TX_VFO]; if (bKeyHeld || !bKeyPressed) { @@ -762,8 +775,8 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction) if (Channel == Next) return; - gEeprom.MrChannel[gEeprom.TX_CHANNEL] = Next; - gEeprom.ScreenChannel[gEeprom.TX_CHANNEL] = Next; + gEeprom.MrChannel[gEeprom.TX_VFO] = Next; + gEeprom.ScreenChannel[gEeprom.TX_VFO] = Next; if (!bKeyHeld) { @@ -776,9 +789,9 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction) #ifdef ENABLE_NOAA else { - Channel = NOAA_CHANNEL_FIRST + NUMBER_AddWithWraparound(gEeprom.ScreenChannel[gEeprom.TX_CHANNEL] - NOAA_CHANNEL_FIRST, Direction, 0, 9); - gEeprom.NoaaChannel[gEeprom.TX_CHANNEL] = Channel; - gEeprom.ScreenChannel[gEeprom.TX_CHANNEL] = Channel; + Channel = NOAA_CHANNEL_FIRST + NUMBER_AddWithWraparound(gEeprom.ScreenChannel[gEeprom.TX_VFO] - NOAA_CHANNEL_FIRST, Direction, 0, 9); + gEeprom.NoaaChannel[gEeprom.TX_VFO] = Channel; + gEeprom.ScreenChannel[gEeprom.TX_VFO] = Channel; } #endif diff --git a/app/menu.c b/app/menu.c index 7c338ca8..45ec8a5e 100644 --- a/app/menu.c +++ b/app/menu.c @@ -472,7 +472,7 @@ void MENU_AcceptSetting(void) #if 0 gEeprom.MrChannel[0] = gSubMenuSelection; #else - gEeprom.MrChannel[gEeprom.TX_CHANNEL] = gSubMenuSelection; + gEeprom.MrChannel[gEeprom.TX_VFO] = gSubMenuSelection; #endif gRequestSaveChannel = 2; gVfoConfigureMode = VFO_CONFIGURE_RELOAD; @@ -492,7 +492,7 @@ void MENU_AcceptSetting(void) // save the channel name memset(gTxVfo->Name, 0, sizeof(gTxVfo->Name)); memmove(gTxVfo->Name, edit, 10); - SETTINGS_SaveChannel(gSubMenuSelection, gEeprom.TX_CHANNEL, gTxVfo, 3); + SETTINGS_SaveChannel(gSubMenuSelection, gEeprom.TX_VFO, gTxVfo, 3); gFlagReconfigureVfos = true; return; @@ -921,12 +921,12 @@ void MENU_ShowCurrentSetting(void) #if 0 gSubMenuSelection = gEeprom.MrChannel[0]; #else - gSubMenuSelection = gEeprom.MrChannel[gEeprom.TX_CHANNEL]; + gSubMenuSelection = gEeprom.MrChannel[gEeprom.TX_VFO]; #endif break; case MENU_MEM_NAME: - gSubMenuSelection = gEeprom.MrChannel[gEeprom.TX_CHANNEL]; + gSubMenuSelection = gEeprom.MrChannel[gEeprom.TX_VFO]; break; case MENU_SAVE: @@ -1106,7 +1106,7 @@ void MENU_ShowCurrentSetting(void) #if 0 gSubMenuSelection = RADIO_FindNextChannel(gEeprom.MrChannel[0], 1, false, 1); #else - gSubMenuSelection = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_CHANNEL], 1, false, 1); + gSubMenuSelection = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_VFO], 1, false, 1); #endif break; diff --git a/app/scanner.c b/app/scanner.c index 9b821c0a..b203ad49 100644 --- a/app/scanner.c +++ b/app/scanner.c @@ -250,16 +250,16 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld) if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) { Channel = gScanChannel; - gEeprom.MrChannel[gEeprom.TX_CHANNEL] = Channel; + gEeprom.MrChannel[gEeprom.TX_VFO] = Channel; } else { Channel = gTxVfo->Band + FREQ_CHANNEL_FIRST; - gEeprom.FreqChannel[gEeprom.TX_CHANNEL] = Channel; + gEeprom.FreqChannel[gEeprom.TX_VFO] = Channel; } gTxVfo->CHANNEL_SAVE = Channel; - gEeprom.ScreenChannel[gEeprom.TX_CHANNEL] = Channel; + gEeprom.ScreenChannel[gEeprom.TX_VFO] = Channel; #ifdef ENABLE_VOICE gAnotherVoiceID = VOICE_ID_CONFIRM; #endif @@ -430,10 +430,10 @@ void SCANNER_Stop(void) { if (IS_MR_CHANNEL(gNextMrChannel)) { - gEeprom.MrChannel[gEeprom.RX_CHANNEL] = gRestoreMrChannel; - gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = Previous; + gEeprom.MrChannel[gEeprom.RX_VFO] = gRestoreMrChannel; + gEeprom.ScreenChannel[gEeprom.RX_VFO] = Previous; - RADIO_ConfigureChannel(gEeprom.RX_CHANNEL, VFO_CONFIGURE_RELOAD); + RADIO_ConfigureChannel(gEeprom.RX_VFO, VFO_CONFIGURE_RELOAD); } else { @@ -450,7 +450,7 @@ void SCANNER_Stop(void) { RADIO_ApplyOffset(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; } diff --git a/app/uart.c b/app/uart.c index 913b56ff..c109419f 100644 --- a/app/uart.c +++ b/app/uart.c @@ -385,7 +385,7 @@ static void CMD_052F(const uint8_t *pBuffer) gEeprom.DUAL_WATCH = DUAL_WATCH_OFF; gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF; - gEeprom.RX_CHANNEL = 0; + gEeprom.RX_VFO = 0; gEeprom.DTMF_SIDE_TONE = false; gEeprom.VfoInfo[0].FrequencyReverse = false; gEeprom.VfoInfo[0].pRX = &gEeprom.VfoInfo[0].freq_config_RX; diff --git a/board.c b/board.c index 75733e65..0f585947 100644 --- a/board.c +++ b/board.c @@ -616,7 +616,7 @@ void BOARD_EEPROM_Init(void) #endif gEeprom.ROGER = (Data[1] < 3) ? Data[1] : ROGER_MODE_OFF; 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 EEPROM_ReadBuffer(0x0ED0, Data, 8); diff --git a/firmware.bin b/firmware.bin index ff54babb..cf62e83a 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index 4f30c844..271d7565 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/main.c b/main.c index b190fcef..7df450bb 100644 --- a/main.c +++ b/main.c @@ -193,7 +193,7 @@ void Main(void) AUDIO_SetVoiceID(0, VOICE_ID_WELCOME); - Channel = gEeprom.ScreenChannel[gEeprom.TX_CHANNEL]; + Channel = gEeprom.ScreenChannel[gEeprom.TX_VFO]; if (IS_MR_CHANNEL(Channel)) { AUDIO_SetVoiceID(1, VOICE_ID_CHANNEL_MODE); diff --git a/radio.c b/radio.c index 2b3235ab..fee71325 100644 --- a/radio.c +++ b/radio.c @@ -517,30 +517,30 @@ void RADIO_ApplyOffset(VFO_Info_t *pInfo) 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) { if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_B) - gEeprom.TX_CHANNEL = 1; + gEeprom.TX_VFO = 1; else if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_A) - gEeprom.TX_CHANNEL = 0; + gEeprom.TX_VFO = 0; else if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B) - gEeprom.TX_CHANNEL = 1; + gEeprom.TX_VFO = 1; else 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) - gEeprom.RX_CHANNEL = gEeprom.TX_CHANNEL; + gEeprom.RX_VFO = gEeprom.TX_VFO; 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]; - gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_CHANNEL]; + gTxVfo = &gEeprom.VfoInfo[gEeprom.TX_VFO]; + gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_VFO]; RADIO_SelectCurrentVfo(); } @@ -878,8 +878,8 @@ void RADIO_SetVfoState(VfoState_t State) } else { - unsigned int chan = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gRxVfoIsActive) ? (gEeprom.RX_CHANNEL + 1) & 1 : gEeprom.RX_CHANNEL; // 1of11 - chan = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.TX_CHANNEL : chan; + 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_VFO : chan; VfoState[chan] = State; } @@ -903,8 +903,8 @@ void RADIO_PrepareTX(void) if (!gRxVfoIsActive) { // use the TX vfo - gEeprom.RX_CHANNEL = gEeprom.TX_CHANNEL; - gRxVfo = &gEeprom.VfoInfo[gEeprom.TX_CHANNEL]; + gEeprom.RX_VFO = gEeprom.TX_VFO; + gRxVfo = &gEeprom.VfoInfo[gEeprom.TX_VFO]; gRxVfoIsActive = true; } diff --git a/settings.c b/settings.c index 2fe96666..8bec24b4 100644 --- a/settings.c +++ b/settings.c @@ -133,7 +133,7 @@ void SETTINGS_SaveSettings(void) #endif State[1] = gEeprom.ROGER; State[2] = gEeprom.REPEATER_TAIL_TONE_ELIMINATION; - State[3] = gEeprom.TX_CHANNEL; + State[3] = gEeprom.TX_VFO; EEPROM_WriteBuffer(0x0EA8, State); State[0] = gEeprom.DTMF_SIDE_TONE; diff --git a/settings.h b/settings.h index 8d54f0d4..d7411382 100644 --- a/settings.h +++ b/settings.h @@ -121,8 +121,8 @@ typedef struct { #ifdef ENABLE_NOAA uint8_t NoaaChannel[2]; #endif - uint8_t RX_CHANNEL; - uint8_t TX_CHANNEL; + uint8_t RX_VFO; + uint8_t TX_VFO; uint8_t field7_0xa; uint8_t field8_0xb; diff --git a/ui/main.c b/ui/main.c index f1acf7dc..9b1ee220 100644 --- a/ui/main.c +++ b/ui/main.c @@ -332,8 +332,8 @@ void UI_DisplayMain(void) for (vfo_num = 0; vfo_num < 2; vfo_num++) { const unsigned int line = (vfo_num == 0) ? line0 : line1; - uint8_t channel = gEeprom.TX_CHANNEL; -// uint8_t tx_channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL; + uint8_t channel = gEeprom.TX_VFO; +// 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; uint8_t *p_line0 = gFrameBuffer[line + 0]; uint8_t *p_line1 = gFrameBuffer[line + 1]; @@ -350,7 +350,7 @@ void UI_DisplayMain(void) } 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) { @@ -428,7 +428,7 @@ void UI_DisplayMain(void) else #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) { // show the TX symbol mode = 1; @@ -446,7 +446,7 @@ void UI_DisplayMain(void) if ((gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR || gCurrentFunction == FUNCTION_INCOMING) && - gEeprom.RX_CHANNEL == vfo_num) + gEeprom.RX_VFO == vfo_num) { #ifdef ENABLE_SMALL_BOLD UI_PrintStringSmallBold("RX", 14, 0, line); @@ -459,7 +459,7 @@ void UI_DisplayMain(void) if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num])) { // channel mode 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) NUMBER_ToDigits(gEeprom.ScreenChannel[vfo_num] + 1, String); // show the memory channel number else @@ -479,7 +479,7 @@ void UI_DisplayMain(void) #ifdef ENABLE_NOAA else { - if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != vfo_num) + if (gInputBoxIndex == 0 || gEeprom.TX_VFO != vfo_num) { // channel number sprintf(String, "N%u", 1 + gEeprom.ScreenChannel[vfo_num] - NOAA_CHANNEL_FIRST); } @@ -498,7 +498,7 @@ void UI_DisplayMain(void) #ifdef ENABLE_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) state = VFO_STATE_ALARM; } @@ -511,7 +511,7 @@ void UI_DisplayMain(void) UI_PrintString(state_list[state], 31, 0, line, 8); } 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 UI_DisplayFrequency(gInputBox, 32, line, true, false); @@ -522,7 +522,7 @@ void UI_DisplayMain(void) uint32_t frequency = gEeprom.VfoInfo[vfo_num].pRX->Frequency; if (gCurrentFunction == FUNCTION_TRANSMIT) { // 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) frequency = gEeprom.VfoInfo[vfo_num].pTX->Frequency; } @@ -722,14 +722,14 @@ void UI_DisplayMain(void) #endif #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 || gDTMF_CallState != DTMF_CALL_STATE_NONE) return; 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); } else @@ -739,7 +739,7 @@ void UI_DisplayMain(void) if (rx) { center_line = CENTER_LINE_RSSI; - UI_DisplayRSSIBar(gCurrentRSSI[gEeprom.RX_CHANNEL], false); + UI_DisplayRSSIBar(gCurrentRSSI[gEeprom.RX_VFO], false); } else #endif