mirror of
https://github.com/DualTachyon/uv-k5-firmware.git
synced 2024-11-21 05:30:49 +08:00
Fixes and improvement with CxCSS.
This commit is contained in:
parent
b718ae81a4
commit
050ac012b5
70
app/app.c
70
app/app.c
@ -209,19 +209,17 @@ void FUN_000051e8(void)
|
||||
return;
|
||||
}
|
||||
|
||||
bFlag = (gStepDirection == 0 || gCopyOfCodeType == CODE_TYPE_OFF);
|
||||
bFlag = (gStepDirection == 0 && gCopyOfCodeType == CODE_TYPE_OFF);
|
||||
if (gRxInfo->CHANNEL_SAVE >= NOAA_CHANNEL_FIRST && gSystickCountdown2) {
|
||||
bFlag = true;
|
||||
gSystickCountdown2 = 0;
|
||||
}
|
||||
if (g_CTCSS_Lost && gCopyOfCodeType == CODE_TYPE_CONTINUOUS_TONE) {
|
||||
bFlag = true;
|
||||
g_20000375 = 0;
|
||||
gFoundCTCSS = false;
|
||||
}
|
||||
if (g_CDCSS_Lost && gCDCSSCodeReceived == 0x01) {
|
||||
if (gCopyOfCodeType == CODE_TYPE_DIGITAL || gCopyOfCodeType == CODE_TYPE_REVERSE_DIGITAL) {
|
||||
g_20000376 = 0;
|
||||
}
|
||||
if (g_CDCSS_Lost && gCDCSSCodeType == CDCSS_POSITIVE_CODE && (gCopyOfCodeType == CODE_TYPE_DIGITAL || gCopyOfCodeType == CODE_TYPE_REVERSE_DIGITAL)) {
|
||||
gFoundCDCSS = false;
|
||||
} else {
|
||||
if (!bFlag) {
|
||||
return;
|
||||
@ -295,10 +293,10 @@ void FUN_000052f0(void)
|
||||
|
||||
switch (gCopyOfCodeType) {
|
||||
case CODE_TYPE_CONTINUOUS_TONE:
|
||||
if (g_20000375 == 1) {
|
||||
if (gSystickCountdown4 == 0) {
|
||||
g_20000375 = 0;
|
||||
g_20000376 = 0;
|
||||
if (gFoundCTCSS) {
|
||||
if (gFoundCTCSSCountdown == 0) {
|
||||
gFoundCTCSS = false;
|
||||
gFoundCDCSS = false;
|
||||
Value = 1;
|
||||
goto LAB_0000544c;
|
||||
}
|
||||
@ -306,10 +304,10 @@ void FUN_000052f0(void)
|
||||
break;
|
||||
case CODE_TYPE_DIGITAL:
|
||||
case CODE_TYPE_REVERSE_DIGITAL:
|
||||
if (g_20000376 == 1) {
|
||||
if (gSystickCountdown3 == 0) {
|
||||
g_20000375 = 0;
|
||||
g_20000376 = 0;
|
||||
if (gFoundCDCSS) {
|
||||
if (gFoundCDCSSCountdown == 0) {
|
||||
gFoundCTCSS = false;
|
||||
gFoundCDCSS = false;
|
||||
Value = 1;
|
||||
goto LAB_0000544c;
|
||||
}
|
||||
@ -323,10 +321,10 @@ void FUN_000052f0(void)
|
||||
switch (gCopyOfCodeType) {
|
||||
case CODE_TYPE_CONTINUOUS_TONE:
|
||||
if (g_CTCSS_Lost) {
|
||||
g_20000375 = 0;
|
||||
} else if (g_20000375 == 0) {
|
||||
g_20000375 = 1;
|
||||
gSystickCountdown4 = 100;
|
||||
gFoundCTCSS = false;
|
||||
} else if (!gFoundCTCSS) {
|
||||
gFoundCTCSS = true;
|
||||
gFoundCTCSSCountdown = 100;
|
||||
}
|
||||
if (g_CxCSS_TAIL_Found) {
|
||||
Value = 2;
|
||||
@ -334,7 +332,7 @@ void FUN_000052f0(void)
|
||||
}
|
||||
break;
|
||||
case CODE_TYPE_OFF:
|
||||
if (gEeprom.SQUELCH_LEVEL != 0) {
|
||||
if (gEeprom.SQUELCH_LEVEL) {
|
||||
if (g_CxCSS_TAIL_Found) {
|
||||
Value = 2;
|
||||
g_CxCSS_TAIL_Found = false;
|
||||
@ -343,14 +341,14 @@ void FUN_000052f0(void)
|
||||
break;
|
||||
case CODE_TYPE_DIGITAL:
|
||||
case CODE_TYPE_REVERSE_DIGITAL:
|
||||
if (g_CDCSS_Lost && gCDCSSCodeReceived == 1) {
|
||||
g_20000376 = 0;
|
||||
} else if (g_20000376 == 0) {
|
||||
g_20000376 = 1;
|
||||
gSystickCountdown3 = 100;
|
||||
if (g_CDCSS_Lost && gCDCSSCodeType == CDCSS_POSITIVE_CODE) {
|
||||
gFoundCDCSS = false;
|
||||
} else if (!gFoundCDCSS) {
|
||||
gFoundCDCSS = true;
|
||||
gFoundCDCSSCountdown = 100;
|
||||
}
|
||||
if (g_CxCSS_TAIL_Found) {
|
||||
if (BK4819_GetCTCSSPhaseShift() == 1) {
|
||||
if (BK4819_GetCTCType() == 1) {
|
||||
Value = 2;
|
||||
}
|
||||
g_CxCSS_TAIL_Found = false;
|
||||
@ -368,7 +366,7 @@ void FUN_000052f0(void)
|
||||
switch (gCopyOfCodeType) {
|
||||
case CODE_TYPE_DIGITAL:
|
||||
case CODE_TYPE_REVERSE_DIGITAL:
|
||||
if (BK4819_GetCTCSSPhaseShift() == 1) {
|
||||
if (BK4819_GetCTCType() == 1) {
|
||||
gNextTimeslice40ms = false;
|
||||
}
|
||||
break;
|
||||
@ -377,9 +375,9 @@ void FUN_000052f0(void)
|
||||
}
|
||||
}
|
||||
|
||||
LAB_0000544c:
|
||||
gNextTimeslice40ms = false;
|
||||
|
||||
LAB_0000544c:
|
||||
switch (Value) {
|
||||
case 1:
|
||||
RADIO_SetupRegisters(true);
|
||||
@ -400,15 +398,13 @@ LAB_0000544c:
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (!gEeprom.TAIL_NOTE_ELIMINATION) {
|
||||
gNextTimeslice40ms = false;
|
||||
break;
|
||||
if (gEeprom.TAIL_NOTE_ELIMINATION) {
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
g_20000342 = 20;
|
||||
gSystickFlag10 = false;
|
||||
g_2000036B = 0;
|
||||
g_20000377 = 1;
|
||||
}
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
g_20000342 = 20;
|
||||
gSystickFlag10 = false;
|
||||
g_2000036B = 0;
|
||||
g_20000377 = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -693,7 +689,7 @@ void APP_CheckRadioInterrupts(void)
|
||||
}
|
||||
if (Mask & BK4819_REG_02_CDCSS_LOST) {
|
||||
g_CDCSS_Lost = true;
|
||||
gCDCSSCodeReceived = BK4819_CheckCDCSSCodeReceived();
|
||||
gCDCSSCodeType = BK4819_GetCDCSSCodeType();
|
||||
}
|
||||
if (Mask & BK4819_REG_02_CDCSS_FOUND) {
|
||||
g_CDCSS_Lost = false;
|
||||
@ -1431,7 +1427,7 @@ void FUN_000075b0(void)
|
||||
g_200003AA = 0;
|
||||
g_CxCSS_TAIL_Found = false;
|
||||
g_CDCSS_Lost = false;
|
||||
gCDCSSCodeReceived = 0;
|
||||
gCDCSSCodeType = 0;
|
||||
g_CTCSS_Lost = false;
|
||||
g_VOX_Lost = false;
|
||||
g_SquelchLost = false;
|
||||
|
5
dcs.h
5
dcs.h
@ -28,6 +28,11 @@ enum DCS_CodeType_t {
|
||||
|
||||
typedef enum DCS_CodeType_t DCS_CodeType_t;
|
||||
|
||||
enum {
|
||||
CDCSS_POSITIVE_CODE = 1U,
|
||||
CDCSS_NEGATIVE_CODE = 2U,
|
||||
};
|
||||
|
||||
extern const uint16_t CTCSS_Options[50];
|
||||
extern const uint16_t DCS_Options[104];
|
||||
|
||||
|
@ -814,14 +814,14 @@ uint8_t BK4819_GetDTMF_5TONE_Code(void)
|
||||
return (BK4819_GetRegister(BK4819_REG_0B) >> 8) & 0x0F;
|
||||
}
|
||||
|
||||
uint8_t BK4819_CheckCDCSSCodeReceived(void)
|
||||
uint8_t BK4819_GetCDCSSCodeType(void)
|
||||
{
|
||||
return (BK4819_GetRegister(BK4819_REG_0C) >> 14) & 3;
|
||||
}
|
||||
|
||||
uint8_t BK4819_GetCTCSSPhaseShift(void)
|
||||
uint8_t BK4819_GetCTCType(void)
|
||||
{
|
||||
return (BK4819_GetRegister(BK4819_REG_0C) >> 14) & 3;
|
||||
return (BK4819_GetRegister(BK4819_REG_0C) >> 10) & 3;
|
||||
}
|
||||
|
||||
void BK4819_SendFSKData(uint16_t *pData)
|
||||
|
@ -122,8 +122,8 @@ void BK4819_StopScan(void);
|
||||
|
||||
uint8_t BK4819_GetDTMF_5TONE_Code(void);
|
||||
|
||||
uint8_t BK4819_CheckCDCSSCodeReceived(void);
|
||||
uint8_t BK4819_GetCTCSSPhaseShift(void);
|
||||
uint8_t BK4819_GetCDCSSCodeType(void);
|
||||
uint8_t BK4819_GetCTCType(void);
|
||||
|
||||
void BK4819_SendFSKData(uint16_t *pData);
|
||||
void BK4819_PrepareFSKReceive(void);
|
||||
|
@ -58,10 +58,10 @@ void FUNCTION_Init(void)
|
||||
g_SquelchLost = false;
|
||||
g_20000342 = 0;
|
||||
gSystickFlag10 = false;
|
||||
g_20000375 = 0;
|
||||
g_20000376 = 0;
|
||||
gSystickCountdown4 = 0;
|
||||
gSystickCountdown3 = 0;
|
||||
gFoundCTCSS = false;
|
||||
gFoundCDCSS = false;
|
||||
gFoundCTCSSCountdown = 0;
|
||||
gFoundCDCSSCountdown = 0;
|
||||
g_20000377 = 0;
|
||||
gSystickCountdown2 = 0;
|
||||
}
|
||||
|
10
misc.c
10
misc.c
@ -61,8 +61,8 @@ uint8_t gUpdateStatus;
|
||||
uint8_t g_20000370;
|
||||
uint8_t g_20000371[2];
|
||||
uint8_t g_20000373;
|
||||
uint8_t g_20000375;
|
||||
uint8_t g_20000376;
|
||||
uint8_t gFoundCTCSS;
|
||||
uint8_t gFoundCDCSS;
|
||||
uint8_t g_20000377;
|
||||
uint8_t gVFO_RSSI_Level[2];
|
||||
uint8_t g_2000037E;
|
||||
@ -96,7 +96,7 @@ uint8_t gFlagSaveChannel;
|
||||
bool gFlagSaveFM;
|
||||
uint8_t g_200003AA;
|
||||
bool g_CDCSS_Lost;
|
||||
uint8_t gCDCSSCodeReceived;
|
||||
uint8_t gCDCSSCodeType;
|
||||
bool g_CTCSS_Lost;
|
||||
bool g_CxCSS_TAIL_Found;
|
||||
bool g_VOX_Lost;
|
||||
@ -173,8 +173,8 @@ uint8_t gScanPauseMode;
|
||||
uint8_t gScanState;
|
||||
uint8_t gShowChPrefix;
|
||||
volatile uint16_t gSystickCountdown2;
|
||||
volatile uint8_t gSystickCountdown3;
|
||||
volatile uint8_t gSystickCountdown4;
|
||||
volatile uint8_t gFoundCDCSSCountdown;
|
||||
volatile uint8_t gFoundCTCSSCountdown;
|
||||
volatile uint16_t gSystickCountdown11;
|
||||
volatile bool gTxTimeoutReached;
|
||||
volatile bool gNextTimeslice40ms;
|
||||
|
10
misc.h
10
misc.h
@ -85,8 +85,8 @@ extern uint8_t gUpdateStatus;
|
||||
extern uint8_t g_20000370;
|
||||
extern uint8_t g_20000371[2];
|
||||
extern uint8_t g_20000373;
|
||||
extern uint8_t g_20000375;
|
||||
extern uint8_t g_20000376;
|
||||
extern uint8_t gFoundCTCSS;
|
||||
extern uint8_t gFoundCDCSS;
|
||||
extern uint8_t g_20000377;
|
||||
extern uint8_t gVFO_RSSI_Level[2];
|
||||
extern uint8_t g_2000037E;
|
||||
@ -120,7 +120,7 @@ extern uint8_t gFlagSaveChannel;
|
||||
extern bool gFlagSaveFM;
|
||||
extern uint8_t g_200003AA;
|
||||
extern bool g_CDCSS_Lost;
|
||||
extern uint8_t gCDCSSCodeReceived;
|
||||
extern uint8_t gCDCSSCodeType;
|
||||
extern bool g_CTCSS_Lost;
|
||||
extern bool g_CxCSS_TAIL_Found;
|
||||
extern bool g_VOX_Lost;
|
||||
@ -197,8 +197,8 @@ extern uint8_t gScanPauseMode;
|
||||
extern uint8_t gScanState;
|
||||
extern uint8_t gShowChPrefix;
|
||||
extern volatile uint16_t gSystickCountdown2;
|
||||
extern volatile uint8_t gSystickCountdown3;
|
||||
extern volatile uint8_t gSystickCountdown4;
|
||||
extern volatile uint8_t gFoundCDCSSCountdown;
|
||||
extern volatile uint8_t gFoundCTCSSCountdown;
|
||||
extern volatile uint16_t gSystickCountdown11;
|
||||
extern volatile bool gTxTimeoutReached;
|
||||
extern volatile bool gNextTimeslice40ms;
|
||||
|
@ -43,11 +43,11 @@ void SystickHandler(void)
|
||||
if (gSystickCountdown2) {
|
||||
gSystickCountdown2--;
|
||||
}
|
||||
if (gSystickCountdown3) {
|
||||
gSystickCountdown3--;
|
||||
if (gFoundCDCSSCountdown) {
|
||||
gFoundCDCSSCountdown--;
|
||||
}
|
||||
if (gSystickCountdown4) {
|
||||
gSystickCountdown4--;
|
||||
if (gFoundCTCSSCountdown) {
|
||||
gFoundCTCSSCountdown--;
|
||||
}
|
||||
if (gCurrentFunction == FUNCTION_0 && gBatterySaveCountdown) {
|
||||
gBatterySaveCountdown--;
|
||||
|
Loading…
Reference in New Issue
Block a user