mirror of
https://github.com/egzumer/uv-k5-firmware-custom
synced 2024-11-22 01:32:43 +00:00
Live DTMF decoder update
This commit is contained in:
parent
3c1a70a11f
commit
079236f4aa
25
app/app.c
25
app/app.c
@ -663,8 +663,17 @@ void APP_CheckRadioInterrupts(void)
|
||||
|
||||
if (gCurrentFunction == FUNCTION_RECEIVE)
|
||||
{
|
||||
#ifdef ENABLE_DTMF_DECODER
|
||||
if (gDTMF_WriteIndex > 0)
|
||||
{
|
||||
memcpy(gDTMF_ReceivedSaved, gDTMF_Received, sizeof(gDTMF_ReceivedSaved));
|
||||
gDTMF_WriteIndexSaved = gDTMF_WriteIndex;
|
||||
gDTMF_RecvTimeoutSaved = DTMF_RX_timeout_saved_500ms;
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
DTMF_HandleRequest();
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -831,9 +840,7 @@ static void APP_HandleVox(void)
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
{
|
||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||
|
||||
RADIO_PrepareTX();
|
||||
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
}
|
||||
@ -1705,6 +1712,18 @@ void APP_TimeSlice500ms(void)
|
||||
memset(gDTMF_Received, 0, sizeof(gDTMF_Received));
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DTMF_DECODER
|
||||
if (gDTMF_RecvTimeoutSaved > 0)
|
||||
{
|
||||
if (--gDTMF_RecvTimeoutSaved == 0)
|
||||
{
|
||||
gDTMF_WriteIndexSaved = 0;
|
||||
memset(gDTMF_ReceivedSaved, 0, sizeof(gDTMF_ReceivedSaved));
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
|
14
app/dtmf.c
14
app/dtmf.c
@ -33,7 +33,18 @@
|
||||
|
||||
char gDTMF_String[15];
|
||||
char gDTMF_InputBox[15];
|
||||
|
||||
char gDTMF_Received[16];
|
||||
uint8_t gDTMF_WriteIndex = 0;
|
||||
uint8_t gDTMF_PreviousIndex = 0;
|
||||
uint8_t gDTMF_RecvTimeout = 0;
|
||||
|
||||
#ifdef ENABLE_DTMF_DECODER
|
||||
char gDTMF_ReceivedSaved[16];
|
||||
uint8_t gDTMF_WriteIndexSaved = 0;
|
||||
uint8_t gDTMF_RecvTimeoutSaved = 0;
|
||||
#endif
|
||||
|
||||
bool gIsDtmfContactValid;
|
||||
char gDTMF_ID[4];
|
||||
char gDTMF_Caller[4];
|
||||
@ -42,12 +53,9 @@ DTMF_State_t gDTMF_State;
|
||||
bool gDTMF_DecodeRing;
|
||||
uint8_t gDTMF_DecodeRingCountdown;
|
||||
uint8_t gDTMFChosenContact;
|
||||
uint8_t gDTMF_WriteIndex;
|
||||
uint8_t gDTMF_PreviousIndex;
|
||||
uint8_t gDTMF_AUTO_RESET_TIME;
|
||||
uint8_t gDTMF_InputIndex;
|
||||
bool gDTMF_InputMode;
|
||||
uint8_t gDTMF_RecvTimeout;
|
||||
DTMF_CallState_t gDTMF_CallState;
|
||||
DTMF_ReplyState_t gDTMF_ReplyState;
|
||||
DTMF_CallMode_t gDTMF_CallMode;
|
||||
|
14
app/dtmf.h
14
app/dtmf.h
@ -55,7 +55,18 @@ typedef enum DTMF_CallMode_t DTMF_CallMode_t;
|
||||
|
||||
extern char gDTMF_String[15];
|
||||
extern char gDTMF_InputBox[15];
|
||||
|
||||
extern char gDTMF_Received[16];
|
||||
extern uint8_t gDTMF_WriteIndex;
|
||||
extern uint8_t gDTMF_PreviousIndex;
|
||||
extern uint8_t gDTMF_RecvTimeout;
|
||||
|
||||
#ifdef ENABLE_DTMF_DECODER
|
||||
extern char gDTMF_ReceivedSaved[16];
|
||||
extern uint8_t gDTMF_WriteIndexSaved;
|
||||
extern uint8_t gDTMF_RecvTimeoutSaved;
|
||||
#endif
|
||||
|
||||
extern bool gIsDtmfContactValid;
|
||||
extern char gDTMF_ID[4];
|
||||
extern char gDTMF_Caller[4];
|
||||
@ -64,12 +75,9 @@ extern DTMF_State_t gDTMF_State;
|
||||
extern bool gDTMF_DecodeRing;
|
||||
extern uint8_t gDTMF_DecodeRingCountdown;
|
||||
extern uint8_t gDTMFChosenContact;
|
||||
extern uint8_t gDTMF_WriteIndex;
|
||||
extern uint8_t gDTMF_PreviousIndex;
|
||||
extern uint8_t gDTMF_AUTO_RESET_TIME;
|
||||
extern uint8_t gDTMF_InputIndex;
|
||||
extern bool gDTMF_InputMode;
|
||||
extern uint8_t gDTMF_RecvTimeout;
|
||||
extern DTMF_CallState_t gDTMF_CallState;
|
||||
extern DTMF_ReplyState_t gDTMF_ReplyState;
|
||||
extern DTMF_CallMode_t gDTMF_CallMode;
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
@ -54,9 +54,17 @@ void FUNCTION_Init(void)
|
||||
#endif
|
||||
|
||||
gDTMF_RequestPending = false;
|
||||
|
||||
gDTMF_RecvTimeout = 0;
|
||||
gDTMF_WriteIndex = 0;
|
||||
memset(gDTMF_Received, 0, sizeof(gDTMF_Received));
|
||||
|
||||
#ifdef ENABLE_DTMF_DECODER
|
||||
// gDTMF_RecvTimeoutSaved = 0;
|
||||
// gDTMF_WriteIndexSaved = 0;
|
||||
// memset(gDTMF_ReceivedSaved, 0, sizeof(gDTMF_ReceivedSaved));
|
||||
#endif
|
||||
|
||||
g_CxCSS_TAIL_Found = false;
|
||||
g_CDCSS_Lost = false;
|
||||
g_CTCSS_Lost = false;
|
||||
|
1
misc.c
1
misc.c
@ -21,6 +21,7 @@
|
||||
const uint8_t menu_timeout_500ms = 20000 / 500; // 20 seconds
|
||||
|
||||
const uint8_t DTMF_RX_timeout_500ms = 2500 / 500; // 2.5 seconds
|
||||
const uint8_t DTMF_RX_timeout_saved_500ms = 20000 / 500; // 20 seconds
|
||||
|
||||
const uint8_t key_input_timeout_500ms = 8000 / 500; // 8 seconds
|
||||
|
||||
|
1
misc.h
1
misc.h
@ -81,6 +81,7 @@ typedef enum CssScanMode_t CssScanMode_t;
|
||||
extern const uint8_t menu_timeout_500ms;
|
||||
|
||||
extern const uint8_t DTMF_RX_timeout_500ms;
|
||||
extern const uint8_t DTMF_RX_timeout_saved_500ms;
|
||||
|
||||
extern const uint8_t key_input_timeout_500ms;
|
||||
|
||||
|
12
radio.c
12
radio.c
@ -687,11 +687,13 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
BK4819_SetCompander(!gRxVfo->IsAM ? gRxVfo->Compander : 0);
|
||||
#endif
|
||||
|
||||
if (gRxVfo->IsAM || (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED))
|
||||
{
|
||||
BK4819_DisableDTMF();
|
||||
}
|
||||
else
|
||||
#ifndef ENABLE_DTMF_DECODER
|
||||
if (gRxVfo->IsAM || (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED))
|
||||
{
|
||||
BK4819_DisableDTMF();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
BK4819_EnableDTMF();
|
||||
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
|
||||
|
@ -402,11 +402,11 @@ void UI_DisplayMain(void)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DTMF_DECODER
|
||||
if (gCurrentFunction == FUNCTION_RECEIVE && gDTMF_WriteIndex > 0)
|
||||
if (gDTMF_WriteIndexSaved > 0)
|
||||
{ // show the incoming DTMF live on-screen
|
||||
const unsigned int len = (gDTMF_WriteIndex < (ARRAY_SIZE(String) - 1)) ? gDTMF_WriteIndex : ARRAY_SIZE(String) - 1;
|
||||
const unsigned int len = (gDTMF_WriteIndexSaved < ARRAY_SIZE(String)) ? gDTMF_WriteIndexSaved : ARRAY_SIZE(String) - 1;
|
||||
memset(String, 0, sizeof(String));
|
||||
memcpy(String, gDTMF_Received, len);
|
||||
memcpy(String, gDTMF_ReceivedSaved, len);
|
||||
UI_PrintStringSmall("D:", 2, 0, 3);
|
||||
UI_PrintStringSmall(String, 2 + (7 * 2), 0, 3);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user