Scan/Priority scanning bug fix + disable TX when AM fix

This commit is contained in:
OneOfEleven 2023-09-28 14:09:45 +01:00
parent 1f1a10b6b8
commit 81bc398908
5 changed files with 22 additions and 25 deletions

View File

@ -9,7 +9,7 @@ ENABLE_UART := 1
ENABLE_AIRCOPY := 0 ENABLE_AIRCOPY := 0
ENABLE_FMRADIO := 1 ENABLE_FMRADIO := 1
ENABLE_NOAA := 0 ENABLE_NOAA := 0
ENABLE_VOICE := 1 ENABLE_VOICE := 0
ENABLE_ALARM := 0 ENABLE_ALARM := 0
ENABLE_BIG_FREQ := 0 ENABLE_BIG_FREQ := 0
ENABLE_SMALL_BOLD := 1 ENABLE_SMALL_BOLD := 1

View File

@ -611,10 +611,10 @@ static void FREQ_NextChannel(void)
static void MR_NextChannel(void) static void MR_NextChannel(void)
{ {
const uint8_t PreviousCh = gNextMrChannel;
const uint8_t Ch1 = gEeprom.SCANLIST_PRIORITY_CH1[gEeprom.SCAN_LIST_DEFAULT]; const uint8_t Ch1 = gEeprom.SCANLIST_PRIORITY_CH1[gEeprom.SCAN_LIST_DEFAULT];
const uint8_t Ch2 = gEeprom.SCANLIST_PRIORITY_CH2[gEeprom.SCAN_LIST_DEFAULT]; const uint8_t Ch2 = gEeprom.SCANLIST_PRIORITY_CH2[gEeprom.SCAN_LIST_DEFAULT];
const bool bEnabled = gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT]; const bool bEnabled = gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT];
uint8_t PreviousCh = gNextMrChannel;
uint8_t Ch; uint8_t Ch;
if (bEnabled) if (bEnabled)
@ -623,10 +623,7 @@ static void MR_NextChannel(void)
{ {
gPreviousMrChannel = gNextMrChannel; gPreviousMrChannel = gNextMrChannel;
if (RADIO_CheckValidChannel(Ch1, false, 0)) if (RADIO_CheckValidChannel(Ch1, false, 0))
{
gNextMrChannel = Ch1; gNextMrChannel = Ch1;
// goto Skip;
}
else else
gCurrentScanList = 1; gCurrentScanList = 1;
} }
@ -634,27 +631,30 @@ static void MR_NextChannel(void)
if (gCurrentScanList == 1) if (gCurrentScanList == 1)
{ {
if (RADIO_CheckValidChannel(Ch2, false, 0)) if (RADIO_CheckValidChannel(Ch2, false, 0))
{
gNextMrChannel = Ch2; gNextMrChannel = Ch2;
// goto Skip;
}
else else
gCurrentScanList = 2; gCurrentScanList = 2;
} }
if (gCurrentScanList == 2) if (gCurrentScanList == 2)
{
gNextMrChannel = gPreviousMrChannel; gNextMrChannel = gPreviousMrChannel;
else Ch = RADIO_FindNextChannel(gNextMrChannel + gScanState, gScanState, true, gEeprom.SCAN_LIST_DEFAULT);
goto Skip; if (Ch == 0xFF)
return;
gNextMrChannel = Ch;
}
}
else
{
Ch = RADIO_FindNextChannel(gNextMrChannel + gScanState, gScanState, true, gEeprom.SCAN_LIST_DEFAULT);
if (Ch == 0xFF)
return;
gNextMrChannel = Ch;
} }
Ch = RADIO_FindNextChannel(gNextMrChannel + gScanState, gScanState, true, gEeprom.SCAN_LIST_DEFAULT);
if (Ch == 0xFF)
return;
gNextMrChannel = Ch;
Skip:
if (PreviousCh != gNextMrChannel) if (PreviousCh != gNextMrChannel)
{ {
gEeprom.MrChannel[gEeprom.RX_CHANNEL] = gNextMrChannel; gEeprom.MrChannel[gEeprom.RX_CHANNEL] = gNextMrChannel;
@ -666,12 +666,11 @@ Skip:
gUpdateDisplay = true; gUpdateDisplay = true;
} }
ScanPauseDelayIn_10ms = 20; ScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
bScanKeepFrequency = false; bScanKeepFrequency = false;
if (bEnabled) if (bEnabled)
if (++gCurrentScanList >= 2) if (++gCurrentScanList > 2)
gCurrentScanList = 0; gCurrentScanList = 0;
} }

Binary file not shown.

Binary file not shown.

View File

@ -952,20 +952,18 @@ void RADIO_PrepareTX(void)
VfoState_t State; VfoState_t State;
#ifndef ENABLE_TX_WHEN_AM #ifndef ENABLE_TX_WHEN_AM
// disable the TX when VFO/Channel is set to AM
// the radio does NOT do AM, the adverts are false
if (gCurrentVfo->IsAM) if (gCurrentVfo->IsAM)
{ { // not allowed to TX if in AM mode
State = VFO_STATE_TX_DISABLE; State = VFO_STATE_TX_DISABLE;
} }
else else
#endif #endif
if (!gSetting_TX_EN) if (!gSetting_TX_EN)
{ { // TX is disabled
State = VFO_STATE_TX_DISABLE; State = VFO_STATE_TX_DISABLE;
} }
else else
if (TX_FREQUENCY_Check(gCurrentVfo->pTX->Frequency) == 0 && gCurrentVfo->CHANNEL_SAVE <= FREQ_CHANNEL_LAST) if (TX_FREQUENCY_Check(gCurrentVfo->pTX->Frequency) == 0 || gCurrentVfo->CHANNEL_SAVE <= FREQ_CHANNEL_LAST)
{ {
if (gCurrentVfo->BUSY_CHANNEL_LOCK && gCurrentFunction == FUNCTION_RECEIVE) if (gCurrentVfo->BUSY_CHANNEL_LOCK && gCurrentFunction == FUNCTION_RECEIVE)
State = VFO_STATE_BUSY; State = VFO_STATE_BUSY;