This commit is contained in:
Krzysiek Egzmont
2023-10-24 18:35:27 +02:00
parent 77d58eb8f5
commit 72eddd009b
16 changed files with 159 additions and 178 deletions

View File

@@ -116,55 +116,53 @@ void ACTION_Monitor(void)
void ACTION_Scan(bool bRestart) void ACTION_Scan(bool bRestart)
{ {
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
if (gFmRadioMode) if (gFmRadioMode)
{
if (gCurrentFunction != FUNCTION_RECEIVE &&
gCurrentFunction != FUNCTION_MONITOR &&
gCurrentFunction != FUNCTION_TRANSMIT)
{ {
if (gCurrentFunction != FUNCTION_RECEIVE && GUI_SelectNextDisplay(DISPLAY_FM);
gCurrentFunction != FUNCTION_MONITOR &&
gCurrentFunction != FUNCTION_TRANSMIT) gMonitor = false;
if (gFM_ScanState != FM_SCAN_OFF)
{ {
GUI_SelectNextDisplay(DISPLAY_FM); FM_PlayAndUpdate();
gMonitor = false; #ifdef ENABLE_VOICE
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
#endif
}
else
{
uint16_t Frequency;
if (gFM_ScanState != FM_SCAN_OFF) if (bRestart)
{ {
FM_PlayAndUpdate(); gFM_AutoScan = true;
gFM_ChannelPosition = 0;
#ifdef ENABLE_VOICE FM_EraseChannels();
gAnotherVoiceID = VOICE_ID_SCANNING_STOP; Frequency = gEeprom.FM_LowerLimit;
#endif
} }
else else
{ {
uint16_t Frequency; gFM_AutoScan = false;
gFM_ChannelPosition = 0;
if (bRestart) Frequency = gEeprom.FM_FrequencyPlaying;
{
gFM_AutoScan = true;
gFM_ChannelPosition = 0;
FM_EraseChannels();
Frequency = gEeprom.FM_LowerLimit;
}
else
{
gFM_AutoScan = false;
gFM_ChannelPosition = 0;
Frequency = gEeprom.FM_FrequencyPlaying;
}
BK1080_GetFrequencyDeviation(Frequency);
FM_Tune(Frequency, 1, bRestart);
#ifdef ENABLE_VOICE
gAnotherVoiceID = VOICE_ID_SCANNING_BEGIN;
#endif
} }
}
return; BK1080_GetFrequencyDeviation(Frequency);
FM_Tune(Frequency, 1, bRestart);
#ifdef ENABLE_VOICE
gAnotherVoiceID = VOICE_ID_SCANNING_BEGIN;
#endif
}
} }
#endif return;
}
#endif
if (gScreenToDisplay != DISPLAY_SCANNER) if (gScreenToDisplay != DISPLAY_SCANNER)
{ // not scanning { // not scanning
@@ -178,23 +176,23 @@ void ACTION_Scan(bool bRestart)
RADIO_SelectVfos(); RADIO_SelectVfos();
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE)) if (!IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
#endif #endif
{ {
GUI_SelectNextDisplay(DISPLAY_MAIN); GUI_SelectNextDisplay(DISPLAY_MAIN);
if (gScanStateDir != SCAN_OFF) if (gScanStateDir != SCAN_OFF)
{ // already scanning { // already scanning
if (gNextMrChannel <= MR_CHANNEL_LAST) if (IS_MR_CHANNEL(gNextMrChannel))
{ // channel mode { // channel mode
// keep scanning but toggle between scan lists // keep scanning but toggle between scan lists
gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3; gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3;
// jump to the next channel // jump to the next channel
SCANNER_NextChannel(false, gScanStateDir); SCANNER_ScanChannels(false, gScanStateDir);
gScanPauseDelayIn_10ms = 1; gScanPauseDelayIn_10ms = 1;
gScheduleScanListen = false; gScheduleScanListen = false;
@@ -213,7 +211,7 @@ void ACTION_Scan(bool bRestart)
else else
{ // start scanning { // start scanning
SCANNER_NextChannel(true, SCAN_FWD); SCANNER_ScanChannels(true, SCAN_FWD);
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN); AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
@@ -231,12 +229,12 @@ void ACTION_Scan(bool bRestart)
} }
else else
// if (!bRestart) // if (!bRestart)
if (!bRestart && gNextMrChannel <= MR_CHANNEL_LAST) if (!bRestart && IS_MR_CHANNEL(gNextMrChannel))
{ // channel mode, keep scanning but toggle between scan lists { // channel mode, keep scanning but toggle between scan lists
gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3; gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3;
// jump to the next channel // jump to the next channel
SCANNER_NextChannel(false, gScanStateDir); SCANNER_ScanChannels(false, gScanStateDir);
gScanPauseDelayIn_10ms = 1; gScanPauseDelayIn_10ms = 1;
gScheduleScanListen = false; gScheduleScanListen = false;

View File

@@ -62,12 +62,6 @@
#include "ui/status.h" #include "ui/status.h"
#include "ui/ui.h" #include "ui/ui.h"
// original QS front end register settings
const uint8_t orig_lna_short = 3; // 0dB
const uint8_t orig_lna = 2; // -14dB
const uint8_t orig_mixer = 3; // 0dB
const uint8_t orig_pga = 6; // -3dB
static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld); static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
static void updateRSSI(const int vfo) static void updateRSSI(const int vfo)
@@ -308,7 +302,7 @@ static void APP_HandleReceive(void)
if (g_SquelchLost) if (g_SquelchLost)
{ {
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (!gEndOfRxDetectedMaybe && IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE)) if (!gEndOfRxDetectedMaybe && !IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
#else #else
if (!gEndOfRxDetectedMaybe) if (!gEndOfRxDetectedMaybe)
#endif #endif
@@ -482,7 +476,6 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
gVFO_RSSI_bar_level[(chan + 1) & 1u] = 0; gVFO_RSSI_bar_level[(chan + 1) & 1u] = 0;
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
gEnableSpeaker = true; gEnableSpeaker = true;
if (gSetting_backlight_on_tx_rx >= BACKLIGHT_ON_TR_RX) if (gSetting_backlight_on_tx_rx >= BACKLIGHT_ON_TR_RX)
@@ -508,7 +501,7 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
break; break;
} }
bScanKeepFrequency = true; gScanKeepResult = true;
} }
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
@@ -545,12 +538,11 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
} }
{ // RF RX front end gain { // RF RX front end gain
// original QS front end register settings
// original setting const uint8_t orig_lna_short = 3; // 0dB
uint16_t lna_short = orig_lna_short; const uint8_t orig_lna = 2; // -14dB
uint16_t lna = orig_lna; const uint8_t orig_mixer = 3; // 0dB
uint16_t mixer = orig_mixer; const uint8_t orig_pga = 6; // -3dB
uint16_t pga = orig_pga;
#ifdef ENABLE_AM_FIX #ifdef ENABLE_AM_FIX
if (gRxVfo->AM_mode && gSetting_AM_fix) if (gRxVfo->AM_mode && gSetting_AM_fix)
@@ -561,10 +553,10 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
} }
else else
{ // FM RX mode { // FM RX mode
BK4819_WriteRegister(BK4819_REG_13, (lna_short << 8) | (lna << 5) | (mixer << 3) | (pga << 0)); BK4819_WriteRegister(BK4819_REG_13, (orig_lna_short << 8) | (orig_lna << 5) | (orig_mixer << 3) | (orig_pga << 0));
} }
#else #else
BK4819_WriteRegister(BK4819_REG_13, (lna_short << 8) | (lna << 5) | (mixer << 3) | (pga << 0)); BK4819_WriteRegister(BK4819_REG_13, (orig_lna_short << 8) | (orig_lna << 5) | (orig_mixer << 3) | (orig_pga << 0));
#endif #endif
} }
@@ -622,7 +614,7 @@ static void DUALWATCH_Alternate(void)
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (gIsNoaaMode) if (gIsNoaaMode)
{ {
if (IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) || IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[1])) if (!IS_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) || !IS_NOAA_CHANNEL(gEeprom.ScreenChannel[1]))
gEeprom.RX_VFO = (gEeprom.RX_VFO + 1) & 1; gEeprom.RX_VFO = (gEeprom.RX_VFO + 1) & 1;
else else
gEeprom.RX_VFO = 0; gEeprom.RX_VFO = 0;
@@ -1038,7 +1030,7 @@ void APP_Update(void)
{ {
gBatterySaveCountdown_10ms = battery_save_count_10ms; gBatterySaveCountdown_10ms = battery_save_count_10ms;
} }
else if ((IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) && IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[1])) || !gIsNoaaMode) else if ((!IS_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) && !IS_NOAA_CHANNEL(gEeprom.ScreenChannel[1])) || !gIsNoaaMode)
{ {
//if (gCurrentFunction != FUNCTION_POWER_SAVE) //if (gCurrentFunction != FUNCTION_POWER_SAVE)
FUNCTION_Select(FUNCTION_POWER_SAVE); FUNCTION_Select(FUNCTION_POWER_SAVE);

View File

@@ -23,11 +23,6 @@
#include "frequencies.h" #include "frequencies.h"
#include "radio.h" #include "radio.h"
extern const uint8_t orig_lna_short;
extern const uint8_t orig_lna;
extern const uint8_t orig_mixer;
extern const uint8_t orig_pga;
void APP_EndTransmission(void); void APP_EndTransmission(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);
uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t direction); uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t direction);

View File

@@ -39,7 +39,7 @@ void COMMON_SwitchVFOs()
void COMMON_SwitchVFOMode() void COMMON_SwitchVFOMode()
{ {
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (gEeprom.VFO_OPEN && IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE)) if (gEeprom.VFO_OPEN && !IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
#else #else
if (gEeprom.VFO_OPEN) if (gEeprom.VFO_OPEN)
#endif #endif

View File

@@ -207,7 +207,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
if(beep) { if(beep) {
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE)) if (!IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
{ {
gEeprom.ScreenChannel[Vfo] = gEeprom.NoaaChannel[gEeprom.TX_VFO]; gEeprom.ScreenChannel[Vfo] = gEeprom.NoaaChannel[gEeprom.TX_VFO];
} }
@@ -358,7 +358,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
} }
// #ifdef ENABLE_NOAA // #ifdef ENABLE_NOAA
// if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE)) // if (!IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
// #endif // #endif
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE)) if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
{ // user is entering a frequency { // user is entering a frequency
@@ -505,7 +505,7 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
} }
else else
{ {
bScanKeepFrequency = false; gScanKeepResult = false;
SCANNER_Stop(); SCANNER_Stop();
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
@@ -564,7 +564,7 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
gWasFKeyPressed = false; gWasFKeyPressed = false;
gUpdateStatus = true; gUpdateStatus = true;
ACTION_Handle(KEY_MENU, bKeyPressed, bKeyHeld); ACTION_Handle(KEY_MENU, bKeyPressed, bKeyHeld);
} }
} }
@@ -632,7 +632,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
{ {
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (gScanStateDir == SCAN_OFF && IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE)) if (gScanStateDir == SCAN_OFF && !IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
#else #else
if (gScanStateDir == SCAN_OFF) if (gScanStateDir == SCAN_OFF)
#endif #endif
@@ -710,7 +710,7 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
if (gScanStateDir == SCAN_OFF) if (gScanStateDir == SCAN_OFF)
{ {
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (IS_NOT_NOAA_CHANNEL(Channel)) if (!IS_NOAA_CHANNEL(Channel))
#endif #endif
{ {
uint8_t Next; uint8_t Next;
@@ -764,7 +764,7 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
} }
// jump to the next channel // jump to the next channel
SCANNER_NextChannel(false, Direction); SCANNER_ScanChannels(false, Direction);
gScanPauseDelayIn_10ms = 1; gScanPauseDelayIn_10ms = 1;
gScheduleScanListen = false; gScheduleScanListen = false;

View File

@@ -1293,7 +1293,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
Value = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1; Value = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
if (Value <= MR_CHANNEL_LAST) if (IS_MR_CHANNEL(Value))
{ {
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
gAnotherVoiceID = (VOICE_ID_t)Key; gAnotherVoiceID = (VOICE_ID_t)Key;
@@ -1566,7 +1566,7 @@ static void MENU_Key_STAR(const bool bKeyPressed, const bool bKeyHeld)
RADIO_SelectVfos(); RADIO_SelectVfos();
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) && gRxVfo->AM_mode == 0) if (!IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) && gRxVfo->AM_mode == 0)
#else #else
if (gRxVfo->AM_mode == 0) if (gRxVfo->AM_mode == 0)
#endif #endif

View File

@@ -43,9 +43,20 @@ uint8_t gScanProgressIndicator;
uint8_t gScanHitCount; uint8_t gScanHitCount;
bool gScanUseCssResult; bool gScanUseCssResult;
int8_t gScanStateDir; int8_t gScanStateDir;
bool bScanKeepFrequency; bool gScanKeepResult;
uint8_t gRestoreMrChannel;
uint8_t gRestoreCROSS_BAND_RX_TX; typedef enum {
SCAN_NEXT_CHAN_SCANLIST1 = 0,
SCAN_NEXT_CHAN_SCANLIST2,
SCAN_NEXT_CHAN_DUAL_WATCH,
SCAN_NEXT_CHAN_MR,
SCAN_NEXT_NUM
} scan_next_chan_t;
scan_next_chan_t currentScanList;
uint8_t restoreMrChannel;
uint32_t restoreFrequency;
uint8_t initialCROSS_BAND_RX_TX;
static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
{ {
@@ -72,7 +83,7 @@ static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
gInputBoxIndex = 0; gInputBoxIndex = 0;
Channel = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1; Channel = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
if (Channel <= MR_CHANNEL_LAST) if (IS_MR_CHANNEL(Channel))
{ {
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
gAnotherVoiceID = (VOICE_ID_t)Key; gAnotherVoiceID = (VOICE_ID_t)Key;
@@ -183,7 +194,7 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
} }
} }
if (gTxVfo->CHANNEL_SAVE <= MR_CHANNEL_LAST) if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
{ {
gScannerEditState = 1; gScannerEditState = 1;
gScanChannel = gTxVfo->CHANNEL_SAVE; gScanChannel = gTxVfo->CHANNEL_SAVE;
@@ -237,7 +248,7 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
gTxVfo->freq_config_TX.Code = gScanCssResultCode; gTxVfo->freq_config_TX.Code = gScanCssResultCode;
} }
if (gTxVfo->CHANNEL_SAVE <= MR_CHANNEL_LAST) if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
{ {
Channel = gScanChannel; Channel = gScanChannel;
gEeprom.MrChannel[gEeprom.TX_VFO] = Channel; gEeprom.MrChannel[gEeprom.TX_VFO] = Channel;
@@ -412,47 +423,42 @@ void SCANNER_Start(void)
void SCANNER_Stop(void) void SCANNER_Stop(void)
{ {
if(gRestoreCROSS_BAND_RX_TX != CROSS_BAND_OFF) { if(initialCROSS_BAND_RX_TX != CROSS_BAND_OFF) {
gEeprom.CROSS_BAND_RX_TX = gRestoreCROSS_BAND_RX_TX; gEeprom.CROSS_BAND_RX_TX = initialCROSS_BAND_RX_TX;
gRestoreCROSS_BAND_RX_TX = CROSS_BAND_OFF; initialCROSS_BAND_RX_TX = CROSS_BAND_OFF;
} }
gScanStateDir = SCAN_OFF; gScanStateDir = SCAN_OFF;
if (!bScanKeepFrequency) if (gScanKeepResult) {
{ if (IS_MR_CHANNEL(gRxVfo->CHANNEL_SAVE)) {
if (gNextMrChannel <= MR_CHANNEL_LAST) SETTINGS_SaveVfoIndices();
{ gUpdateStatus = true;
gEeprom.MrChannel[gEeprom.RX_VFO] = gRestoreMrChannel; }
gEeprom.ScreenChannel[gEeprom.RX_VFO] = gRestoreMrChannel; else {
RADIO_ApplyOffset(gRxVfo);
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
SETTINGS_SaveChannel(gRxVfo->CHANNEL_SAVE, gEeprom.RX_VFO, gRxVfo, 1);
}
}
else {
if (IS_MR_CHANNEL(gNextMrChannel)) {
gEeprom.MrChannel[gEeprom.RX_VFO] = restoreMrChannel;
gEeprom.ScreenChannel[gEeprom.RX_VFO] = restoreMrChannel;
RADIO_ConfigureChannel(gEeprom.RX_VFO, VFO_CONFIGURE_RELOAD); RADIO_ConfigureChannel(gEeprom.RX_VFO, VFO_CONFIGURE_RELOAD);
} }
else else {
{ gRxVfo->freq_config_RX.Frequency = restoreFrequency;
gRxVfo->freq_config_RX.Frequency = gRestoreFrequency;
RADIO_ApplyOffset(gRxVfo); RADIO_ApplyOffset(gRxVfo);
RADIO_ConfigureSquelchAndOutputPower(gRxVfo); RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
} }
RADIO_SetupRegisters(true); RADIO_SetupRegisters(true);
gUpdateDisplay = true; gUpdateDisplay = true;
return;
} }
if (gRxVfo->CHANNEL_SAVE > MR_CHANNEL_LAST)
{
RADIO_ApplyOffset(gRxVfo);
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
SETTINGS_SaveChannel(gRxVfo->CHANNEL_SAVE, gEeprom.RX_VFO, gRxVfo, 1);
return;
}
SETTINGS_SaveVfoIndices();
gUpdateStatus = true;
} }
static void SCANNER_NextFreqChannel(void) static void NextFreqChannel(void)
{ {
gRxVfo->freq_config_RX.Frequency = APP_SetFrequencyByStep(gRxVfo, gScanStateDir); gRxVfo->freq_config_RX.Frequency = APP_SetFrequencyByStep(gRxVfo, gScanStateDir);
@@ -466,11 +472,11 @@ static void SCANNER_NextFreqChannel(void)
gScanPauseDelayIn_10ms = scan_pause_delay_in_6_10ms; gScanPauseDelayIn_10ms = scan_pause_delay_in_6_10ms;
#endif #endif
bScanKeepFrequency = false; gScanKeepResult = false;
gUpdateDisplay = true; gUpdateDisplay = true;
} }
static void SCANNER_NextMemChannel(void) static void NextMemChannel(void)
{ {
static unsigned int prev_mr_chan = 0; static unsigned int prev_mr_chan = 0;
const bool enabled = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT] : true; const bool enabled = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT] : true;
@@ -481,7 +487,7 @@ static void SCANNER_NextMemChannel(void)
if (enabled) if (enabled)
{ {
switch (gCurrentScanList) switch (currentScanList)
{ {
case SCAN_NEXT_CHAN_SCANLIST1: case SCAN_NEXT_CHAN_SCANLIST1:
prev_mr_chan = gNextMrChannel; prev_mr_chan = gNextMrChannel;
@@ -490,7 +496,7 @@ static void SCANNER_NextMemChannel(void)
{ {
if (RADIO_CheckValidChannel(chan1, false, 0)) if (RADIO_CheckValidChannel(chan1, false, 0))
{ {
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1; currentScanList = SCAN_NEXT_CHAN_SCANLIST1;
gNextMrChannel = chan1; gNextMrChannel = chan1;
break; break;
} }
@@ -501,7 +507,7 @@ static void SCANNER_NextMemChannel(void)
{ {
if (RADIO_CheckValidChannel(chan2, false, 0)) if (RADIO_CheckValidChannel(chan2, false, 0))
{ {
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST2; currentScanList = SCAN_NEXT_CHAN_SCANLIST2;
gNextMrChannel = chan2; gNextMrChannel = chan2;
break; break;
} }
@@ -515,9 +521,9 @@ static void SCANNER_NextMemChannel(void)
// { // {
// chan = (gEeprom.RX_VFO + 1) & 1u; // chan = (gEeprom.RX_VFO + 1) & 1u;
// chan = gEeprom.ScreenChannel[chan]; // chan = gEeprom.ScreenChannel[chan];
// if (chan <= MR_CHANNEL_LAST) // if (IS_MR_CHANNEL(chan))
// { // {
// gCurrentScanList = SCAN_NEXT_CHAN_DUAL_WATCH; // currentScanList = SCAN_NEXT_CHAN_DUAL_WATCH;
// gNextMrChannel = chan; // gNextMrChannel = chan;
// break; // break;
// } // }
@@ -525,7 +531,7 @@ static void SCANNER_NextMemChannel(void)
default: default:
case SCAN_NEXT_CHAN_MR: case SCAN_NEXT_CHAN_MR:
gCurrentScanList = SCAN_NEXT_CHAN_MR; currentScanList = SCAN_NEXT_CHAN_MR;
gNextMrChannel = prev_mr_chan; gNextMrChannel = prev_mr_chan;
chan = 0xff; chan = 0xff;
break; break;
@@ -562,44 +568,44 @@ static void SCANNER_NextMemChannel(void)
gScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms; gScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
#endif #endif
bScanKeepFrequency = false; gScanKeepResult = false;
if (enabled) if (enabled)
if (++gCurrentScanList >= SCAN_NEXT_NUM) if (++currentScanList >= SCAN_NEXT_NUM)
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1; // back round we go currentScanList = SCAN_NEXT_CHAN_SCANLIST1; // back round we go
} }
void SCANNER_NextChannel(const bool storeBackupSettings, const int8_t scan_direction) void SCANNER_ScanChannels(const bool storeBackupSettings, const int8_t scan_direction)
{ {
if (storeBackupSettings) { if (storeBackupSettings) {
gRestoreCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX; initialCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF; gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
} }
RADIO_SelectVfos(); RADIO_SelectVfos();
gNextMrChannel = gRxVfo->CHANNEL_SAVE; gNextMrChannel = gRxVfo->CHANNEL_SAVE;
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1; currentScanList = SCAN_NEXT_CHAN_SCANLIST1;
gScanStateDir = scan_direction; gScanStateDir = scan_direction;
if (gNextMrChannel <= MR_CHANNEL_LAST) if (IS_MR_CHANNEL(gNextMrChannel))
{ // channel mode { // channel mode
if (storeBackupSettings) if (storeBackupSettings)
gRestoreMrChannel = gNextMrChannel; restoreMrChannel = gNextMrChannel;
SCANNER_NextMemChannel(); NextMemChannel();
} }
else else
{ // frequency mode { // frequency mode
if (storeBackupSettings) if (storeBackupSettings)
gRestoreFrequency = gRxVfo->freq_config_RX.Frequency; restoreFrequency = gRxVfo->freq_config_RX.Frequency;
SCANNER_NextFreqChannel(); NextFreqChannel();
} }
gScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms; gScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
gScheduleScanListen = false; gScheduleScanListen = false;
gRxReceptionMode = RX_MODE_NONE; gRxReceptionMode = RX_MODE_NONE;
gScanPauseMode = false; gScanPauseMode = false;
bScanKeepFrequency = false; gScanKeepResult = false;
} }
void SCANNER_ContinueScanning() void SCANNER_ContinueScanning()
@@ -609,14 +615,14 @@ void SCANNER_ContinueScanning()
if (gCurrentFunction == FUNCTION_INCOMING) if (gCurrentFunction == FUNCTION_INCOMING)
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true); APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
else else
SCANNER_NextFreqChannel(); // switch to next frequency NextFreqChannel(); // switch to next frequency
} }
else else
{ {
if (gCurrentCodeType == CODE_TYPE_OFF && gCurrentFunction == FUNCTION_INCOMING) if (gCurrentCodeType == CODE_TYPE_OFF && gCurrentFunction == FUNCTION_INCOMING)
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true); APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
else else
SCANNER_NextMemChannel(); // switch to next channel NextMemChannel(); // switch to next channel
} }
gScanPauseMode = false; gScanPauseMode = false;

View File

@@ -53,12 +53,12 @@ extern uint8_t gScanProgressIndicator;
extern uint8_t gScanHitCount; extern uint8_t gScanHitCount;
extern bool gScanUseCssResult; extern bool gScanUseCssResult;
extern int8_t gScanStateDir; extern int8_t gScanStateDir;
extern bool bScanKeepFrequency; extern bool gScanKeepResult;
void SCANNER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld); void SCANNER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
void SCANNER_Start(void); void SCANNER_Start(void);
void SCANNER_Stop(void); void SCANNER_Stop(void);
void SCANNER_NextChannel(const bool storeBackupSettings, const int8_t scan_direction); void SCANNER_ScanChannels(const bool storeBackupSettings, const int8_t scan_direction);
void SCANNER_ContinueScanning(); void SCANNER_ContinueScanning();
#endif #endif

View File

@@ -43,7 +43,7 @@ FUNCTION_Type_t gCurrentFunction;
void FUNCTION_Init(void) void FUNCTION_Init(void)
{ {
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE)) if (!IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
#endif #endif
{ {
gCurrentCodeType = gSelectedCodeType; gCurrentCodeType = gSelectedCodeType;

3
misc.c
View File

@@ -201,9 +201,6 @@ uint16_t gLowBatteryCountdown;
uint8_t gNextMrChannel; uint8_t gNextMrChannel;
ReceptionMode_t gRxReceptionMode; ReceptionMode_t gRxReceptionMode;
enum scan_next_chan_t gCurrentScanList;
uint32_t gRestoreFrequency;
bool gRxVfoIsActive; bool gRxVfoIsActive;
#ifdef ENABLE_ALARM #ifdef ENABLE_ALARM
uint8_t gAlarmToneCounter; uint8_t gAlarmToneCounter;

14
misc.h
View File

@@ -35,9 +35,7 @@
#define IS_MR_CHANNEL(x) ((x) <= MR_CHANNEL_LAST) #define IS_MR_CHANNEL(x) ((x) <= MR_CHANNEL_LAST)
#define IS_FREQ_CHANNEL(x) ((x) >= FREQ_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST) #define IS_FREQ_CHANNEL(x) ((x) >= FREQ_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST)
#define IS_VALID_CHANNEL(x) ((x) < LAST_CHANNEL) #define IS_VALID_CHANNEL(x) ((x) < LAST_CHANNEL)
#define IS_NOAA_CHANNEL(x) ((x) >= NOAA_CHANNEL_FIRST && (x) <= NOAA_CHANNEL_LAST) #define IS_NOAA_CHANNEL(x) ((x) >= NOAA_CHANNEL_FIRST && (x) <= NOAA_CHANNEL_LAST)
#define IS_NOT_NOAA_CHANNEL(x) ((x) <= FREQ_CHANNEL_LAST)
enum { enum {
MR_CHANNEL_FIRST = 0, MR_CHANNEL_FIRST = 0,
@@ -85,15 +83,6 @@ enum CssScanMode_t
}; };
typedef enum CssScanMode_t CssScanMode_t; typedef enum CssScanMode_t CssScanMode_t;
enum scan_next_chan_t {
SCAN_NEXT_CHAN_SCANLIST1 = 0,
SCAN_NEXT_CHAN_SCANLIST2,
SCAN_NEXT_CHAN_DUAL_WATCH,
SCAN_NEXT_CHAN_MR,
SCAN_NEXT_NUM
};
typedef enum scan_next_chan_t scan_next_chan_t;
enum BacklightOnRxTx_t { enum BacklightOnRxTx_t {
BACKLIGHT_ON_TR_OFF, BACKLIGHT_ON_TR_OFF,
BACKLIGHT_ON_TR_TX, BACKLIGHT_ON_TR_TX,
@@ -283,9 +272,6 @@ extern uint16_t gLowBatteryCountdown;
extern uint8_t gNextMrChannel; extern uint8_t gNextMrChannel;
extern ReceptionMode_t gRxReceptionMode; extern ReceptionMode_t gRxReceptionMode;
extern scan_next_chan_t gCurrentScanList;
extern uint32_t gRestoreFrequency;
//TRUE when dual watch is momentarly suspended and RX_VFO is locked to either last TX or RX //TRUE when dual watch is momentarly suspended and RX_VFO is locked to either last TX or RX
extern bool gRxVfoIsActive; extern bool gRxVfoIsActive;
extern uint8_t gAlarmToneCounter; extern uint8_t gAlarmToneCounter;

30
radio.c
View File

@@ -51,7 +51,7 @@ bool RADIO_CheckValidChannel(uint16_t Channel, bool bCheckScanList, uint8_t VFO)
uint8_t PriorityCh1; uint8_t PriorityCh1;
uint8_t PriorityCh2; uint8_t PriorityCh2;
if (Channel > MR_CHANNEL_LAST) if (!IS_MR_CHANNEL(Channel))
return false; return false;
Attributes = gMR_ChannelAttributes[Channel]; Attributes = gMR_ChannelAttributes[Channel];
@@ -97,12 +97,12 @@ uint8_t RADIO_FindNextChannel(uint8_t Channel, int8_t Direction, bool bCheckScan
{ {
unsigned int i; unsigned int i;
for (i = 0; i <= MR_CHANNEL_LAST; i++) for (i = 0; IS_MR_CHANNEL(i); i++)
{ {
if (Channel == 0xFF) if (Channel == 0xFF)
Channel = MR_CHANNEL_LAST; Channel = MR_CHANNEL_LAST;
else else
if (Channel > MR_CHANNEL_LAST) if (!IS_MR_CHANNEL(Channel))
Channel = MR_CHANNEL_FIRST; Channel = MR_CHANNEL_FIRST;
if (RADIO_CheckValidChannel(Channel, bCheckScanList, VFO)) if (RADIO_CheckValidChannel(Channel, bCheckScanList, VFO))
@@ -176,7 +176,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
} }
#endif #endif
if (Channel <= MR_CHANNEL_LAST) if (IS_MR_CHANNEL(Channel))
{ {
Channel = RADIO_FindNextChannel(Channel, RADIO_CHANNEL_UP, false, VFO); Channel = RADIO_FindNextChannel(Channel, RADIO_CHANNEL_UP, false, VFO);
if (Channel == 0xFF) if (Channel == 0xFF)
@@ -200,7 +200,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
uint8_t Index; uint8_t Index;
if (Channel <= MR_CHANNEL_LAST) if (IS_MR_CHANNEL(Channel))
{ {
Channel = gEeprom.FreqChannel[VFO]; Channel = gEeprom.FreqChannel[VFO];
gEeprom.ScreenChannel[VFO] = gEeprom.FreqChannel[VFO]; gEeprom.ScreenChannel[VFO] = gEeprom.FreqChannel[VFO];
@@ -218,7 +218,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
Band = BAND6_400MHz; Band = BAND6_400MHz;
} }
if (Channel <= MR_CHANNEL_LAST) if (IS_MR_CHANNEL(Channel))
{ {
gEeprom.VfoInfo[VFO].Band = Band; gEeprom.VfoInfo[VFO].Band = Band;
gEeprom.VfoInfo[VFO].SCANLIST1_PARTICIPATION = !!(Attributes & MR_CH_SCANLIST1); gEeprom.VfoInfo[VFO].SCANLIST1_PARTICIPATION = !!(Attributes & MR_CH_SCANLIST1);
@@ -235,7 +235,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
gEeprom.VfoInfo[VFO].SCANLIST2_PARTICIPATION = bParticipation2; gEeprom.VfoInfo[VFO].SCANLIST2_PARTICIPATION = bParticipation2;
gEeprom.VfoInfo[VFO].CHANNEL_SAVE = Channel; gEeprom.VfoInfo[VFO].CHANNEL_SAVE = Channel;
if (Channel <= MR_CHANNEL_LAST) if (IS_MR_CHANNEL(Channel))
Base = Channel * 16; Base = Channel * 16;
else else
Base = 0x0C80 + ((Channel - FREQ_CHANNEL_FIRST) * 32) + (VFO * 16); Base = 0x0C80 + ((Channel - FREQ_CHANNEL_FIRST) * 32) + (VFO * 16);
@@ -377,13 +377,13 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
if (Frequency >= frequencyBandTable[BAND2_108MHz].upper && Frequency < frequencyBandTable[BAND2_108MHz].upper) if (Frequency >= frequencyBandTable[BAND2_108MHz].upper && Frequency < frequencyBandTable[BAND2_108MHz].upper)
gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY_DIRECTION = TX_OFFSET_FREQUENCY_DIRECTION_OFF; gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY_DIRECTION = TX_OFFSET_FREQUENCY_DIRECTION_OFF;
else if (Channel > MR_CHANNEL_LAST) else if (!IS_MR_CHANNEL(Channel))
gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY = FREQUENCY_RoundToStep(gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY, gEeprom.VfoInfo[VFO].StepFrequency); gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY = FREQUENCY_RoundToStep(gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY, gEeprom.VfoInfo[VFO].StepFrequency);
RADIO_ApplyOffset(pRadio); RADIO_ApplyOffset(pRadio);
memset(gEeprom.VfoInfo[VFO].Name, 0, sizeof(gEeprom.VfoInfo[VFO].Name)); memset(gEeprom.VfoInfo[VFO].Name, 0, sizeof(gEeprom.VfoInfo[VFO].Name));
if (Channel < MR_CHANNEL_LAST) if (IS_MR_CHANNEL(Channel))
{ // 16 bytes allocated to the channel name but only 10 used, the rest are 0's { // 16 bytes allocated to the channel name but only 10 used, the rest are 0's
EEPROM_ReadBuffer(0x0F50 + (Channel * 16), gEeprom.VfoInfo[VFO].Name + 0, 8); EEPROM_ReadBuffer(0x0F50 + (Channel * 16), gEeprom.VfoInfo[VFO].Name + 0, 8);
EEPROM_ReadBuffer(0x0F58 + (Channel * 16), gEeprom.VfoInfo[VFO].Name + 8, 2); EEPROM_ReadBuffer(0x0F58 + (Channel * 16), gEeprom.VfoInfo[VFO].Name + 8, 2);
@@ -619,7 +619,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
BK4819_WriteRegister(BK4819_REG_7D, 0xE940 | (gEeprom.MIC_SENSITIVITY_TUNING & 0x1f)); BK4819_WriteRegister(BK4819_REG_7D, 0xE940 | (gEeprom.MIC_SENSITIVITY_TUNING & 0x1f));
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) || !gIsNoaaMode) if (!IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) || !gIsNoaaMode)
Frequency = gRxVfo->pRX->Frequency; Frequency = gRxVfo->pRX->Frequency;
else else
Frequency = NoaaFrequencyTable[gNoaaChannel]; Frequency = NoaaFrequencyTable[gNoaaChannel];
@@ -644,7 +644,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
InterruptMask = BK4819_REG_3F_SQUELCH_FOUND | BK4819_REG_3F_SQUELCH_LOST; InterruptMask = BK4819_REG_3F_SQUELCH_FOUND | BK4819_REG_3F_SQUELCH_LOST;
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE)) if (!IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
#endif #endif
{ {
if (gRxVfo->AM_mode == 0) if (gRxVfo->AM_mode == 0)
@@ -723,9 +723,9 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
#ifdef ENABLE_VOX #ifdef ENABLE_VOX
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
if (gEeprom.VOX_SWITCH && !gFmRadioMode && IS_NOT_NOAA_CHANNEL(gCurrentVfo->CHANNEL_SAVE) && gCurrentVfo->AM_mode == 0) if (gEeprom.VOX_SWITCH && !gFmRadioMode && !IS_NOAA_CHANNEL(gCurrentVfo->CHANNEL_SAVE) && gCurrentVfo->AM_mode == 0)
#else #else
if (gEeprom.VOX_SWITCH && IS_NOT_NOAA_CHANNEL(gCurrentVfo->CHANNEL_SAVE) && gCurrentVfo->AM_mode == 0) if (gEeprom.VOX_SWITCH && !IS_NOAA_CHANNEL(gCurrentVfo->CHANNEL_SAVE) && gCurrentVfo->AM_mode == 0)
#endif #endif
#else #else
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
@@ -788,9 +788,9 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
{ {
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
{ {
if (IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[0])) if (!IS_NOAA_CHANNEL(gEeprom.ScreenChannel[0]))
{ {
if (IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[1])) if (!IS_NOAA_CHANNEL(gEeprom.ScreenChannel[1]))
{ {
gIsNoaaMode = false; gIsNoaaMode = false;
return; return;

View File

@@ -73,7 +73,14 @@ typedef struct VFO_Info_t
{ {
FREQ_Config_t freq_config_RX; FREQ_Config_t freq_config_RX;
FREQ_Config_t freq_config_TX; FREQ_Config_t freq_config_TX;
// this is for a purpose of the FrequencyReverse function
// it points to freq_config_RX normally and to freq_config_TX if reverse function is active
//
FREQ_Config_t *pRX; FREQ_Config_t *pRX;
// this is for a purpose of the FrequencyReverse function
// it points to freq_config_TX normally and to freq_config_RX if reverse function is active
FREQ_Config_t *pTX; FREQ_Config_t *pTX;
uint32_t TX_OFFSET_FREQUENCY; uint32_t TX_OFFSET_FREQUENCY;

View File

@@ -190,19 +190,19 @@ void SETTINGS_SaveSettings(void)
void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode) void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode)
{ {
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (IS_NOT_NOAA_CHANNEL(Channel)) if (!IS_NOAA_CHANNEL(Channel))
#endif #endif
{ {
const uint16_t OffsetMR = Channel * 16; const uint16_t OffsetMR = Channel * 16;
uint16_t OffsetVFO = OffsetMR; uint16_t OffsetVFO = OffsetMR;
if (Channel > MR_CHANNEL_LAST) if (!IS_MR_CHANNEL(Channel))
{ // it's a VFO, not a channel { // it's a VFO, not a channel
OffsetVFO = (VFO == 0) ? 0x0C80 : 0x0C90; OffsetVFO = (VFO == 0) ? 0x0C80 : 0x0C90;
OffsetVFO += (Channel - FREQ_CHANNEL_FIRST) * 32; OffsetVFO += (Channel - FREQ_CHANNEL_FIRST) * 32;
} }
if (Mode >= 2 || Channel > MR_CHANNEL_LAST) if (Mode >= 2 || !IS_MR_CHANNEL(Channel))
{ // copy VFO to a channel { // copy VFO to a channel
uint8_t State[8]; uint8_t State[8];
@@ -227,7 +227,7 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
SETTINGS_UpdateChannel(Channel, pVFO, true); SETTINGS_UpdateChannel(Channel, pVFO, true);
if (Channel <= MR_CHANNEL_LAST) if (IS_MR_CHANNEL(Channel))
{ // it's a memory channel { // it's a memory channel
#ifndef ENABLE_KEEP_MEM_NAME #ifndef ENABLE_KEEP_MEM_NAME
@@ -265,7 +265,7 @@ void SETTINGS_SaveBatteryCalibration(const uint16_t * batteryCalibration)
void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep) void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep)
{ {
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (IS_NOT_NOAA_CHANNEL(Channel)) if (!IS_NOAA_CHANNEL(Channel))
#endif #endif
{ {
uint8_t State[8]; uint8_t State[8];
@@ -290,7 +290,7 @@ void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep)
gMR_ChannelAttributes[Channel] = Attributes; gMR_ChannelAttributes[Channel] = Attributes;
// #ifndef ENABLE_KEEP_MEM_NAME // #ifndef ENABLE_KEEP_MEM_NAME
if (Channel <= MR_CHANNEL_LAST) if (IS_MR_CHANNEL(Channel))
{ // it's a memory channel { // it's a memory channel
const uint16_t OffsetMR = Channel * 16; const uint16_t OffsetMR = Channel * 16;

View File

@@ -389,7 +389,7 @@ void UI_DisplayMain(void)
} }
} }
if (gEeprom.ScreenChannel[vfo_num] <= MR_CHANNEL_LAST) 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_VFO != vfo_num) ? false : true; const bool inputting = (gInputBoxIndex == 0 || gEeprom.TX_VFO != vfo_num) ? false : true;
@@ -471,7 +471,7 @@ void UI_DisplayMain(void)
frequency = gEeprom.VfoInfo[vfo_num].pTX->Frequency; frequency = gEeprom.VfoInfo[vfo_num].pTX->Frequency;
} }
if (gEeprom.ScreenChannel[vfo_num] <= MR_CHANNEL_LAST) if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
{ // it's a channel { // it's a channel
// show the scan list assigment symbols // show the scan list assigment symbols

View File

@@ -88,7 +88,7 @@ void UI_DisplayStatus(const bool test_display)
// SCAN indicator // SCAN indicator
if (gScanStateDir != SCAN_OFF || gScreenToDisplay == DISPLAY_SCANNER || test_display) if (gScanStateDir != SCAN_OFF || gScreenToDisplay == DISPLAY_SCANNER || test_display)
{ {
if (gNextMrChannel <= MR_CHANNEL_LAST && gScreenToDisplay != DISPLAY_SCANNER) if (IS_MR_CHANNEL(gNextMrChannel) && gScreenToDisplay != DISPLAY_SCANNER)
{ // channel mode { // channel mode
if (gEeprom.SCAN_LIST_DEFAULT == 0) if (gEeprom.SCAN_LIST_DEFAULT == 0)
UI_PrintStringSmallBuffer("1", line + x); UI_PrintStringSmallBuffer("1", line + x);