mirror of
https://github.com/egzumer/uv-k5-firmware-custom
synced 2024-11-21 17:19:57 +00:00
Only append DTMF-ID to TX user code if D_DCD is enable
This commit is contained in:
parent
71375f31b2
commit
66afde980a
@ -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;
|
||||
|
36
board.c
36
board.c
@ -648,37 +648,51 @@ void BOARD_EEPROM_Init(void)
|
||||
if (DTMF_ValidateCodes((char *)Data, 8))
|
||||
memmove(gEeprom.ANI_DTMF_ID, Data, 8);
|
||||
else
|
||||
// Original firmware overflows into the next string
|
||||
memmove(gEeprom.ANI_DTMF_ID, "123\0\0\0\0", 8);
|
||||
|
||||
{
|
||||
memset(gEeprom.ANI_DTMF_ID, 0, sizeof(gEeprom.ANI_DTMF_ID));
|
||||
strcpy(gEeprom.ANI_DTMF_ID, "123");
|
||||
}
|
||||
|
||||
// 0EE8..0EEF
|
||||
EEPROM_ReadBuffer(0x0EE8, Data, 8);
|
||||
if (DTMF_ValidateCodes((char *)Data, 8))
|
||||
memmove(gEeprom.KILL_CODE, Data, 8);
|
||||
else
|
||||
memmove(gEeprom.KILL_CODE, "ABCD9\0\0", 8);
|
||||
|
||||
{
|
||||
memset(gEeprom.KILL_CODE, 0, sizeof(gEeprom.KILL_CODE));
|
||||
strcpy(gEeprom.KILL_CODE, "ABCD9");
|
||||
}
|
||||
|
||||
// 0EF0..0EF7
|
||||
EEPROM_ReadBuffer(0x0EF0, Data, 8);
|
||||
if (DTMF_ValidateCodes((char *)Data, 8))
|
||||
memmove(gEeprom.REVIVE_CODE, Data, 8);
|
||||
else
|
||||
memmove(gEeprom.REVIVE_CODE, "9DCBA\0\0", 8);
|
||||
|
||||
{
|
||||
memset(gEeprom.REVIVE_CODE, 0, sizeof(gEeprom.REVIVE_CODE));
|
||||
strcpy(gEeprom.REVIVE_CODE, "9DCBA");
|
||||
}
|
||||
|
||||
// 0EF8..0F07
|
||||
EEPROM_ReadBuffer(0x0EF8, Data, 16);
|
||||
if (DTMF_ValidateCodes((char *)Data, 16))
|
||||
memmove(gEeprom.DTMF_UP_CODE, Data, 16);
|
||||
else
|
||||
memmove(gEeprom.DTMF_UP_CODE, "12345\0\0\0\0\0\0\0\0\0\0", 16);
|
||||
|
||||
{
|
||||
memset(gEeprom.DTMF_UP_CODE, 0, sizeof(gEeprom.DTMF_UP_CODE));
|
||||
strcpy(gEeprom.DTMF_UP_CODE, "12345");
|
||||
}
|
||||
|
||||
// 0F08..0F17
|
||||
EEPROM_ReadBuffer(0x0F08, Data, 16);
|
||||
if (DTMF_ValidateCodes((char *)Data, 16))
|
||||
memmove(gEeprom.DTMF_DOWN_CODE, Data, 16);
|
||||
else
|
||||
memmove(gEeprom.DTMF_DOWN_CODE, "54321\0\0\0\0\0\0\0\0\0\0", 16);
|
||||
|
||||
{
|
||||
memset(gEeprom.DTMF_DOWN_CODE, 0, sizeof(gEeprom.DTMF_DOWN_CODE));
|
||||
strcpy(gEeprom.DTMF_DOWN_CODE, "54321");
|
||||
}
|
||||
|
||||
// 0F18..0F1F
|
||||
EEPROM_ReadBuffer(0x0F18, Data, 8);
|
||||
gEeprom.SCAN_LIST_DEFAULT = (Data[0] < 2) ? Data[0] : false;
|
||||
|
@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdio.h> // NULL
|
||||
|
||||
#include "bk4819.h"
|
||||
#include "bsp/dp32g030/gpio.h"
|
||||
#include "bsp/dp32g030/portcon.h"
|
||||
@ -818,6 +820,10 @@ void BK4819_PlayDTMF(char Code)
|
||||
void BK4819_PlayDTMFString(const char *pString, bool bDelayFirst, uint16_t FirstCodePersistTime, uint16_t HashCodePersistTime, uint16_t CodePersistTime, uint16_t CodeInternalTime)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (pString == NULL)
|
||||
return;
|
||||
|
||||
for (i = 0; pString[i]; i++)
|
||||
{
|
||||
uint16_t Delay;
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user