mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-06-19 22:58:04 +03:00
Only append DTMF-ID to TX user code if D_DCD is enable
This commit is contained in:
@ -1803,10 +1803,11 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
gKeyLockCountdown = 30; // 15 seconds
|
||||
|
||||
#ifdef ENABLE_DTMF_DECODER
|
||||
if (Key == KEY_EXIT && bKeyPressed && bKeyHeld)
|
||||
{ // clear the DTMF RX display buffer
|
||||
if (Key == KEY_EXIT && bKeyPressed && bKeyHeld && gDTMF_ReceivedSaved[0] > 0)
|
||||
{ // clear the live DTMF RX if the EXIT key is held
|
||||
gDTMF_RecvTimeoutSaved = 0;
|
||||
gDTMF_ReceivedSaved[0] = '\0';
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
20
app/dtmf.c
20
app/dtmf.c
@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h> // NULL
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
#include "app/fm.h"
|
||||
@ -161,7 +162,7 @@ void DTMF_Append(char Code)
|
||||
if (gDTMF_InputIndex == 0)
|
||||
{
|
||||
memset(gDTMF_InputBox, '-', sizeof(gDTMF_InputBox));
|
||||
gDTMF_InputBox[14] = 0;
|
||||
gDTMF_InputBox[sizeof(gDTMF_InputBox) - 1] = 0;
|
||||
}
|
||||
else
|
||||
if (gDTMF_InputIndex >= sizeof(gDTMF_InputBox))
|
||||
@ -295,12 +296,15 @@ void DTMF_HandleRequest(void)
|
||||
|
||||
void DTMF_Reply(void)
|
||||
{
|
||||
char String[20];
|
||||
const char *pString;
|
||||
uint16_t Delay;
|
||||
char String[20];
|
||||
const char *pString = NULL;
|
||||
|
||||
switch (gDTMF_ReplyState)
|
||||
{
|
||||
case DTMF_REPLY_NONE:
|
||||
return;
|
||||
|
||||
case DTMF_REPLY_ANI:
|
||||
if (gDTMF_CallMode == DTMF_CALL_MODE_DTMF)
|
||||
{
|
||||
@ -308,6 +312,7 @@ void DTMF_Reply(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
// append out ID code onto the end of the DTMF code to send
|
||||
sprintf(String, "%s%c%s", gDTMF_String, gEeprom.DTMF_SEPARATE_CODE, gEeprom.ANI_DTMF_ID);
|
||||
pString = String;
|
||||
}
|
||||
@ -334,16 +339,15 @@ void DTMF_Reply(void)
|
||||
|
||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||
|
||||
if (pString == NULL)
|
||||
return;
|
||||
|
||||
Delay = gEeprom.DTMF_PRELOAD_TIME;
|
||||
if (gEeprom.DTMF_SIDE_TONE)
|
||||
{
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
|
||||
gEnableSpeaker = true;
|
||||
|
||||
Delay = gEeprom.DTMF_PRELOAD_TIME;
|
||||
if (gEeprom.DTMF_PRELOAD_TIME < 60)
|
||||
Delay = 60;
|
||||
Delay = (gEeprom.DTMF_PRELOAD_TIME < 60) ? 60 : gEeprom.DTMF_PRELOAD_TIME;
|
||||
}
|
||||
SYSTEM_DelayMs(Delay);
|
||||
|
||||
|
27
app/dtmf.h
27
app/dtmf.h
@ -21,34 +21,34 @@
|
||||
#include <stdint.h>
|
||||
|
||||
enum DTMF_State_t {
|
||||
DTMF_STATE_0 = 0U,
|
||||
DTMF_STATE_TX_SUCC = 1U,
|
||||
DTMF_STATE_CALL_OUT_RSP = 2U,
|
||||
DTMF_STATE_0 = 0,
|
||||
DTMF_STATE_TX_SUCC,
|
||||
DTMF_STATE_CALL_OUT_RSP
|
||||
};
|
||||
|
||||
typedef enum DTMF_State_t DTMF_State_t;
|
||||
|
||||
enum DTMF_CallState_t {
|
||||
DTMF_CALL_STATE_NONE = 0U,
|
||||
DTMF_CALL_STATE_CALL_OUT = 1U,
|
||||
DTMF_CALL_STATE_RECEIVED = 2U,
|
||||
DTMF_CALL_STATE_NONE = 0,
|
||||
DTMF_CALL_STATE_CALL_OUT,
|
||||
DTMF_CALL_STATE_RECEIVED
|
||||
};
|
||||
|
||||
typedef enum DTMF_CallState_t DTMF_CallState_t;
|
||||
|
||||
enum DTMF_ReplyState_t {
|
||||
DTMF_REPLY_NONE = 0U,
|
||||
DTMF_REPLY_ANI = 1U,
|
||||
DTMF_REPLY_AB = 2U,
|
||||
DTMF_REPLY_AAAAA = 3U,
|
||||
DTMF_REPLY_NONE = 0,
|
||||
DTMF_REPLY_ANI,
|
||||
DTMF_REPLY_AB,
|
||||
DTMF_REPLY_AAAAA
|
||||
};
|
||||
|
||||
typedef enum DTMF_ReplyState_t DTMF_ReplyState_t;
|
||||
|
||||
enum DTMF_CallMode_t {
|
||||
DTMF_CALL_MODE_NOT_GROUP = 0U,
|
||||
DTMF_CALL_MODE_GROUP = 1U,
|
||||
DTMF_CALL_MODE_DTMF = 2U,
|
||||
DTMF_CALL_MODE_NOT_GROUP = 0,
|
||||
DTMF_CALL_MODE_GROUP,
|
||||
DTMF_CALL_MODE_DTMF
|
||||
};
|
||||
|
||||
typedef enum DTMF_CallMode_t DTMF_CallMode_t;
|
||||
@ -94,4 +94,3 @@ void DTMF_HandleRequest(void);
|
||||
void DTMF_Reply(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -179,16 +179,22 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
|
||||
if (gDTMF_InputMode)
|
||||
{
|
||||
if (gDTMF_InputIndex || gDTMF_PreviousIndex)
|
||||
if (gDTMF_InputIndex > 0 || gDTMF_PreviousIndex > 0)
|
||||
{
|
||||
if (gDTMF_InputIndex == 0)
|
||||
gDTMF_InputIndex = gDTMF_PreviousIndex;
|
||||
|
||||
gDTMF_InputBox[gDTMF_InputIndex] = 0;
|
||||
|
||||
if (gDTMF_InputIndex == 3)
|
||||
gDTMF_CallMode = DTMF_CheckGroupCall(gDTMF_InputBox, 3);
|
||||
else
|
||||
#if 0
|
||||
if (gDTMF_InputIndex == 3)
|
||||
gDTMF_CallMode = DTMF_CheckGroupCall(gDTMF_InputBox, 3); // this will cause our ID tobe appened to the DTMF code
|
||||
else
|
||||
#else
|
||||
if (gDTMF_InputIndex == 3 && gTxVfo->DTMF_DECODING_ENABLE > 0)
|
||||
gDTMF_CallMode = DTMF_CheckGroupCall(gDTMF_InputBox, 3); // this will cause our ID tobe appened to the DTMF code
|
||||
else
|
||||
#endif
|
||||
gDTMF_CallMode = DTMF_CALL_MODE_DTMF;
|
||||
|
||||
strcpy(gDTMF_String, gDTMF_InputBox);
|
||||
|
@ -509,7 +509,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
gKeyInputCountdown = key_input_timeout_500ms;
|
||||
gDTMF_InputMode = true;
|
||||
memmove(gDTMF_InputBox, gDTMF_String, 15);
|
||||
memmove(gDTMF_InputBox, gDTMF_String, sizeof(gDTMF_InputBox));
|
||||
gDTMF_InputIndex = 0;
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
return;
|
||||
|
Reference in New Issue
Block a user