diff --git a/app/app.c b/app/app.c index bda133e..a6e1435 100644 --- a/app/app.c +++ b/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 diff --git a/app/dtmf.c b/app/dtmf.c index 0008d76..2ca91cd 100644 --- a/app/dtmf.c +++ b/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; diff --git a/app/dtmf.h b/app/dtmf.h index 4b2f6a2..b7435a4 100644 --- a/app/dtmf.h +++ b/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; diff --git a/firmware b/firmware index 84b14a1..14150d4 100644 Binary files a/firmware and b/firmware differ diff --git a/firmware.bin b/firmware.bin index fbf2673..ff64044 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index 0b0b575..9e8f698 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/functions.c b/functions.c index bb0a77d..96defef 100644 --- a/functions.c +++ b/functions.c @@ -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; diff --git a/misc.c b/misc.c index 1816943..759e0ae 100644 --- a/misc.c +++ b/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 diff --git a/misc.h b/misc.h index be7081e..91289d6 100644 --- a/misc.h +++ b/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; diff --git a/radio.c b/radio.c index 3118a3a..aa488fb 100644 --- a/radio.c +++ b/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; diff --git a/ui/main.c b/ui/main.c index 1889d59..2a318b5 100644 --- a/ui/main.c +++ b/ui/main.c @@ -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); }