Skip to content

Commit

Permalink
Fix egzumer#366: Scan list 2 ignored everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
egzumer committed Jan 1, 2024
1 parent ac8c51d commit ed5ae78
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 20 deletions.
26 changes: 9 additions & 17 deletions radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion radio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ed5ae78

Please sign in to comment.