forked from mirror/uv-k5-firmware
Improved CSS scan variable.
This commit is contained in:
parent
1b03446c57
commit
caea38148e
30
app/app.c
30
app/app.c
@ -918,8 +918,8 @@ void APP_TimeSlice10ms(void)
|
||||
return;
|
||||
}
|
||||
|
||||
switch (gScanState) {
|
||||
case 0:
|
||||
switch (gScanCssState) {
|
||||
case SCAN_CSS_STATE_OFF:
|
||||
if (!BK4819_GetFrequencyScanResult(&Result)) {
|
||||
break;
|
||||
}
|
||||
@ -944,13 +944,13 @@ void APP_TimeSlice10ms(void)
|
||||
g_2000045F = 0;
|
||||
g_2000045C = 0;
|
||||
g_20000464 = 0;
|
||||
gScanState = 1;
|
||||
gScanCssState = SCAN_CSS_STATE_SCANNING;
|
||||
GUI_SelectNextDisplay(DISPLAY_SCANNER);
|
||||
}
|
||||
g_2000045D = 0x15;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
case SCAN_CSS_STATE_SCANNING:
|
||||
ScanResult = BK4819_GetCxCSSScanResult(&Result, &CtcssFreq);
|
||||
if (ScanResult == 0) {
|
||||
break;
|
||||
@ -963,7 +963,7 @@ void APP_TimeSlice10ms(void)
|
||||
if (Index != 0xFF) {
|
||||
gCS_ScannedIndex = Index;
|
||||
gCS_ScannedType = CODE_TYPE_DIGITAL;
|
||||
gScanState = 2;
|
||||
gScanCssState = SCAN_CSS_STATE_FOUND;
|
||||
g_2000045C = 1;
|
||||
}
|
||||
} else if (ScanResult == BK4819_CSS_RESULT_CTCSS) {
|
||||
@ -974,7 +974,7 @@ void APP_TimeSlice10ms(void)
|
||||
if (Index == gCS_ScannedIndex && gCS_ScannedType == CODE_TYPE_CONTINUOUS_TONE) {
|
||||
g_2000045F++;
|
||||
if (1 < g_2000045F) {
|
||||
gScanState = 2;
|
||||
gScanCssState = SCAN_CSS_STATE_FOUND;
|
||||
g_2000045C = 1;
|
||||
}
|
||||
} else {
|
||||
@ -984,13 +984,15 @@ void APP_TimeSlice10ms(void)
|
||||
gCS_ScannedIndex = Index;
|
||||
}
|
||||
}
|
||||
if (gScanState < 2) {
|
||||
if (gScanCssState < SCAN_CSS_STATE_FOUND) {
|
||||
BK4819_SetScanFrequency(gScanFrequency);
|
||||
g_2000045D = 0x15;
|
||||
break;
|
||||
}
|
||||
GUI_SelectNextDisplay(DISPLAY_SCANNER);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1059,7 +1061,7 @@ void APP_TimeSlice500ms(void)
|
||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
||||
}
|
||||
}
|
||||
if (gScreenToDisplay != DISPLAY_AIRCOPY && (gScreenToDisplay != DISPLAY_SCANNER || (1 < gScanState))) {
|
||||
if (gScreenToDisplay != DISPLAY_AIRCOPY && (gScreenToDisplay != DISPLAY_SCANNER || (gScanCssState >= SCAN_CSS_STATE_FOUND))) {
|
||||
if (gEeprom.AUTO_KEYPAD_LOCK && gKeyLockCountdown && !gDTMF_InputMode) {
|
||||
gKeyLockCountdown--;
|
||||
if (gKeyLockCountdown == 0) {
|
||||
@ -1136,13 +1138,13 @@ LAB_00004b08:
|
||||
}
|
||||
}
|
||||
|
||||
if (gScreenToDisplay == DISPLAY_SCANNER && gScannerEditState == 0 && gScanState < 2) {
|
||||
if (gScreenToDisplay == DISPLAY_SCANNER && gScannerEditState == 0 && gScanCssState < SCAN_CSS_STATE_FOUND) {
|
||||
g_20000464++;
|
||||
if (0x20 < g_20000464) {
|
||||
if (gScanState == 1 && g_20000458 == 0) {
|
||||
gScanState = 2;
|
||||
if (gScanCssState == SCAN_CSS_STATE_SCANNING && g_20000458 == 0) {
|
||||
gScanCssState = SCAN_CSS_STATE_FOUND;
|
||||
} else {
|
||||
gScanState = 3;
|
||||
gScanCssState = SCAN_CSS_STATE_FAILED;
|
||||
}
|
||||
}
|
||||
gUpdateDisplay = true;
|
||||
@ -1220,13 +1222,13 @@ void FUN_000075b0(void)
|
||||
|
||||
gIsNoaaMode = false;
|
||||
if (g_20000458 == 1) {
|
||||
gScanState = 1;
|
||||
gScanCssState = SCAN_CSS_STATE_SCANNING;
|
||||
gScanFrequency = gRxInfo->pCurrent->Frequency;
|
||||
gStepSetting = gRxInfo->STEP_SETTING;
|
||||
BK4819_PickRXFilterPathBasedOnFrequency(gScanFrequency);
|
||||
BK4819_SetScanFrequency(gScanFrequency);
|
||||
} else {
|
||||
gScanState = 0;
|
||||
gScanCssState = SCAN_CSS_STATE_OFF;
|
||||
gScanFrequency = 0xFFFFFFFF;
|
||||
BK4819_PickRXFilterPathBasedOnFrequency(0xFFFFFFFF);
|
||||
BK4819_EnableFrequencyScan();
|
||||
|
@ -97,19 +97,19 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
if (!bKeyPressed) {
|
||||
return;
|
||||
}
|
||||
if (gScanState == 0 && g_20000458 == 0) {
|
||||
if (gScanCssState == SCAN_CSS_STATE_OFF && g_20000458 == 0) {
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (gScanState == 1) {
|
||||
if (gScanCssState == SCAN_CSS_STATE_SCANNING) {
|
||||
if (g_20000458 == 1) {
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (gScanState == 3) {
|
||||
if (gScanCssState == SCAN_CSS_STATE_FAILED) {
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
@ -151,7 +151,7 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
} else {
|
||||
gScannerEditState = 2;
|
||||
}
|
||||
gScanState = 2;
|
||||
gScanCssState = SCAN_CSS_STATE_FOUND;
|
||||
gAnotherVoiceID = VOICE_ID_MEMORY_CHANNEL;
|
||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||
break;
|
||||
|
2
misc.c
2
misc.c
@ -150,7 +150,7 @@ bool gF_LOCK;
|
||||
uint8_t gScanChannel;
|
||||
uint32_t gScanFrequency;
|
||||
uint8_t gScanPauseMode;
|
||||
uint8_t gScanState;
|
||||
SCAN_CssState_t gScanCssState;
|
||||
uint8_t gShowChPrefix;
|
||||
volatile uint16_t gSystickCountdown2;
|
||||
volatile uint8_t gFoundCDCSSCountdown;
|
||||
|
11
misc.h
11
misc.h
@ -47,6 +47,15 @@ enum {
|
||||
VFO_CONFIGURE_RELOAD = 2U,
|
||||
};
|
||||
|
||||
enum SCAN_CssState_t {
|
||||
SCAN_CSS_STATE_OFF = 0U,
|
||||
SCAN_CSS_STATE_SCANNING = 1U,
|
||||
SCAN_CSS_STATE_FOUND = 2U,
|
||||
SCAN_CSS_STATE_FAILED = 3U,
|
||||
};
|
||||
|
||||
typedef enum SCAN_CssState_t SCAN_CssState_t;
|
||||
|
||||
extern const uint32_t *gUpperLimitFrequencyBandTable;
|
||||
extern const uint32_t *gLowerLimitFrequencyBandTable;
|
||||
|
||||
@ -177,7 +186,7 @@ extern bool gF_LOCK;
|
||||
extern uint8_t gScanChannel;
|
||||
extern uint32_t gScanFrequency;
|
||||
extern uint8_t gScanPauseMode;
|
||||
extern uint8_t gScanState;
|
||||
extern SCAN_CssState_t gScanCssState;
|
||||
extern uint8_t gShowChPrefix;
|
||||
extern volatile uint16_t gSystickCountdown2;
|
||||
extern volatile uint8_t gFoundCDCSSCountdown;
|
||||
|
@ -33,7 +33,7 @@ void UI_DisplayScanner(void)
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
memset(String, 0, sizeof(String));
|
||||
|
||||
if (g_20000458 == 1 || (gScanState != 0 && gScanState != 3)) {
|
||||
if (g_20000458 == 1 || (gScanCssState != SCAN_CSS_STATE_OFF && gScanCssState != SCAN_CSS_STATE_FAILED)) {
|
||||
sprintf(String, "FREQ:%.5f", gScanFrequency * 1e-05);
|
||||
} else {
|
||||
sprintf(String, "FREQ:**.*****");
|
||||
@ -41,7 +41,7 @@ void UI_DisplayScanner(void)
|
||||
UI_PrintString(String, 2, 127, 1, 8, 0);
|
||||
memset(String, 0, sizeof(String));
|
||||
|
||||
if (gScanState < 2 || g_2000045C != 1) {
|
||||
if (gScanCssState < SCAN_CSS_STATE_FOUND || g_2000045C != 1) {
|
||||
sprintf(String, "CTC:******");
|
||||
} else if (gCS_ScannedType == CODE_TYPE_CONTINUOUS_TONE) {
|
||||
sprintf(String, "CTC:%.1fHz", CTCSS_Options[gCS_ScannedIndex] * 0.1);
|
||||
@ -59,11 +59,11 @@ void UI_DisplayScanner(void)
|
||||
if (gScannerEditState == 1) {
|
||||
strcpy(String, "SAVE:");
|
||||
UI_GenerateChannelStringEx(String + 5, gShowChPrefix, gScanChannel);
|
||||
} else if (gScanState < 2) {
|
||||
} else if (gScanCssState < SCAN_CSS_STATE_FOUND) {
|
||||
strcpy(String, "SCAN");
|
||||
memset(String + 4, '.', (g_20000464 & 7) + 1);
|
||||
} else {
|
||||
if (gScanState == 2) {
|
||||
if (gScanCssState == SCAN_CSS_STATE_FOUND) {
|
||||
strcpy(String, "SCAN CMP.");
|
||||
} else {
|
||||
strcpy(String, "SCAN FAIL.");
|
||||
|
Loading…
Reference in New Issue
Block a user