Add third list
This commit is contained in:
41
radio.c
41
radio.c
@@ -36,6 +36,7 @@
|
||||
#include "radio.h"
|
||||
#include "settings.h"
|
||||
#include "ui/menu.h"
|
||||
#include "debugging.h"
|
||||
|
||||
VFO_Info_t *gTxVfo;
|
||||
VFO_Info_t *gRxVfo;
|
||||
@@ -58,6 +59,11 @@ const char gModulationStr[MODULATION_UKNOWN][4] = {
|
||||
|
||||
bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanList)
|
||||
{
|
||||
|
||||
//char str[64] = "";
|
||||
//sprintf(str, "RADIO_CheckValidChannel channel %d / checkScanList %d / scanList %d\n", channel, checkScanList, scanList);
|
||||
//LogUart(str);
|
||||
|
||||
// return true if the channel appears valid
|
||||
if (!IS_MR_CHANNEL(channel))
|
||||
return false;
|
||||
@@ -67,11 +73,30 @@ bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanL
|
||||
if (att.band > BAND7_470MHz)
|
||||
return false;
|
||||
|
||||
if (!checkScanList || scanList > 1)
|
||||
if (!checkScanList || scanList > 2)
|
||||
return true;
|
||||
|
||||
if (scanList ? !att.scanlist2 : !att.scanlist1)
|
||||
//sprintf(str, "scanList %d / att.scanlist1 %d / att.scanlist2 %d / att.scanlist3 %d\n", scanList, att.scanlist1, att.scanlist2, att.scanlist3);
|
||||
//LogUart(str);
|
||||
|
||||
|
||||
if(scanList == 0 && att.scanlist1 != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(scanList == 1 && att.scanlist2 != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(scanList == 2 && att.scanlist3 != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//sprintf(str, ">>> %d\n", scanList);
|
||||
//LogUart(str);
|
||||
|
||||
return true;
|
||||
|
||||
const uint8_t PriorityCh1 = gEeprom.SCANLIST_PRIORITY_CH1[scanList];
|
||||
const uint8_t PriorityCh2 = gEeprom.SCANLIST_PRIORITY_CH2[scanList];
|
||||
@@ -81,6 +106,10 @@ bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanL
|
||||
|
||||
uint8_t RADIO_FindNextChannel(uint8_t Channel, int8_t Direction, bool bCheckScanList, uint8_t VFO)
|
||||
{
|
||||
//char str[64] = "";
|
||||
//sprintf(str, "RADIO_FindNextChannel Channel %d / VFO %d\n", Channel, VFO);
|
||||
//LogUart(str);
|
||||
|
||||
for (unsigned int i = 0; IS_MR_CHANNEL(i); i++, Channel += Direction) {
|
||||
if (Channel == 0xFF) {
|
||||
Channel = MR_CHANNEL_LAST;
|
||||
@@ -91,6 +120,8 @@ uint8_t RADIO_FindNextChannel(uint8_t Channel, int8_t Direction, bool bCheckScan
|
||||
if (RADIO_CheckValidChannel(Channel, bCheckScanList, VFO)) {
|
||||
return Channel;
|
||||
}
|
||||
//sprintf(str, "VFO %d...\n", VFO);
|
||||
//LogUart(str);
|
||||
}
|
||||
|
||||
return 0xFF;
|
||||
@@ -103,6 +134,7 @@ void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t
|
||||
pInfo->Band = FREQUENCY_GetBand(Frequency);
|
||||
pInfo->SCANLIST1_PARTICIPATION = false;
|
||||
pInfo->SCANLIST2_PARTICIPATION = false;
|
||||
pInfo->SCANLIST3_PARTICIPATION = false;
|
||||
pInfo->STEP_SETTING = STEP_12_5kHz;
|
||||
pInfo->StepFrequency = gStepFrequencyTable[pInfo->STEP_SETTING];
|
||||
pInfo->CHANNEL_SAVE = ChannelSave;
|
||||
@@ -186,19 +218,24 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
|
||||
bool bParticipation1;
|
||||
bool bParticipation2;
|
||||
bool bParticipation3;
|
||||
|
||||
if (IS_MR_CHANNEL(channel)) {
|
||||
bParticipation1 = att.scanlist1;
|
||||
bParticipation2 = att.scanlist2;
|
||||
bParticipation3 = att.scanlist3;
|
||||
}
|
||||
else {
|
||||
band = channel - FREQ_CHANNEL_FIRST;
|
||||
bParticipation1 = true;
|
||||
bParticipation2 = true;
|
||||
bParticipation3 = true;
|
||||
}
|
||||
|
||||
pVfo->Band = band;
|
||||
pVfo->SCANLIST1_PARTICIPATION = bParticipation1;
|
||||
pVfo->SCANLIST2_PARTICIPATION = bParticipation2;
|
||||
pVfo->SCANLIST3_PARTICIPATION = bParticipation3;
|
||||
pVfo->CHANNEL_SAVE = channel;
|
||||
|
||||
uint16_t base;
|
||||
|
||||
Reference in New Issue
Block a user