Add third list

This commit is contained in:
Armel FAUVEAU
2024-06-24 00:24:47 +02:00
parent 0235d26326
commit 2deff09d47
15 changed files with 179 additions and 21 deletions

View File

@@ -17,6 +17,7 @@ uint32_t gScanRangeStop;
typedef enum {
SCAN_NEXT_CHAN_SCANLIST1 = 0,
SCAN_NEXT_CHAN_SCANLIST2,
SCAN_NEXT_CHAN_SCANLIST3,
SCAN_NEXT_CHAN_DUAL_WATCH,
SCAN_NEXT_CHAN_MR,
SCAN_NEXT_NUM
@@ -194,9 +195,10 @@ static void NextFreqChannel(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;
const int chan1 = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCANLIST_PRIORITY_CH1[gEeprom.SCAN_LIST_DEFAULT] : -1;
const int chan2 = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCANLIST_PRIORITY_CH2[gEeprom.SCAN_LIST_DEFAULT] : -1;
const bool enabled = (gEeprom.SCAN_LIST_DEFAULT < 3) ? gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT] : true;
const int chan1 = -1;
const int chan2 = -1;
const int chan3 = -1;
const unsigned int prev_chan = gNextMrChannel;
unsigned int chan = 0;
@@ -228,7 +230,17 @@ static void NextMemChannel(void)
}
}
[[fallthrough]];
case SCAN_NEXT_CHAN_SCANLIST3:
if (chan3 >= 0)
{
if (RADIO_CheckValidChannel(chan3, false, 0))
{
currentScanList = SCAN_NEXT_CHAN_SCANLIST3;
gNextMrChannel = chan3;
break;
}
}
[[fallthrough]];
// this bit doesn't yet work if the other VFO is a frequency
case SCAN_NEXT_CHAN_DUAL_WATCH:
// dual watch is enabled - include the other VFO in the scan
@@ -255,7 +267,7 @@ static void NextMemChannel(void)
if (!enabled || chan == 0xff)
{
chan = RADIO_FindNextChannel(gNextMrChannel + gScanStateDir, gScanStateDir, (gEeprom.SCAN_LIST_DEFAULT < 2) ? true : false, gEeprom.SCAN_LIST_DEFAULT);
chan = RADIO_FindNextChannel(gNextMrChannel + gScanStateDir, gScanStateDir, (gEeprom.SCAN_LIST_DEFAULT < 3) ? true : false, gEeprom.SCAN_LIST_DEFAULT);
if (chan == 0xFF)
{ // no valid channel found
chan = MR_CHANNEL_FIRST;