Renamed Index to Code.

This commit is contained in:
Dual Tachyon 2023-09-07 19:47:26 +01:00
parent d264899cdf
commit 2ae900a88f
6 changed files with 22 additions and 22 deletions

View File

@ -930,7 +930,7 @@ void APP_TimeSlice10ms(void)
BK4819_EnableFrequencyScan(); BK4819_EnableFrequencyScan();
} else { } else {
BK4819_SetScanFrequency(gScanFrequency); BK4819_SetScanFrequency(gScanFrequency);
gScanCssResultIndex = 0xFF; gScanCssResultCode = 0xFF;
gScanCssResultType = 0xFF; gScanCssResultType = 0xFF;
gScanHitCount = 0; gScanHitCount = 0;
gScanUseCssResult = false; gScanUseCssResult = false;
@ -948,21 +948,21 @@ void APP_TimeSlice10ms(void)
} }
BK4819_Disable(); BK4819_Disable();
if (ScanResult == BK4819_CSS_RESULT_CDCSS) { if (ScanResult == BK4819_CSS_RESULT_CDCSS) {
uint8_t Index; uint8_t Code;
Index = DCS_GetCdcssIndex(Result); Code = DCS_GetCdcssCode(Result);
if (Index != 0xFF) { if (Code != 0xFF) {
gScanCssResultIndex = Index; gScanCssResultCode = Code;
gScanCssResultType = CODE_TYPE_DIGITAL; gScanCssResultType = CODE_TYPE_DIGITAL;
gScanCssState = SCAN_CSS_STATE_FOUND; gScanCssState = SCAN_CSS_STATE_FOUND;
gScanUseCssResult = true; gScanUseCssResult = true;
} }
} else if (ScanResult == BK4819_CSS_RESULT_CTCSS) { } else if (ScanResult == BK4819_CSS_RESULT_CTCSS) {
uint8_t Index; uint8_t Code;
Index = DCS_GetCtcssIndex(CtcssFreq); Code = DCS_GetCtcssCode(CtcssFreq);
if (Index != 0xFF) { if (Code != 0xFF) {
if (Index == gScanCssResultIndex && gScanCssResultType == CODE_TYPE_CONTINUOUS_TONE) { if (Code == gScanCssResultCode && gScanCssResultType == CODE_TYPE_CONTINUOUS_TONE) {
gScanHitCount++; gScanHitCount++;
if (gScanHitCount >= 2) { if (gScanHitCount >= 2) {
gScanCssState = SCAN_CSS_STATE_FOUND; gScanCssState = SCAN_CSS_STATE_FOUND;
@ -972,7 +972,7 @@ void APP_TimeSlice10ms(void)
gScanHitCount = 0; gScanHitCount = 0;
} }
gScanCssResultType = CODE_TYPE_CONTINUOUS_TONE; gScanCssResultType = CODE_TYPE_CONTINUOUS_TONE;
gScanCssResultIndex = Index; gScanCssResultCode = Code;
} }
} }
if (gScanCssState < SCAN_CSS_STATE_FOUND) { if (gScanCssState < SCAN_CSS_STATE_FOUND) {

View File

@ -26,7 +26,7 @@
#include "ui/ui.h" #include "ui/ui.h"
DCS_CodeType_t gScanCssResultType; DCS_CodeType_t gScanCssResultType;
uint8_t gScanCssResultIndex; uint8_t gScanCssResultCode;
bool gFlagStartScan; bool gFlagStartScan;
bool gFlagStopScan; bool gFlagStopScan;
bool gScanSingleFrequency; bool gScanSingleFrequency;
@ -185,7 +185,7 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
RADIO_InitInfo(gTxVfo, gTxVfo->CHANNEL_SAVE, FREQUENCY_GetBand(gScanFrequency), gScanFrequency); RADIO_InitInfo(gTxVfo, gTxVfo->CHANNEL_SAVE, FREQUENCY_GetBand(gScanFrequency), gScanFrequency);
if (gScanUseCssResult) { if (gScanUseCssResult) {
gTxVfo->ConfigRX.CodeType = gScanCssResultType; gTxVfo->ConfigRX.CodeType = gScanCssResultType;
gTxVfo->ConfigRX.Code = gScanCssResultIndex; gTxVfo->ConfigRX.Code = gScanCssResultCode;
} }
gTxVfo->ConfigTX = gTxVfo->ConfigRX; gTxVfo->ConfigTX = gTxVfo->ConfigRX;
gTxVfo->STEP_SETTING = gStepSetting; gTxVfo->STEP_SETTING = gStepSetting;
@ -193,9 +193,9 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
RADIO_ConfigureChannel(0, 2); RADIO_ConfigureChannel(0, 2);
RADIO_ConfigureChannel(1, 2); RADIO_ConfigureChannel(1, 2);
gTxVfo->ConfigRX.CodeType = gScanCssResultType; gTxVfo->ConfigRX.CodeType = gScanCssResultType;
gTxVfo->ConfigRX.Code = gScanCssResultIndex; gTxVfo->ConfigRX.Code = gScanCssResultCode;
gTxVfo->ConfigTX.CodeType = gScanCssResultType; gTxVfo->ConfigTX.CodeType = gScanCssResultType;
gTxVfo->ConfigTX.Code = gScanCssResultIndex; gTxVfo->ConfigTX.Code = gScanCssResultCode;
} }
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) { if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
@ -320,7 +320,7 @@ void SCANNER_Start(void)
BK4819_EnableFrequencyScan(); BK4819_EnableFrequencyScan();
} }
gScanDelay = 21; gScanDelay = 21;
gScanCssResultIndex = 0xFF; gScanCssResultCode = 0xFF;
gScanCssResultType = 0xFF; gScanCssResultType = 0xFF;
gScanHitCount = 0; gScanHitCount = 0;
gScanUseCssResult = false; gScanUseCssResult = false;

View File

@ -34,7 +34,7 @@ enum {
}; };
extern DCS_CodeType_t gScanCssResultType; extern DCS_CodeType_t gScanCssResultType;
extern uint8_t gScanCssResultIndex; extern uint8_t gScanCssResultCode;
extern bool gFlagStartScan; extern bool gFlagStartScan;
extern bool gFlagStopScan; extern bool gFlagStopScan;
extern bool gScanSingleFrequency; extern bool gScanSingleFrequency;

4
dcs.c
View File

@ -90,7 +90,7 @@ uint32_t DCS_GetGolayCodeWord(DCS_CodeType_t CodeType, uint8_t Option)
return Code; return Code;
} }
uint8_t DCS_GetCdcssIndex(uint32_t Code) uint8_t DCS_GetCdcssCode(uint32_t Code)
{ {
uint8_t i; uint8_t i;
@ -118,7 +118,7 @@ uint8_t DCS_GetCdcssIndex(uint32_t Code)
return 0xFF; return 0xFF;
} }
uint8_t DCS_GetCtcssIndex(uint16_t Code) uint8_t DCS_GetCtcssCode(uint16_t Code)
{ {
uint8_t i; uint8_t i;
int Smallest; int Smallest;

4
dcs.h
View File

@ -37,8 +37,8 @@ extern const uint16_t CTCSS_Options[50];
extern const uint16_t DCS_Options[104]; extern const uint16_t DCS_Options[104];
uint32_t DCS_GetGolayCodeWord(DCS_CodeType_t CodeType, uint8_t Option); uint32_t DCS_GetGolayCodeWord(DCS_CodeType_t CodeType, uint8_t Option);
uint8_t DCS_GetCdcssIndex(uint32_t Code); uint8_t DCS_GetCdcssCode(uint32_t Code);
uint8_t DCS_GetCtcssIndex(uint16_t Code); uint8_t DCS_GetCtcssCode(uint16_t Code);
#endif #endif

View File

@ -44,9 +44,9 @@ void UI_DisplayScanner(void)
if (gScanCssState < SCAN_CSS_STATE_FOUND || !gScanUseCssResult) { if (gScanCssState < SCAN_CSS_STATE_FOUND || !gScanUseCssResult) {
sprintf(String, "CTC:******"); sprintf(String, "CTC:******");
} else if (gScanCssResultType == CODE_TYPE_CONTINUOUS_TONE) { } else if (gScanCssResultType == CODE_TYPE_CONTINUOUS_TONE) {
sprintf(String, "CTC:%.1fHz", CTCSS_Options[gScanCssResultIndex] * 0.1); sprintf(String, "CTC:%.1fHz", CTCSS_Options[gScanCssResultCode] * 0.1);
} else { } else {
sprintf(String, "DCS:D%03oN", DCS_Options[gScanCssResultIndex]); sprintf(String, "DCS:D%03oN", DCS_Options[gScanCssResultCode]);
} }
UI_PrintString(String, 2, 127, 3, 8, 0); UI_PrintString(String, 2, 127, 3, 8, 0);
memset(String, 0, sizeof(String)); memset(String, 0, sizeof(String));