Refactor
This commit is contained in:
90
app/action.c
90
app/action.c
@@ -116,55 +116,53 @@ void ACTION_Monitor(void)
|
||||
|
||||
void ACTION_Scan(bool bRestart)
|
||||
{
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFmRadioMode)
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFmRadioMode)
|
||||
{
|
||||
if (gCurrentFunction != FUNCTION_RECEIVE &&
|
||||
gCurrentFunction != FUNCTION_MONITOR &&
|
||||
gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
{
|
||||
if (gCurrentFunction != FUNCTION_RECEIVE &&
|
||||
gCurrentFunction != FUNCTION_MONITOR &&
|
||||
gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
||||
|
||||
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();
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
gFM_AutoScan = true;
|
||||
gFM_ChannelPosition = 0;
|
||||
FM_EraseChannels();
|
||||
Frequency = gEeprom.FM_LowerLimit;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint16_t Frequency;
|
||||
|
||||
if (bRestart)
|
||||
{
|
||||
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
|
||||
gFM_AutoScan = false;
|
||||
gFM_ChannelPosition = 0;
|
||||
Frequency = gEeprom.FM_FrequencyPlaying;
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{ // not scanning
|
||||
@@ -178,23 +176,23 @@ void ACTION_Scan(bool bRestart)
|
||||
|
||||
RADIO_SelectVfos();
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||
#endif
|
||||
#ifdef ENABLE_NOAA
|
||||
if (!IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||
#endif
|
||||
{
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
|
||||
if (gScanStateDir != SCAN_OFF)
|
||||
{ // already scanning
|
||||
|
||||
if (gNextMrChannel <= MR_CHANNEL_LAST)
|
||||
if (IS_MR_CHANNEL(gNextMrChannel))
|
||||
{ // channel mode
|
||||
|
||||
// keep scanning but toggle between scan lists
|
||||
gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3;
|
||||
|
||||
// jump to the next channel
|
||||
SCANNER_NextChannel(false, gScanStateDir);
|
||||
SCANNER_ScanChannels(false, gScanStateDir);
|
||||
gScanPauseDelayIn_10ms = 1;
|
||||
gScheduleScanListen = false;
|
||||
|
||||
@@ -213,7 +211,7 @@ void ACTION_Scan(bool bRestart)
|
||||
else
|
||||
{ // start scanning
|
||||
|
||||
SCANNER_NextChannel(true, SCAN_FWD);
|
||||
SCANNER_ScanChannels(true, SCAN_FWD);
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
|
||||
@@ -231,12 +229,12 @@ void ACTION_Scan(bool bRestart)
|
||||
}
|
||||
else
|
||||
// if (!bRestart)
|
||||
if (!bRestart && gNextMrChannel <= MR_CHANNEL_LAST)
|
||||
if (!bRestart && IS_MR_CHANNEL(gNextMrChannel))
|
||||
{ // channel mode, keep scanning but toggle between scan lists
|
||||
gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3;
|
||||
|
||||
// jump to the next channel
|
||||
SCANNER_NextChannel(false, gScanStateDir);
|
||||
SCANNER_ScanChannels(false, gScanStateDir);
|
||||
gScanPauseDelayIn_10ms = 1;
|
||||
gScheduleScanListen = false;
|
||||
|
||||
|
30
app/app.c
30
app/app.c
@@ -62,12 +62,6 @@
|
||||
#include "ui/status.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 updateRSSI(const int vfo)
|
||||
@@ -308,7 +302,7 @@ static void APP_HandleReceive(void)
|
||||
if (g_SquelchLost)
|
||||
{
|
||||
#ifdef ENABLE_NOAA
|
||||
if (!gEndOfRxDetectedMaybe && IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||
if (!gEndOfRxDetectedMaybe && !IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||
#else
|
||||
if (!gEndOfRxDetectedMaybe)
|
||||
#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;
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
|
||||
gEnableSpeaker = true;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
bScanKeepFrequency = true;
|
||||
gScanKeepResult = true;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
@@ -545,12 +538,11 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
|
||||
}
|
||||
|
||||
{ // RF RX front end gain
|
||||
|
||||
// original setting
|
||||
uint16_t lna_short = orig_lna_short;
|
||||
uint16_t lna = orig_lna;
|
||||
uint16_t mixer = orig_mixer;
|
||||
uint16_t pga = orig_pga;
|
||||
// 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
|
||||
|
||||
#ifdef ENABLE_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
|
||||
{ // 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
|
||||
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
|
||||
}
|
||||
|
||||
@@ -622,7 +614,7 @@ static void DUALWATCH_Alternate(void)
|
||||
#ifdef ENABLE_NOAA
|
||||
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;
|
||||
else
|
||||
gEeprom.RX_VFO = 0;
|
||||
@@ -1038,7 +1030,7 @@ void APP_Update(void)
|
||||
{
|
||||
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)
|
||||
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
||||
|
@@ -23,11 +23,6 @@
|
||||
#include "frequencies.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_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix);
|
||||
uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t direction);
|
||||
|
@@ -39,7 +39,7 @@ void COMMON_SwitchVFOs()
|
||||
void COMMON_SwitchVFOMode()
|
||||
{
|
||||
#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
|
||||
if (gEeprom.VFO_OPEN)
|
||||
#endif
|
||||
|
14
app/main.c
14
app/main.c
@@ -207,7 +207,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
if(beep) {
|
||||
#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];
|
||||
}
|
||||
@@ -358,7 +358,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
|
||||
// #ifdef ENABLE_NOAA
|
||||
// if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
// if (!IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
// #endif
|
||||
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{ // user is entering a frequency
|
||||
@@ -505,7 +505,7 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
else
|
||||
{
|
||||
bScanKeepFrequency = false;
|
||||
gScanKeepResult = false;
|
||||
SCANNER_Stop();
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
@@ -564,7 +564,7 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
gWasFKeyPressed = false;
|
||||
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
|
||||
if (gScanStateDir == SCAN_OFF && IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
if (gScanStateDir == SCAN_OFF && !IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
#else
|
||||
if (gScanStateDir == SCAN_OFF)
|
||||
#endif
|
||||
@@ -710,7 +710,7 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
if (gScanStateDir == SCAN_OFF)
|
||||
{
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOT_NOAA_CHANNEL(Channel))
|
||||
if (!IS_NOAA_CHANNEL(Channel))
|
||||
#endif
|
||||
{
|
||||
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
|
||||
SCANNER_NextChannel(false, Direction);
|
||||
SCANNER_ScanChannels(false, Direction);
|
||||
gScanPauseDelayIn_10ms = 1;
|
||||
gScheduleScanListen = false;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
if (Value <= MR_CHANNEL_LAST)
|
||||
if (IS_MR_CHANNEL(Value))
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
@@ -1566,7 +1566,7 @@ static void MENU_Key_STAR(const bool bKeyPressed, const bool bKeyHeld)
|
||||
RADIO_SelectVfos();
|
||||
|
||||
#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
|
||||
if (gRxVfo->AM_mode == 0)
|
||||
#endif
|
||||
|
114
app/scanner.c
114
app/scanner.c
@@ -43,9 +43,20 @@ uint8_t gScanProgressIndicator;
|
||||
uint8_t gScanHitCount;
|
||||
bool gScanUseCssResult;
|
||||
int8_t gScanStateDir;
|
||||
bool bScanKeepFrequency;
|
||||
uint8_t gRestoreMrChannel;
|
||||
uint8_t gRestoreCROSS_BAND_RX_TX;
|
||||
bool gScanKeepResult;
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -72,7 +83,7 @@ static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
gInputBoxIndex = 0;
|
||||
|
||||
Channel = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
|
||||
if (Channel <= MR_CHANNEL_LAST)
|
||||
if (IS_MR_CHANNEL(Channel))
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
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;
|
||||
gScanChannel = gTxVfo->CHANNEL_SAVE;
|
||||
@@ -237,7 +248,7 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
gTxVfo->freq_config_TX.Code = gScanCssResultCode;
|
||||
}
|
||||
|
||||
if (gTxVfo->CHANNEL_SAVE <= MR_CHANNEL_LAST)
|
||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{
|
||||
Channel = gScanChannel;
|
||||
gEeprom.MrChannel[gEeprom.TX_VFO] = Channel;
|
||||
@@ -412,47 +423,42 @@ void SCANNER_Start(void)
|
||||
|
||||
void SCANNER_Stop(void)
|
||||
{
|
||||
if(gRestoreCROSS_BAND_RX_TX != CROSS_BAND_OFF) {
|
||||
gEeprom.CROSS_BAND_RX_TX = gRestoreCROSS_BAND_RX_TX;
|
||||
gRestoreCROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
if(initialCROSS_BAND_RX_TX != CROSS_BAND_OFF) {
|
||||
gEeprom.CROSS_BAND_RX_TX = initialCROSS_BAND_RX_TX;
|
||||
initialCROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
}
|
||||
|
||||
gScanStateDir = SCAN_OFF;
|
||||
|
||||
if (!bScanKeepFrequency)
|
||||
{
|
||||
if (gNextMrChannel <= MR_CHANNEL_LAST)
|
||||
{
|
||||
gEeprom.MrChannel[gEeprom.RX_VFO] = gRestoreMrChannel;
|
||||
gEeprom.ScreenChannel[gEeprom.RX_VFO] = gRestoreMrChannel;
|
||||
if (gScanKeepResult) {
|
||||
if (IS_MR_CHANNEL(gRxVfo->CHANNEL_SAVE)) {
|
||||
SETTINGS_SaveVfoIndices();
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
gRxVfo->freq_config_RX.Frequency = gRestoreFrequency;
|
||||
else {
|
||||
gRxVfo->freq_config_RX.Frequency = restoreFrequency;
|
||||
RADIO_ApplyOffset(gRxVfo);
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
}
|
||||
RADIO_SetupRegisters(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);
|
||||
|
||||
@@ -466,11 +472,11 @@ static void SCANNER_NextFreqChannel(void)
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_6_10ms;
|
||||
#endif
|
||||
|
||||
bScanKeepFrequency = false;
|
||||
gScanKeepResult = false;
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
static void SCANNER_NextMemChannel(void)
|
||||
static void NextMemChannel(void)
|
||||
{
|
||||
static unsigned int prev_mr_chan = 0;
|
||||
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)
|
||||
{
|
||||
switch (gCurrentScanList)
|
||||
switch (currentScanList)
|
||||
{
|
||||
case SCAN_NEXT_CHAN_SCANLIST1:
|
||||
prev_mr_chan = gNextMrChannel;
|
||||
@@ -490,7 +496,7 @@ static void SCANNER_NextMemChannel(void)
|
||||
{
|
||||
if (RADIO_CheckValidChannel(chan1, false, 0))
|
||||
{
|
||||
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
||||
currentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
||||
gNextMrChannel = chan1;
|
||||
break;
|
||||
}
|
||||
@@ -501,7 +507,7 @@ static void SCANNER_NextMemChannel(void)
|
||||
{
|
||||
if (RADIO_CheckValidChannel(chan2, false, 0))
|
||||
{
|
||||
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST2;
|
||||
currentScanList = SCAN_NEXT_CHAN_SCANLIST2;
|
||||
gNextMrChannel = chan2;
|
||||
break;
|
||||
}
|
||||
@@ -515,9 +521,9 @@ static void SCANNER_NextMemChannel(void)
|
||||
// {
|
||||
// chan = (gEeprom.RX_VFO + 1) & 1u;
|
||||
// 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;
|
||||
// break;
|
||||
// }
|
||||
@@ -525,7 +531,7 @@ static void SCANNER_NextMemChannel(void)
|
||||
|
||||
default:
|
||||
case SCAN_NEXT_CHAN_MR:
|
||||
gCurrentScanList = SCAN_NEXT_CHAN_MR;
|
||||
currentScanList = SCAN_NEXT_CHAN_MR;
|
||||
gNextMrChannel = prev_mr_chan;
|
||||
chan = 0xff;
|
||||
break;
|
||||
@@ -562,44 +568,44 @@ static void SCANNER_NextMemChannel(void)
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
|
||||
#endif
|
||||
|
||||
bScanKeepFrequency = false;
|
||||
gScanKeepResult = false;
|
||||
|
||||
if (enabled)
|
||||
if (++gCurrentScanList >= SCAN_NEXT_NUM)
|
||||
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1; // back round we go
|
||||
if (++currentScanList >= SCAN_NEXT_NUM)
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
|
||||
RADIO_SelectVfos();
|
||||
|
||||
gNextMrChannel = gRxVfo->CHANNEL_SAVE;
|
||||
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
||||
currentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
||||
gScanStateDir = scan_direction;
|
||||
|
||||
if (gNextMrChannel <= MR_CHANNEL_LAST)
|
||||
if (IS_MR_CHANNEL(gNextMrChannel))
|
||||
{ // channel mode
|
||||
if (storeBackupSettings)
|
||||
gRestoreMrChannel = gNextMrChannel;
|
||||
SCANNER_NextMemChannel();
|
||||
restoreMrChannel = gNextMrChannel;
|
||||
NextMemChannel();
|
||||
}
|
||||
else
|
||||
{ // frequency mode
|
||||
if (storeBackupSettings)
|
||||
gRestoreFrequency = gRxVfo->freq_config_RX.Frequency;
|
||||
SCANNER_NextFreqChannel();
|
||||
restoreFrequency = gRxVfo->freq_config_RX.Frequency;
|
||||
NextFreqChannel();
|
||||
}
|
||||
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
|
||||
gScheduleScanListen = false;
|
||||
gRxReceptionMode = RX_MODE_NONE;
|
||||
gScanPauseMode = false;
|
||||
bScanKeepFrequency = false;
|
||||
gScanKeepResult = false;
|
||||
}
|
||||
|
||||
void SCANNER_ContinueScanning()
|
||||
@@ -609,14 +615,14 @@ void SCANNER_ContinueScanning()
|
||||
if (gCurrentFunction == FUNCTION_INCOMING)
|
||||
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
|
||||
else
|
||||
SCANNER_NextFreqChannel(); // switch to next frequency
|
||||
NextFreqChannel(); // switch to next frequency
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gCurrentCodeType == CODE_TYPE_OFF && gCurrentFunction == FUNCTION_INCOMING)
|
||||
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
|
||||
else
|
||||
SCANNER_NextMemChannel(); // switch to next channel
|
||||
NextMemChannel(); // switch to next channel
|
||||
}
|
||||
|
||||
gScanPauseMode = false;
|
||||
|
@@ -53,12 +53,12 @@ extern uint8_t gScanProgressIndicator;
|
||||
extern uint8_t gScanHitCount;
|
||||
extern bool gScanUseCssResult;
|
||||
extern int8_t gScanStateDir;
|
||||
extern bool bScanKeepFrequency;
|
||||
extern bool gScanKeepResult;
|
||||
|
||||
void SCANNER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||
void SCANNER_Start(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();
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user