diff --git a/radio.c b/radio.c index 7846e4546..040f81b3f 100644 --- a/radio.c +++ b/radio.c @@ -56,35 +56,27 @@ const char gModulationStr[MODULATION_UKNOWN][4] = { -bool RADIO_CheckValidChannel(uint16_t Channel, bool bCheckScanList, uint8_t VFO) +bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanList) { // return true if the channel appears valid - if (!IS_MR_CHANNEL(Channel)) { + if (!IS_MR_CHANNEL(channel)) return false; - } - const ChannelAttributes_t att = gMR_ChannelAttributes[Channel]; + const ChannelAttributes_t att = gMR_ChannelAttributes[channel]; - if (att.band > BAND7_470MHz) { + if (att.band > BAND7_470MHz) return false; - } - if (!bCheckScanList) { + if (!checkScanList || scanList > 1) return true; - } - if (VFO >= 2) { - return true; - } - - if (!att.scanlist1) { + if (scanList ? !att.scanlist2 : !att.scanlist1) return false; - } - const uint8_t PriorityCh1 = gEeprom.SCANLIST_PRIORITY_CH1[VFO]; - const uint8_t PriorityCh2 = gEeprom.SCANLIST_PRIORITY_CH2[VFO]; + const uint8_t PriorityCh1 = gEeprom.SCANLIST_PRIORITY_CH1[scanList]; + const uint8_t PriorityCh2 = gEeprom.SCANLIST_PRIORITY_CH2[scanList]; - return PriorityCh1 != Channel && PriorityCh2 != Channel; + return PriorityCh1 != channel && PriorityCh2 != channel; } uint8_t RADIO_FindNextChannel(uint8_t Channel, int8_t Direction, bool bCheckScanList, uint8_t VFO) diff --git a/radio.h b/radio.h index 8c05b0eec..c20098dca 100644 --- a/radio.h +++ b/radio.h @@ -148,7 +148,7 @@ extern DCS_CodeType_t gCurrentCodeType; extern VfoState_t VfoState[2]; -bool RADIO_CheckValidChannel(uint16_t ChNum, bool bCheckScanList, uint8_t RadioNum); +bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanList); uint8_t RADIO_FindNextChannel(uint8_t ChNum, int8_t Direction, bool bCheckScanList, uint8_t RadioNum); void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t Frequency); void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure); diff --git a/settings.c b/settings.c index f0e52f0d5..183f3ccdf 100644 --- a/settings.c +++ b/settings.c @@ -218,8 +218,7 @@ void SETTINGS_InitEEPROM(void) // 0F18..0F1F EEPROM_ReadBuffer(0x0F18, Data, 8); -// gEeprom.SCAN_LIST_DEFAULT = (Data[0] < 2) ? Data[0] : false; - gEeprom.SCAN_LIST_DEFAULT = (Data[0] < 3) ? Data[0] : false; // we now have 'all' channel scan option + gEeprom.SCAN_LIST_DEFAULT = (Data[0] < 3) ? Data[0] : 0; // we now have 'all' channel scan option for (unsigned int i = 0; i < 2; i++) { const unsigned int j = 1 + (i * 3);