Live DTMF decoder update

This commit is contained in:
OneOfEleven 2023-09-16 23:08:57 +01:00
parent 3c1a70a11f
commit 079236f4aa
11 changed files with 64 additions and 17 deletions

View File

@ -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

View File

@ -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;

View File

@ -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

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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
View File

@ -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
View File

@ -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
View File

@ -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;

View File

@ -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);
}