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
+19

No files matched your search

+6
View File
@@ -467,11 +467,14 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
Value = (gInputBox[0] * 10) + gInputBox[1];
if (Value > 0 && Value <= MR_CHANNELS_LIST)
{
if(RADIO_CheckValidList(Value))
{
gEeprom.SCAN_LIST_DEFAULT = Value;
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
SETTINGS_WriteCurrentState();
#endif
}
return;
}
@@ -492,11 +495,14 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
return;
}
else if (Value > 0 && Value <= MR_CHANNELS_LIST)
{
if(RADIO_CheckValidList(Value))
{
gEeprom.SCAN_LIST_DEFAULT = Value;
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
SETTINGS_WriteCurrentState();
#endif
}
return;
}
break;
+12
View File
@@ -53,6 +53,18 @@ const char gModulationStr[MODULATION_UKNOWN][4] = {
#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)
{
const ChannelAttributes_t att = gMR_ChannelAttributes[channel];
+1
View File
@@ -148,6 +148,7 @@ extern DCS_CodeType_t gCurrentCodeType;
extern VfoState_t VfoState[2];
bool RADIO_CheckValidList(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);
void RADIO_InitInfo(VFO_Info_t *pInfo, const uint16_t ChannelSave, const uint32_t Frequency);