Check if scanlist is valid

This commit is contained in:
Armel FAUVEAU committed 2026-01-19 13:14:50 +01:00
1 parent dccdd37464
commit 5caff3af5a
3 files changed
+27 -8

No files matched your search

+14 -8
View File
@@ -468,10 +468,13 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
if (Value > 0 && Value <= MR_CHANNELS_LIST) if (Value > 0 && Value <= MR_CHANNELS_LIST)
{ {
gEeprom.SCAN_LIST_DEFAULT = Value; if(RADIO_CheckValidList(Value))
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE {
SETTINGS_WriteCurrentState(); gEeprom.SCAN_LIST_DEFAULT = Value;
#endif #ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
SETTINGS_WriteCurrentState();
#endif
}
return; return;
} }
@@ -493,10 +496,13 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
} }
else if (Value > 0 && Value <= MR_CHANNELS_LIST) else if (Value > 0 && Value <= MR_CHANNELS_LIST)
{ {
gEeprom.SCAN_LIST_DEFAULT = Value; if(RADIO_CheckValidList(Value))
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE {
SETTINGS_WriteCurrentState(); gEeprom.SCAN_LIST_DEFAULT = Value;
#endif #ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
SETTINGS_WriteCurrentState();
#endif
}
return; return;
} }
break; break;
+12
View File
@@ -53,6 +53,18 @@ const char gModulationStr[MODULATION_UKNOWN][4] = {
#endif #endif
}; };
bool RADIO_CheckValidList(uint8_t scanList)
{
for (uint16_t i = 0; IS_MR_CHANNEL(i); i++) {
const ChannelAttributes_t att = gMR_ChannelAttributes[i];
if(att.scanlist == scanList && att.exclude == false)
{
return true;
}
}
return false;
}
bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanList) bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanList)
{ {
const ChannelAttributes_t att = gMR_ChannelAttributes[channel]; const ChannelAttributes_t att = gMR_ChannelAttributes[channel];
+1
View File
@@ -148,6 +148,7 @@ extern DCS_CodeType_t gCurrentCodeType;
extern VfoState_t VfoState[2]; extern VfoState_t VfoState[2];
bool RADIO_CheckValidList(uint8_t scanList);
bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanList); bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanList);
uint16_t RADIO_FindNextChannel(uint16_t ChNum, int8_t Direction, bool bCheckScanList, uint8_t RadioNum); uint16_t RADIO_FindNextChannel(uint16_t ChNum, int8_t Direction, bool bCheckScanList, uint8_t RadioNum);
void RADIO_InitInfo(VFO_Info_t *pInfo, const uint16_t ChannelSave, const uint32_t Frequency); void RADIO_InitInfo(VFO_Info_t *pInfo, const uint16_t ChannelSave, const uint32_t Frequency);