Fixed scanlist behaviour.

This commit is contained in:
Dual Tachyon 2023-09-28 10:27:04 +01:00
parent 3847d3bcbe
commit 858d983935
3 changed files with 18 additions and 16 deletions

View File

@ -45,7 +45,6 @@
#include "driver/st7565.h"
#include "driver/system.h"
#include "dtmf.h"
#include "external/printf/printf.h"
#include "frequencies.h"
#include "functions.h"
#include "helper/battery.h"
@ -404,8 +403,8 @@ static void FREQ_NextChannel(void)
static void MR_NextChannel(void)
{
uint8_t Ch1 = gEeprom.SCANLIST_PRIORITY_CH1[gEeprom.SCAN_LIST_DEFAULT];
uint8_t Ch2 = gEeprom.SCANLIST_PRIORITY_CH2[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];
uint8_t PreviousCh, Ch;
bool bEnabled;
@ -429,19 +428,22 @@ static void MR_NextChannel(void)
}
if (gCurrentScanList == 2) {
gNextMrChannel = gPreviousMrChannel;
} else {
goto Skip;
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;
}
Ch = RADIO_FindNextChannel(gNextMrChannel + gScanState, gScanState, true, gEeprom.SCAN_LIST_DEFAULT);
if (Ch == 0xFF) {
return;
}
gNextMrChannel = Ch;
Skip:
if (PreviousCh != gNextMrChannel) {
gEeprom.MrChannel[gEeprom.RX_CHANNEL] = gNextMrChannel;
gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = gNextMrChannel;
@ -453,7 +455,7 @@ Skip:
bScanKeepFrequency = false;
if (bEnabled) {
gCurrentScanList++;
if (gCurrentScanList >= 2) {
if (gCurrentScanList > 2) {
gCurrentScanList = 0;
}
}

View File

@ -40,7 +40,7 @@ volatile uint16_t ScanPauseDelayIn10msec;
uint8_t gScanProgressIndicator;
uint8_t gScanHitCount;
bool gScanUseCssResult;
uint8_t gScanState;
int8_t gScanState;
bool bScanKeepFrequency;
static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)

View File

@ -48,7 +48,7 @@ extern volatile uint16_t ScanPauseDelayIn10msec;
extern uint8_t gScanProgressIndicator;
extern uint8_t gScanHitCount;
extern bool gScanUseCssResult;
extern uint8_t gScanState;
extern int8_t gScanState;
extern bool bScanKeepFrequency;
void SCANNER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);