Skip to content

Commit

Permalink
Scan/Priority scanning bug fix + disable TX when AM fix
Browse files Browse the repository at this point in the history
  • Loading branch information
OneOfEleven committed Sep 28, 2023
1 parent 1f1a10b commit 81bc398
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ENABLE_UART := 1
ENABLE_AIRCOPY := 0
ENABLE_FMRADIO := 1
ENABLE_NOAA := 0
ENABLE_VOICE := 1
ENABLE_VOICE := 0
ENABLE_ALARM := 0
ENABLE_BIG_FREQ := 0
ENABLE_SMALL_BOLD := 1
Expand Down
35 changes: 17 additions & 18 deletions app/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -611,10 +611,10 @@ static void FREQ_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 Ch2 = gEeprom.SCANLIST_PRIORITY_CH2[gEeprom.SCAN_LIST_DEFAULT];
const bool bEnabled = gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT];
uint8_t PreviousCh = gNextMrChannel;
uint8_t Ch;

if (bEnabled)
Expand All @@ -623,38 +623,38 @@ static void MR_NextChannel(void)
{
gPreviousMrChannel = gNextMrChannel;
if (RADIO_CheckValidChannel(Ch1, false, 0))
{
gNextMrChannel = Ch1;
// goto Skip;
}
else
gCurrentScanList = 1;
}

if (gCurrentScanList == 1)
{
if (RADIO_CheckValidChannel(Ch2, false, 0))
{
gNextMrChannel = Ch2;
// goto Skip;
}
else
gCurrentScanList = 2;
}

if (gCurrentScanList == 2)
{
gNextMrChannel = gPreviousMrChannel;
else
goto Skip;
}
Ch = RADIO_FindNextChannel(gNextMrChannel + gScanState, gScanState, true, gEeprom.SCAN_LIST_DEFAULT);
if (Ch == 0xFF)
return;

Ch = RADIO_FindNextChannel(gNextMrChannel + gScanState, gScanState, true, gEeprom.SCAN_LIST_DEFAULT);
if (Ch == 0xFF)
return;
gNextMrChannel = Ch;
}
}
else
{
Ch = RADIO_FindNextChannel(gNextMrChannel + gScanState, gScanState, true, gEeprom.SCAN_LIST_DEFAULT);
if (Ch == 0xFF)
return;

gNextMrChannel = Ch;
gNextMrChannel = Ch;
}

Skip:
if (PreviousCh != gNextMrChannel)
{
gEeprom.MrChannel[gEeprom.RX_CHANNEL] = gNextMrChannel;
Expand All @@ -666,12 +666,11 @@ static void MR_NextChannel(void)
gUpdateDisplay = true;
}

ScanPauseDelayIn_10ms = 20;

ScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
bScanKeepFrequency = false;

if (bEnabled)
if (++gCurrentScanList >= 2)
if (++gCurrentScanList > 2)
gCurrentScanList = 0;
}

Expand Down
Binary file modified firmware.bin
Binary file not shown.
Binary file modified firmware.packed.bin
Binary file not shown.
8 changes: 3 additions & 5 deletions radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -952,20 +952,18 @@ void RADIO_PrepareTX(void)
VfoState_t State;

#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)
{
{ // not allowed to TX if in AM mode
State = VFO_STATE_TX_DISABLE;
}
else
#endif
if (!gSetting_TX_EN)
{
{ // TX is disabled
State = VFO_STATE_TX_DISABLE;
}
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)
State = VFO_STATE_BUSY;
Expand Down

0 comments on commit 81bc398

Please sign in to comment.