mirror of
https://github.com/egzumer/uv-k5-firmware-custom
synced 2024-11-21 17:19:57 +00:00
Enable/disable DTMF calling compile option
This commit is contained in:
parent
7857e8ed7a
commit
050e04bcfd
4
Makefile
4
Makefile
@ -39,6 +39,7 @@ ENABLE_REDUCE_LOW_MID_TX_POWER:= 0
|
||||
ENABLE_BYP_RAW_DEMODULATORS := 0
|
||||
ENABLE_BLMIN_TMP_OFF := 0
|
||||
ENABLE_SCAN_RANGES := 1
|
||||
ENABLE_DTMF_CALLING := 1
|
||||
#############################################################
|
||||
|
||||
TARGET = firmware
|
||||
@ -351,6 +352,9 @@ endif
|
||||
ifeq ($(ENABLE_SCAN_RANGES),1)
|
||||
CFLAGS += -DENABLE_SCAN_RANGES
|
||||
endif
|
||||
ifeq ($(ENABLE_DTMF_CALLING),1)
|
||||
CFLAGS += -DENABLE_DTMF_CALLING
|
||||
endif
|
||||
|
||||
LDFLAGS =
|
||||
ifeq ($(ENABLE_CLANG),0)
|
||||
|
@ -167,8 +167,9 @@ void ACTION_Scan(bool bRestart)
|
||||
|
||||
gMonitor = false;
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
DTMF_clear_RX();
|
||||
|
||||
#endif
|
||||
gDTMF_RX_live_timeout = 0;
|
||||
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
|
||||
|
||||
|
75
app/app.c
75
app/app.c
@ -174,9 +174,10 @@ static void HandleIncoming(void)
|
||||
bool bFlag;
|
||||
|
||||
if (!g_SquelchLost) { // squelch is closed
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
if (gDTMF_RX_index > 0)
|
||||
DTMF_clear_RX();
|
||||
|
||||
#endif
|
||||
if (gCurrentFunction != FUNCTION_FOREGROUND) {
|
||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||
gUpdateDisplay = true;
|
||||
@ -204,6 +205,7 @@ static void HandleIncoming(void)
|
||||
else if (!bFlag)
|
||||
return;
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
if (gScanStateDir == SCAN_OFF) { // not scanning
|
||||
if (gRxVfo->DTMF_DECODING_ENABLE || gSetting_KILLED) { // DTMF DCD is enabled
|
||||
|
||||
@ -226,6 +228,7 @@ static void HandleIncoming(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, false);
|
||||
}
|
||||
@ -446,8 +449,10 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
|
||||
const unsigned int chan = gEeprom.RX_VFO;
|
||||
// const unsigned int chan = gRxVfo->CHANNEL_SAVE;
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
if (gSetting_KILLED)
|
||||
return;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFmRadioMode)
|
||||
@ -658,6 +663,7 @@ static void CheckRadioInterrupts(void)
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
if (gRxVfo->DTMF_DECODING_ENABLE || gSetting_KILLED)
|
||||
{
|
||||
if (gDTMF_RX_index >= (sizeof(gDTMF_RX) - 1))
|
||||
@ -672,6 +678,7 @@ static void CheckRadioInterrupts(void)
|
||||
|
||||
DTMF_HandleRequest();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -768,9 +775,11 @@ void APP_EndTransmission(void)
|
||||
#ifdef ENABLE_VOX
|
||||
static void HandleVox(void)
|
||||
{
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
if (gSetting_KILLED)
|
||||
return;
|
||||
|
||||
#endif
|
||||
|
||||
if (gVoxResumeCountdown == 0)
|
||||
{
|
||||
if (gVoxPauseCountdown)
|
||||
@ -837,7 +846,9 @@ void APP_EndTransmission(void)
|
||||
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT && gSerialConfigCountDown_500ms == 0)
|
||||
{
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||
#endif
|
||||
RADIO_PrepareTX();
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
@ -919,7 +930,9 @@ void APP_Update(void)
|
||||
#ifdef ENABLE_FMRADIO
|
||||
!gFmRadioMode &&
|
||||
#endif
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
gDTMF_CallState == DTMF_CALL_STATE_NONE &&
|
||||
#endif
|
||||
gCurrentFunction != FUNCTION_POWER_SAVE)
|
||||
{
|
||||
DualwatchAlternate(); // toggle between the two VFO's
|
||||
@ -955,7 +968,6 @@ void APP_Update(void)
|
||||
|
||||
if (gSchedulePowerSave)
|
||||
{
|
||||
#ifdef ENABLE_NOAA
|
||||
if (
|
||||
#ifdef ENABLE_FMRADIO
|
||||
gFmRadioMode ||
|
||||
@ -965,41 +977,28 @@ void APP_Update(void)
|
||||
gEeprom.BATTERY_SAVE == 0 ||
|
||||
gScanStateDir != SCAN_OFF ||
|
||||
gCssBackgroundScan ||
|
||||
gScreenToDisplay != DISPLAY_MAIN ||
|
||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
gScreenToDisplay != DISPLAY_MAIN
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
||||
#endif
|
||||
)
|
||||
{
|
||||
gBatterySaveCountdown_10ms = battery_save_count_10ms;
|
||||
}
|
||||
else if ((!IS_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) && !IS_NOAA_CHANNEL(gEeprom.ScreenChannel[1])) || !gIsNoaaMode)
|
||||
else
|
||||
#ifdef ENABLE_NOAA
|
||||
if ((!IS_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) && !IS_NOAA_CHANNEL(gEeprom.ScreenChannel[1])) || !gIsNoaaMode)
|
||||
#endif
|
||||
{
|
||||
//if (gCurrentFunction != FUNCTION_POWER_SAVE)
|
||||
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
||||
}
|
||||
#ifdef ENABLE_NOAA
|
||||
else
|
||||
{
|
||||
gBatterySaveCountdown_10ms = battery_save_count_10ms;
|
||||
}
|
||||
#else
|
||||
if (
|
||||
#ifdef ENABLE_FMRADIO
|
||||
gFmRadioMode ||
|
||||
#endif
|
||||
gPttIsPressed ||
|
||||
gKeyBeingHeld ||
|
||||
gEeprom.BATTERY_SAVE == 0 ||
|
||||
gScanStateDir != SCAN_OFF ||
|
||||
gCssBackgroundScan ||
|
||||
gScreenToDisplay != DISPLAY_MAIN ||
|
||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
{
|
||||
gBatterySaveCountdown_10ms = battery_save_count_10ms;
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (gCurrentFunction != FUNCTION_POWER_SAVE)
|
||||
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
||||
}
|
||||
|
||||
gSchedulePowerSave = false;
|
||||
#endif
|
||||
}
|
||||
@ -1068,13 +1067,17 @@ void APP_Update(void)
|
||||
// called every 10ms
|
||||
static void CheckKeys(void)
|
||||
{
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
if (gSetting_KILLED || (gScreenToDisplay == DISPLAY_AIRCOPY && gAircopyState != AIRCOPY_READY))
|
||||
|
||||
if (0
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
|| gSetting_KILLED
|
||||
#endif
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
|| (gScreenToDisplay == DISPLAY_AIRCOPY && gAircopyState != AIRCOPY_READY)
|
||||
#endif
|
||||
)
|
||||
return;
|
||||
#else
|
||||
if (gSetting_KILLED)
|
||||
return;
|
||||
#endif
|
||||
|
||||
|
||||
// -------------------- PTT ------------------------
|
||||
if (gPttIsPressed)
|
||||
@ -1403,9 +1406,11 @@ void APP_TimeSlice500ms(void)
|
||||
if (--gMenuCountdown == 0)
|
||||
exit_menu = (gScreenToDisplay == DISPLAY_MENU); // exit menu mode
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
if (gDTMF_RX_timeout > 0)
|
||||
if (--gDTMF_RX_timeout == 0)
|
||||
DTMF_clear_RX();
|
||||
#endif
|
||||
|
||||
// Skipped authentic device check
|
||||
|
||||
@ -1580,6 +1585,7 @@ void APP_TimeSlice500ms(void)
|
||||
BATTERY_TimeSlice500ms();
|
||||
SCANNER_TimeSlice500ms();
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
{
|
||||
if (gDTMF_DecodeRingCountdown_500ms > 0)
|
||||
@ -1616,6 +1622,7 @@ void APP_TimeSlice500ms(void)
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
@ -1734,6 +1741,7 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
if (gScreenToDisplay == DISPLAY_MENU) // 1of11
|
||||
gMenuCountdown = menu_timeout_500ms;
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
if (gDTMF_DecodeRingCountdown_500ms > 0)
|
||||
{ // cancel the ringing
|
||||
gDTMF_DecodeRingCountdown_500ms = 0;
|
||||
@ -1746,6 +1754,7 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool lowBatPopup = gLowBattery && !gLowBatteryConfirmed && gScreenToDisplay == DISPLAY_MAIN;
|
||||
@ -2051,10 +2060,12 @@ Skip:
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
gDTMF_auto_reset_time_500ms = 0;
|
||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
||||
gDTMF_TxStopCountdown_500ms = 0;
|
||||
gDTMF_IsTx = false;
|
||||
#endif
|
||||
|
||||
gVFO_RSSI_bar_level[0] = 0;
|
||||
gVFO_RSSI_bar_level[1] = 0;
|
||||
|
58
app/dtmf.c
58
app/dtmf.c
@ -41,14 +41,15 @@ uint8_t gDTMF_InputBox_Index = 0;
|
||||
bool gDTMF_InputMode = false;
|
||||
uint8_t gDTMF_PreviousIndex = 0;
|
||||
|
||||
char gDTMF_RX_live[20];
|
||||
uint8_t gDTMF_RX_live_timeout = 0;
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
char gDTMF_RX[17];
|
||||
uint8_t gDTMF_RX_index = 0;
|
||||
uint8_t gDTMF_RX_timeout = 0;
|
||||
bool gDTMF_RX_pending = false;
|
||||
|
||||
char gDTMF_RX_live[20];
|
||||
uint8_t gDTMF_RX_live_timeout = 0;
|
||||
|
||||
bool gIsDtmfContactValid;
|
||||
char gDTMF_ID[4];
|
||||
char gDTMF_Caller[4];
|
||||
@ -58,12 +59,16 @@ uint8_t gDTMF_DecodeRingCountdown_500ms;
|
||||
uint8_t gDTMF_chosen_contact;
|
||||
uint8_t gDTMF_auto_reset_time_500ms;
|
||||
DTMF_CallState_t gDTMF_CallState;
|
||||
DTMF_ReplyState_t gDTMF_ReplyState;
|
||||
DTMF_CallMode_t gDTMF_CallMode;
|
||||
|
||||
bool gDTMF_IsTx;
|
||||
|
||||
uint8_t gDTMF_TxStopCountdown_500ms;
|
||||
bool gDTMF_IsGroupCall;
|
||||
#endif
|
||||
DTMF_ReplyState_t gDTMF_ReplyState;
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
void DTMF_clear_RX(void)
|
||||
{
|
||||
gDTMF_RX_timeout = 0;
|
||||
@ -71,6 +76,7 @@ void DTMF_clear_RX(void)
|
||||
gDTMF_RX_pending = false;
|
||||
memset(gDTMF_RX, 0, sizeof(gDTMF_RX));
|
||||
}
|
||||
#endif
|
||||
|
||||
bool DTMF_ValidateCodes(char *pCode, const unsigned int size)
|
||||
{
|
||||
@ -94,6 +100,7 @@ bool DTMF_ValidateCodes(char *pCode, const unsigned int size)
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
bool DTMF_GetContact(const int Index, char *pContact)
|
||||
{
|
||||
int i = -1;
|
||||
@ -132,6 +139,8 @@ bool DTMF_FindContact(const char *pContact, char *pResult)
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
char DTMF_GetCharacter(const unsigned int code)
|
||||
{
|
||||
switch (code)
|
||||
@ -155,8 +164,8 @@ char DTMF_GetCharacter(const unsigned int code)
|
||||
default: return 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
bool DTMF_CompareMessage(const char *pMsg, const char *pTemplate, const unsigned int size, const bool bCheckGroup)
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
static bool CompareMessage(const char *pMsg, const char *pTemplate, const unsigned int size, const bool bCheckGroup)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < size; i++)
|
||||
@ -181,6 +190,7 @@ DTMF_CallMode_t DTMF_CheckGroupCall(const char *pMsg, const unsigned int size)
|
||||
|
||||
return (i < size) ? DTMF_CALL_MODE_GROUP : DTMF_CALL_MODE_NOT_GROUP;
|
||||
}
|
||||
#endif
|
||||
|
||||
void DTMF_clear_input_box(void)
|
||||
{
|
||||
@ -201,6 +211,7 @@ void DTMF_Append(const char code)
|
||||
gDTMF_InputBox[gDTMF_InputBox_Index++] = code;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
void DTMF_HandleRequest(void)
|
||||
{ // proccess the RX'ed DTMF characters
|
||||
|
||||
@ -231,7 +242,7 @@ void DTMF_HandleRequest(void)
|
||||
|
||||
Offset = gDTMF_RX_index - strlen(String);
|
||||
|
||||
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||
if (CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||
{ // bugger
|
||||
|
||||
if (gEeprom.PERMIT_REMOTE_KILL)
|
||||
@ -272,7 +283,7 @@ void DTMF_HandleRequest(void)
|
||||
|
||||
Offset = gDTMF_RX_index - strlen(String);
|
||||
|
||||
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||
if (CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||
{ // shit, we're back !
|
||||
|
||||
gSetting_KILLED = false;
|
||||
@ -297,7 +308,7 @@ void DTMF_HandleRequest(void)
|
||||
|
||||
Offset = gDTMF_RX_index - strlen(String);
|
||||
|
||||
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||
if (CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||
{ // ends with "AB"
|
||||
|
||||
if (gDTMF_ReplyState != DTMF_REPLY_NONE) // 1of11
|
||||
@ -321,7 +332,7 @@ void DTMF_HandleRequest(void)
|
||||
|
||||
Offset = gDTMF_RX_index - strlen(String);
|
||||
|
||||
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), false))
|
||||
if (CompareMessage(gDTMF_RX + Offset, String, strlen(String), false))
|
||||
{ // we got a response
|
||||
gDTMF_State = DTMF_STATE_CALL_OUT_RSP;
|
||||
DTMF_clear_RX();
|
||||
@ -343,7 +354,7 @@ void DTMF_HandleRequest(void)
|
||||
|
||||
Offset = gDTMF_RX_index - strlen(String) - 3;
|
||||
|
||||
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||
if (CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||
{ // it's for us !
|
||||
|
||||
gDTMF_CallState = DTMF_CALL_STATE_RECEIVED;
|
||||
@ -380,27 +391,33 @@ void DTMF_HandleRequest(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void DTMF_Reply(void)
|
||||
{
|
||||
uint16_t Delay;
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
char String[23];
|
||||
#endif
|
||||
const char *pString = NULL;
|
||||
|
||||
switch (gDTMF_ReplyState)
|
||||
{
|
||||
case DTMF_REPLY_ANI:
|
||||
if (gDTMF_CallMode == DTMF_CALL_MODE_DTMF)
|
||||
{
|
||||
pString = gDTMF_String;
|
||||
}
|
||||
else
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
if (gDTMF_CallMode != DTMF_CALL_MODE_DTMF)
|
||||
{ // append our 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;
|
||||
}
|
||||
break;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
pString = gDTMF_String;
|
||||
}
|
||||
|
||||
break;
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
case DTMF_REPLY_AB:
|
||||
pString = "AB";
|
||||
break;
|
||||
@ -409,10 +426,13 @@ void DTMF_Reply(void)
|
||||
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, "AAAAA");
|
||||
pString = String;
|
||||
break;
|
||||
|
||||
#endif
|
||||
default:
|
||||
case DTMF_REPLY_NONE:
|
||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE ||
|
||||
if (
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
gDTMF_CallState != DTMF_CALL_STATE_NONE ||
|
||||
#endif
|
||||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO ||
|
||||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_OFF ||
|
||||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN)
|
||||
|
25
app/dtmf.h
25
app/dtmf.h
@ -75,14 +75,15 @@ extern uint8_t gDTMF_InputBox_Index;
|
||||
extern bool gDTMF_InputMode;
|
||||
extern uint8_t gDTMF_PreviousIndex;
|
||||
|
||||
extern char gDTMF_RX_live[20];
|
||||
extern uint8_t gDTMF_RX_live_timeout;
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
extern char gDTMF_RX[17];
|
||||
extern uint8_t gDTMF_RX_index;
|
||||
extern uint8_t gDTMF_RX_timeout;
|
||||
extern bool gDTMF_RX_pending;
|
||||
|
||||
extern char gDTMF_RX_live[20];
|
||||
extern uint8_t gDTMF_RX_live_timeout;
|
||||
|
||||
extern bool gIsDtmfContactValid;
|
||||
extern char gDTMF_ID[4];
|
||||
extern char gDTMF_Caller[4];
|
||||
@ -92,21 +93,25 @@ extern uint8_t gDTMF_DecodeRingCountdown_500ms;
|
||||
extern uint8_t gDTMF_chosen_contact;
|
||||
extern uint8_t gDTMF_auto_reset_time_500ms;
|
||||
extern DTMF_CallState_t gDTMF_CallState;
|
||||
extern DTMF_ReplyState_t gDTMF_ReplyState;
|
||||
|
||||
extern DTMF_CallMode_t gDTMF_CallMode;
|
||||
extern bool gDTMF_IsTx;
|
||||
extern uint8_t gDTMF_TxStopCountdown_500ms;
|
||||
#endif
|
||||
extern DTMF_ReplyState_t gDTMF_ReplyState;
|
||||
|
||||
void DTMF_clear_RX(void);
|
||||
bool DTMF_ValidateCodes(char *pCode, const unsigned int size);
|
||||
bool DTMF_GetContact(const int Index, char *pContact);
|
||||
bool DTMF_FindContact(const char *pContact, char *pResult);
|
||||
char DTMF_GetCharacter(const unsigned int code);
|
||||
bool DTMF_CompareMessage(const char *pDTMF, const char *pTemplate, const unsigned int size, const bool bFlag);
|
||||
DTMF_CallMode_t DTMF_CheckGroupCall(const char *pDTMF, const unsigned int size);
|
||||
void DTMF_clear_input_box(void);
|
||||
void DTMF_Append(const char vode);
|
||||
void DTMF_HandleRequest(void);
|
||||
void DTMF_Reply(void);
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
void DTMF_clear_RX(void);
|
||||
DTMF_CallMode_t DTMF_CheckGroupCall(const char *pDTMF, const unsigned int size);
|
||||
bool DTMF_GetContact(const int Index, char *pContact);
|
||||
bool DTMF_FindContact(const char *pContact, char *pResult);
|
||||
void DTMF_HandleRequest(void);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -184,6 +184,7 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
|
||||
|
||||
if (!gDTMF_InputMode && gDTMF_InputBox_Index == 0)
|
||||
goto start_tx; // wasn't entering a DTMF code .. start TX'ing (maybe)
|
||||
|
||||
@ -198,6 +199,7 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
if (gDTMF_InputBox_Index < sizeof(gDTMF_InputBox))
|
||||
gDTMF_InputBox[gDTMF_InputBox_Index] = 0; // NULL term the string
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
// append our DTMF ID to the inputted DTMF code -
|
||||
// IF the user inputted code is exactly 3 digits long and D-DCD is enabled
|
||||
if (gDTMF_InputBox_Index == 3 && gTxVfo->DTMF_DECODING_ENABLE > 0)
|
||||
@ -205,12 +207,12 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
else
|
||||
gDTMF_CallMode = DTMF_CALL_MODE_DTMF;
|
||||
|
||||
gDTMF_State = DTMF_STATE_0;
|
||||
#endif
|
||||
// remember the DTMF string
|
||||
gDTMF_PreviousIndex = gDTMF_InputBox_Index;
|
||||
strcpy(gDTMF_String, gDTMF_InputBox);
|
||||
|
||||
gDTMF_ReplyState = DTMF_REPLY_ANI;
|
||||
gDTMF_State = DTMF_STATE_0;
|
||||
}
|
||||
|
||||
DTMF_clear_input_box();
|
||||
|
@ -487,12 +487,14 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE && gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
{ // clear CALL mode being displayed
|
||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
||||
gUpdateDisplay = true;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (!gFmRadioMode)
|
||||
|
27
app/menu.c
27
app/menu.c
@ -244,7 +244,9 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
|
||||
case MENU_S_ADD2:
|
||||
case MENU_STE:
|
||||
case MENU_D_ST:
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
case MENU_D_DCD:
|
||||
#endif
|
||||
case MENU_D_LIVE_DEC:
|
||||
#ifdef ENABLE_NOAA
|
||||
case MENU_NOAA_S:
|
||||
@ -309,12 +311,13 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
|
||||
*pMin = 0;
|
||||
*pMax = 2;
|
||||
break;
|
||||
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
case MENU_D_RSP:
|
||||
*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_D_RSP) - 1;
|
||||
break;
|
||||
|
||||
#endif
|
||||
case MENU_PTT_ID:
|
||||
*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_PTT_ID) - 1;
|
||||
@ -325,21 +328,23 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
|
||||
*pMax = ARRAY_SIZE(gSubMenu_BAT_TXT) - 1;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
case MENU_D_HOLD:
|
||||
*pMin = 5;
|
||||
*pMax = 60;
|
||||
break;
|
||||
|
||||
#endif
|
||||
case MENU_D_PRE:
|
||||
*pMin = 3;
|
||||
*pMax = 99;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
case MENU_D_LIST:
|
||||
*pMin = 1;
|
||||
*pMax = 16;
|
||||
break;
|
||||
|
||||
#endif
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
case MENU_F_CALI:
|
||||
*pMin = -50;
|
||||
@ -661,6 +666,7 @@ void MENU_AcceptSetting(void)
|
||||
gEeprom.DTMF_SIDE_TONE = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
case MENU_D_RSP:
|
||||
gEeprom.DTMF_DECODE_RESPONSE = gSubMenuSelection;
|
||||
break;
|
||||
@ -668,7 +674,7 @@ void MENU_AcceptSetting(void)
|
||||
case MENU_D_HOLD:
|
||||
gEeprom.DTMF_auto_reset_time = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
#endif
|
||||
case MENU_D_PRE:
|
||||
gEeprom.DTMF_PRELOAD_TIME = gSubMenuSelection * 10;
|
||||
break;
|
||||
@ -682,11 +688,13 @@ void MENU_AcceptSetting(void)
|
||||
gSetting_battery_text = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
case MENU_D_DCD:
|
||||
gTxVfo->DTMF_DECODING_ENABLE = gSubMenuSelection;
|
||||
DTMF_clear_RX();
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
#endif
|
||||
|
||||
case MENU_D_LIVE_DEC:
|
||||
gSetting_live_DTMF_decoder = gSubMenuSelection;
|
||||
@ -698,6 +706,7 @@ void MENU_AcceptSetting(void)
|
||||
gUpdateStatus = true;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
case MENU_D_LIST:
|
||||
gDTMF_chosen_contact = gSubMenuSelection - 1;
|
||||
if (gIsDtmfContactValid)
|
||||
@ -709,7 +718,7 @@ void MENU_AcceptSetting(void)
|
||||
gRequestDisplayScreen = DISPLAY_INVALID;
|
||||
}
|
||||
return;
|
||||
|
||||
#endif
|
||||
case MENU_PONMSG:
|
||||
gEeprom.POWER_ON_DISPLAY_MODE = gSubMenuSelection;
|
||||
break;
|
||||
@ -1064,6 +1073,7 @@ void MENU_ShowCurrentSetting(void)
|
||||
gSubMenuSelection = gEeprom.DTMF_SIDE_TONE;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
case MENU_D_RSP:
|
||||
gSubMenuSelection = gEeprom.DTMF_DECODE_RESPONSE;
|
||||
break;
|
||||
@ -1071,7 +1081,7 @@ void MENU_ShowCurrentSetting(void)
|
||||
case MENU_D_HOLD:
|
||||
gSubMenuSelection = gEeprom.DTMF_auto_reset_time;
|
||||
break;
|
||||
|
||||
#endif
|
||||
case MENU_D_PRE:
|
||||
gSubMenuSelection = gEeprom.DTMF_PRELOAD_TIME / 10;
|
||||
break;
|
||||
@ -1084,6 +1094,7 @@ void MENU_ShowCurrentSetting(void)
|
||||
gSubMenuSelection = gSetting_battery_text;
|
||||
return;
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
case MENU_D_DCD:
|
||||
gSubMenuSelection = gTxVfo->DTMF_DECODING_ENABLE;
|
||||
break;
|
||||
@ -1091,7 +1102,7 @@ void MENU_ShowCurrentSetting(void)
|
||||
case MENU_D_LIST:
|
||||
gSubMenuSelection = gDTMF_chosen_contact + 1;
|
||||
break;
|
||||
|
||||
#endif
|
||||
case MENU_D_LIVE_DEC:
|
||||
gSubMenuSelection = gSetting_live_DTMF_decoder;
|
||||
break;
|
||||
|
@ -347,7 +347,9 @@ void SCANNER_Start(bool singleFreq)
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
DTMF_clear_RX();
|
||||
#endif
|
||||
|
||||
gScanDelay_10ms = scan_delay_10ms;
|
||||
gScanCssResultCode = 0xFF;
|
||||
|
@ -400,7 +400,9 @@ static void CMD_052F(const uint8_t *pBuffer)
|
||||
gEeprom.VfoInfo[0].pTX = &gEeprom.VfoInfo[0].freq_config_TX;
|
||||
gEeprom.VfoInfo[0].TX_OFFSET_FREQUENCY_DIRECTION = TX_OFFSET_FREQUENCY_DIRECTION_OFF;
|
||||
gEeprom.VfoInfo[0].DTMF_PTT_ID_TX_MODE = PTT_ID_OFF;
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
gEeprom.VfoInfo[0].DTMF_DECODING_ENABLE = false;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
gIsNoaaMode = false;
|
||||
|
13
board.c
13
board.c
@ -623,10 +623,13 @@ void BOARD_EEPROM_Init(void)
|
||||
// 0ED0..0ED7
|
||||
EEPROM_ReadBuffer(0x0ED0, Data, 8);
|
||||
gEeprom.DTMF_SIDE_TONE = (Data[0] < 2) ? Data[0] : true;
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
gEeprom.DTMF_SEPARATE_CODE = DTMF_ValidateCodes((char *)(Data + 1), 1) ? Data[1] : '*';
|
||||
gEeprom.DTMF_GROUP_CALL_CODE = DTMF_ValidateCodes((char *)(Data + 2), 1) ? Data[2] : '#';
|
||||
gEeprom.DTMF_DECODE_RESPONSE = (Data[3] < 4) ? Data[3] : 0;
|
||||
gEeprom.DTMF_auto_reset_time = (Data[4] < 61) ? Data[4] : (Data[4] >= 5) ? Data[4] : 10;
|
||||
#endif
|
||||
gEeprom.DTMF_PRELOAD_TIME = (Data[5] < 101) ? Data[5] * 10 : 300;
|
||||
gEeprom.DTMF_FIRST_CODE_PERSIST_TIME = (Data[6] < 101) ? Data[6] * 10 : 100;
|
||||
gEeprom.DTMF_HASH_CODE_PERSIST_TIME = (Data[7] < 101) ? Data[7] * 10 : 100;
|
||||
@ -635,9 +638,11 @@ void BOARD_EEPROM_Init(void)
|
||||
EEPROM_ReadBuffer(0x0ED8, Data, 8);
|
||||
gEeprom.DTMF_CODE_PERSIST_TIME = (Data[0] < 101) ? Data[0] * 10 : 100;
|
||||
gEeprom.DTMF_CODE_INTERVAL_TIME = (Data[1] < 101) ? Data[1] * 10 : 100;
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
gEeprom.PERMIT_REMOTE_KILL = (Data[2] < 2) ? Data[2] : true;
|
||||
|
||||
// 0EE0..0EE7
|
||||
|
||||
EEPROM_ReadBuffer(0x0EE0, Data, 8);
|
||||
if (DTMF_ValidateCodes((char *)Data, 8))
|
||||
memmove(gEeprom.ANI_DTMF_ID, Data, 8);
|
||||
@ -646,7 +651,8 @@ void BOARD_EEPROM_Init(void)
|
||||
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))
|
||||
@ -666,7 +672,8 @@ void BOARD_EEPROM_Init(void)
|
||||
memset(gEeprom.REVIVE_CODE, 0, sizeof(gEeprom.REVIVE_CODE));
|
||||
strcpy(gEeprom.REVIVE_CODE, "9DCBA");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// 0EF8..0F07
|
||||
EEPROM_ReadBuffer(0x0EF8, Data, 16);
|
||||
if (DTMF_ValidateCodes((char *)Data, 16))
|
||||
@ -703,7 +710,9 @@ void BOARD_EEPROM_Init(void)
|
||||
EEPROM_ReadBuffer(0x0F40, Data, 8);
|
||||
gSetting_F_LOCK = (Data[0] < F_LOCK_LEN) ? Data[0] : F_LOCK_DEF;
|
||||
gSetting_350TX = (Data[1] < 2) ? Data[1] : false; // was true
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
gSetting_KILLED = (Data[2] < 2) ? Data[2] : false;
|
||||
#endif
|
||||
gSetting_200TX = (Data[3] < 2) ? Data[3] : false;
|
||||
gSetting_500TX = (Data[4] < 2) ? Data[4] : false;
|
||||
gSetting_350EN = (Data[5] < 2) ? Data[5] : true;
|
||||
|
12
functions.c
12
functions.c
@ -55,7 +55,9 @@ void FUNCTION_Init(void)
|
||||
gCurrentCodeType = CODE_TYPE_CONTINUOUS_TONE;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
DTMF_clear_RX();
|
||||
#endif
|
||||
|
||||
g_CxCSS_TAIL_Found = false;
|
||||
g_CDCSS_Lost = false;
|
||||
@ -99,9 +101,10 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
switch (Function)
|
||||
{
|
||||
case FUNCTION_FOREGROUND:
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
if (gDTMF_ReplyState != DTMF_REPLY_NONE)
|
||||
RADIO_PrepareCssTX();
|
||||
|
||||
#endif
|
||||
if (PreviousFunction == FUNCTION_TRANSMIT)
|
||||
{
|
||||
ST7565_FixInterfGlitch();
|
||||
@ -116,14 +119,15 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
if (gFmRadioMode)
|
||||
gFM_RestoreCountdown_10ms = fm_restore_countdown_10ms;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT ||
|
||||
gDTMF_CallState == DTMF_CALL_STATE_RECEIVED ||
|
||||
gDTMF_CallState == DTMF_CALL_STATE_RECEIVED_STAY)
|
||||
{
|
||||
gDTMF_auto_reset_time_500ms = gEeprom.DTMF_auto_reset_time * 2;
|
||||
}
|
||||
|
||||
#endif
|
||||
gUpdateStatus = true;
|
||||
return;
|
||||
|
||||
@ -160,8 +164,10 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
// if DTMF is enabled when TX'ing, it changes the TX audio filtering !! .. 1of11
|
||||
BK4819_DisableDTMF();
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
// clear the DTMF RX buffer
|
||||
DTMF_clear_RX();
|
||||
#endif
|
||||
|
||||
// clear the DTMF RX live decoder buffer
|
||||
gDTMF_RX_live_timeout = 0;
|
||||
|
4
misc.c
4
misc.c
@ -30,9 +30,11 @@ const uint8_t menu_timeout_500ms = 20000 / 500; // 20 second
|
||||
const uint16_t menu_timeout_long_500ms = 120000 / 500; // 2 minutes
|
||||
|
||||
const uint8_t DTMF_RX_live_timeout_500ms = 6000 / 500; // 6 seconds live decoder on screen
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
const uint8_t DTMF_RX_timeout_500ms = 10000 / 500; // 10 seconds till we wipe the DTMF receiver
|
||||
const uint8_t DTMF_decode_ring_countdown_500ms = 15000 / 500; // 15 seconds .. time we sound the ringing for
|
||||
const uint8_t DTMF_txstop_countdown_500ms = 3000 / 500; // 6 seconds
|
||||
#endif
|
||||
|
||||
const uint8_t key_input_timeout_500ms = 8000 / 500; // 8 seconds
|
||||
|
||||
@ -78,7 +80,9 @@ const uint32_t gDefaultAesKey[4] = {0x4AA5CC60, 0x0312CC5F, 0x
|
||||
const uint8_t gMicGain_dB2[5] = {3, 8, 16, 24, 31};
|
||||
|
||||
bool gSetting_350TX;
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
bool gSetting_KILLED;
|
||||
#endif
|
||||
bool gSetting_200TX;
|
||||
bool gSetting_500TX;
|
||||
bool gSetting_350EN;
|
||||
|
4
misc.h
4
misc.h
@ -93,9 +93,11 @@ extern const uint8_t menu_timeout_500ms;
|
||||
extern const uint16_t menu_timeout_long_500ms;
|
||||
|
||||
extern const uint8_t DTMF_RX_live_timeout_500ms;
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
extern const uint8_t DTMF_RX_timeout_500ms;
|
||||
extern const uint8_t DTMF_decode_ring_countdown_500ms;
|
||||
extern const uint8_t DTMF_txstop_countdown_500ms;
|
||||
#endif
|
||||
|
||||
extern const uint8_t key_input_timeout_500ms;
|
||||
|
||||
@ -142,7 +144,9 @@ extern const uint16_t scan_pause_delay_in_7_10ms;
|
||||
extern const uint8_t gMicGain_dB2[5];
|
||||
|
||||
extern bool gSetting_350TX;
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
extern bool gSetting_KILLED;
|
||||
#endif
|
||||
extern bool gSetting_200TX;
|
||||
extern bool gSetting_500TX;
|
||||
extern bool gSetting_350EN;
|
||||
|
17
radio.c
17
radio.c
@ -326,12 +326,16 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
|
||||
if (data[5] == 0xFF)
|
||||
{
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
pVfo->DTMF_DECODING_ENABLE = false;
|
||||
#endif
|
||||
pVfo->DTMF_PTT_ID_TX_MODE = PTT_ID_OFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
pVfo->DTMF_DECODING_ENABLE = ((data[5] >> 0) & 1u) ? true : false;
|
||||
#endif
|
||||
pVfo->DTMF_PTT_ID_TX_MODE = ((data[5] >> 1) & 7u);
|
||||
}
|
||||
|
||||
@ -1023,14 +1027,16 @@ void RADIO_PrepareTX(void)
|
||||
gAlarmState = ALARM_STATE_OFF;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||
|
||||
#endif
|
||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||
return;
|
||||
}
|
||||
|
||||
// TX is allowed
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
if (gDTMF_ReplyState == DTMF_REPLY_ANI)
|
||||
{
|
||||
if (gDTMF_CallMode == DTMF_CALL_MODE_DTMF)
|
||||
@ -1045,6 +1051,7 @@ void RADIO_PrepareTX(void)
|
||||
gDTMF_IsTx = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
FUNCTION_Select(FUNCTION_TRANSMIT);
|
||||
|
||||
@ -1066,7 +1073,10 @@ void RADIO_PrepareTX(void)
|
||||
|
||||
gFlagEndTransmission = false;
|
||||
gRTTECountdown = 0;
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||
#endif
|
||||
}
|
||||
|
||||
void RADIO_EnableCxCSS(void)
|
||||
@ -1105,7 +1115,10 @@ void RADIO_SendEndOfTransmission(void)
|
||||
if (gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO)
|
||||
BK4819_PlaySingleTone(2475, 250, 28, gEeprom.DTMF_SIDE_TONE);
|
||||
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_NONE &&
|
||||
if (
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
gDTMF_CallState == DTMF_CALL_STATE_NONE &&
|
||||
#endif
|
||||
(gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN ||
|
||||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_BOTH))
|
||||
{ // end-of-tx
|
||||
|
3
radio.h
3
radio.h
@ -117,8 +117,9 @@ typedef struct VFO_Info_t
|
||||
uint8_t SCANLIST2_PARTICIPATION;
|
||||
|
||||
uint8_t Band;
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
uint8_t DTMF_DECODING_ENABLE;
|
||||
#endif
|
||||
PTT_ID_t DTMF_PTT_ID_TX_MODE;
|
||||
|
||||
uint8_t BUSY_CHANNEL_LOCK;
|
||||
|
12
settings.c
12
settings.c
@ -141,10 +141,12 @@ void SETTINGS_SaveSettings(void)
|
||||
EEPROM_WriteBuffer(0x0EA8, State);
|
||||
|
||||
State[0] = gEeprom.DTMF_SIDE_TONE;
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
State[1] = gEeprom.DTMF_SEPARATE_CODE;
|
||||
State[2] = gEeprom.DTMF_GROUP_CALL_CODE;
|
||||
State[3] = gEeprom.DTMF_DECODE_RESPONSE;
|
||||
State[4] = gEeprom.DTMF_auto_reset_time;
|
||||
#endif
|
||||
State[5] = gEeprom.DTMF_PRELOAD_TIME / 10U;
|
||||
State[6] = gEeprom.DTMF_FIRST_CODE_PERSIST_TIME / 10U;
|
||||
State[7] = gEeprom.DTMF_HASH_CODE_PERSIST_TIME / 10U;
|
||||
@ -153,7 +155,9 @@ void SETTINGS_SaveSettings(void)
|
||||
memset(State, 0xFF, sizeof(State));
|
||||
State[0] = gEeprom.DTMF_CODE_PERSIST_TIME / 10U;
|
||||
State[1] = gEeprom.DTMF_CODE_INTERVAL_TIME / 10U;
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
State[2] = gEeprom.PERMIT_REMOTE_KILL;
|
||||
#endif
|
||||
EEPROM_WriteBuffer(0x0ED8, State);
|
||||
|
||||
State[0] = gEeprom.SCAN_LIST_DEFAULT;
|
||||
@ -169,7 +173,9 @@ void SETTINGS_SaveSettings(void)
|
||||
memset(State, 0xFF, sizeof(State));
|
||||
State[0] = gSetting_F_LOCK;
|
||||
State[1] = gSetting_350TX;
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
State[2] = gSetting_KILLED;
|
||||
#endif
|
||||
State[3] = gSetting_200TX;
|
||||
State[4] = gSetting_500TX;
|
||||
State[5] = gSetting_350EN;
|
||||
@ -221,7 +227,11 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
|
||||
| (pVFO->OUTPUT_POWER << 2)
|
||||
| (pVFO->CHANNEL_BANDWIDTH << 1)
|
||||
| (pVFO->FrequencyReverse << 0);
|
||||
State[5] = ((pVFO->DTMF_PTT_ID_TX_MODE & 7u) << 1) | ((pVFO->DTMF_DECODING_ENABLE & 1u) << 0);
|
||||
State[5] = ((pVFO->DTMF_PTT_ID_TX_MODE & 7u) << 1)
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
| ((pVFO->DTMF_DECODING_ENABLE & 1u) << 0)
|
||||
#endif
|
||||
;
|
||||
State[6] = pVFO->STEP_SETTING;
|
||||
State[7] = pVFO->SCRAMBLING_TYPE;
|
||||
EEPROM_WriteBuffer(OffsetVFO + 8, State);
|
||||
|
@ -196,9 +196,11 @@ typedef struct {
|
||||
uint8_t MIC_SENSITIVITY;
|
||||
uint8_t MIC_SENSITIVITY_TUNING;
|
||||
uint8_t CHAN_1_CALL;
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
char ANI_DTMF_ID[8];
|
||||
char KILL_CODE[8];
|
||||
char REVIVE_CODE[8];
|
||||
#endif
|
||||
char DTMF_UP_CODE[16];
|
||||
|
||||
uint8_t field57_0x6c;
|
||||
@ -209,17 +211,21 @@ typedef struct {
|
||||
uint8_t field60_0x7e;
|
||||
uint8_t field61_0x7f;
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
char DTMF_SEPARATE_CODE;
|
||||
char DTMF_GROUP_CALL_CODE;
|
||||
uint8_t DTMF_DECODE_RESPONSE;
|
||||
uint8_t DTMF_auto_reset_time;
|
||||
#endif
|
||||
uint16_t DTMF_PRELOAD_TIME;
|
||||
uint16_t DTMF_FIRST_CODE_PERSIST_TIME;
|
||||
uint16_t DTMF_HASH_CODE_PERSIST_TIME;
|
||||
uint16_t DTMF_CODE_PERSIST_TIME;
|
||||
uint16_t DTMF_CODE_INTERVAL_TIME;
|
||||
bool DTMF_SIDE_TONE;
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
bool PERMIT_REMOTE_KILL;
|
||||
#endif
|
||||
int16_t BK4819_XTAL_FREQ_LOW;
|
||||
#ifdef ENABLE_NOAA
|
||||
bool NOAA_AUTO_SCAN;
|
||||
|
57
ui/main.c
57
ui/main.c
@ -108,8 +108,11 @@ void UI_DisplayAudioBar(void)
|
||||
const unsigned int line = 3;
|
||||
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT ||
|
||||
gScreenToDisplay != DISPLAY_MAIN ||
|
||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
gScreenToDisplay != DISPLAY_MAIN
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
||||
#endif
|
||||
)
|
||||
{
|
||||
return; // screen is in use
|
||||
}
|
||||
@ -163,8 +166,11 @@ static void DisplayRSSIBar(const int16_t rssi, const bool now)
|
||||
return; // display is in use
|
||||
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT ||
|
||||
gScreenToDisplay != DISPLAY_MAIN ||
|
||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
gScreenToDisplay != DISPLAY_MAIN
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
||||
#endif
|
||||
)
|
||||
return; // display is in use
|
||||
|
||||
if (now)
|
||||
@ -293,13 +299,20 @@ void UI_DisplayMain(void)
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE || gDTMF_IsTx || gDTMF_InputMode)
|
||||
{ // show DTMF stuff
|
||||
|
||||
|
||||
if (
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
gDTMF_CallState != DTMF_CALL_STATE_NONE || gDTMF_IsTx ||
|
||||
#endif
|
||||
gDTMF_InputMode)
|
||||
{ // show DTMF stuff
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
char Contact[16];
|
||||
|
||||
if (!gDTMF_InputMode)
|
||||
{
|
||||
|
||||
memset(Contact, 0, sizeof(Contact));
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT)
|
||||
strcpy(String, (gDTMF_State == DTMF_STATE_CALL_OUT_RSP) ? "CALL OUT(RSP)" : "CALL OUT");
|
||||
@ -311,14 +324,14 @@ void UI_DisplayMain(void)
|
||||
strcpy(String, (gDTMF_State == DTMF_STATE_TX_SUCC) ? "DTMF TX(SUCC)" : "DTMF TX");
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
sprintf(String, ">%s", gDTMF_InputBox);
|
||||
}
|
||||
UI_PrintString(String, 2, 0, 0 + (vfo_num * 3), 8);
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
memset(String, 0, sizeof(String));
|
||||
if (!gDTMF_InputMode)
|
||||
{
|
||||
if (!gDTMF_InputMode) {
|
||||
memset(Contact, 0, sizeof(Contact));
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT)
|
||||
sprintf(String, ">%s", (DTMF_FindContact(gDTMF_String, Contact)) ? Contact : gDTMF_String);
|
||||
@ -329,8 +342,9 @@ void UI_DisplayMain(void)
|
||||
if (gDTMF_IsTx)
|
||||
sprintf(String, ">%s", gDTMF_String);
|
||||
}
|
||||
UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8);
|
||||
|
||||
UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8);
|
||||
#endif
|
||||
center_line = CENTER_LINE_IN_USE;
|
||||
continue;
|
||||
}
|
||||
@ -646,9 +660,11 @@ void UI_DisplayMain(void)
|
||||
UI_PrintStringSmall(String, LCD_WIDTH + 70, 0, line + 1);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
// show the DTMF decoding symbol
|
||||
if (gEeprom.VfoInfo[vfo_num].DTMF_DECODING_ENABLE || gSetting_KILLED)
|
||||
UI_PrintStringSmall("DTMF", LCD_WIDTH + 78, 0, line + 1);
|
||||
#endif
|
||||
|
||||
// show the audio scramble symbol
|
||||
if (gEeprom.VfoInfo[vfo_num].SCRAMBLING_TYPE > 0 && gSetting_ScrambleEnable)
|
||||
@ -673,8 +689,11 @@ void UI_DisplayMain(void)
|
||||
#if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA)
|
||||
if (rx && gEeprom.VfoInfo[gEeprom.RX_VFO].Modulation == MODULATION_AM && gSetting_AM_fix)
|
||||
{
|
||||
if (gScreenToDisplay != DISPLAY_MAIN ||
|
||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
if (gScreenToDisplay != DISPLAY_MAIN
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
||||
#endif
|
||||
)
|
||||
return;
|
||||
|
||||
center_line = CENTER_LINE_AM_FIX_DATA;
|
||||
@ -699,8 +718,11 @@ void UI_DisplayMain(void)
|
||||
const unsigned int len = strlen(gDTMF_RX_live);
|
||||
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
|
||||
|
||||
if (gScreenToDisplay != DISPLAY_MAIN ||
|
||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
if (gScreenToDisplay != DISPLAY_MAIN
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
||||
#endif
|
||||
)
|
||||
return;
|
||||
|
||||
center_line = CENTER_LINE_DTMF_DEC;
|
||||
@ -730,8 +752,11 @@ void UI_DisplayMain(void)
|
||||
#ifdef ENABLE_SHOW_CHARGE_LEVEL
|
||||
else if (gChargingWithTypeC)
|
||||
{ // charging .. show the battery state
|
||||
if (gScreenToDisplay != DISPLAY_MAIN ||
|
||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
if (gScreenToDisplay != DISPLAY_MAIN
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
||||
#endif
|
||||
)
|
||||
return;
|
||||
|
||||
center_line = CENTER_LINE_CHARGE_DATA;
|
||||
|
31
ui/menu.c
31
ui/menu.c
@ -97,16 +97,22 @@ const t_menu_item MenuList[] =
|
||||
#ifdef ENABLE_ALARM
|
||||
{"AlarmT", VOICE_ID_INVALID, MENU_AL_MOD },
|
||||
#endif
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
{"ANI ID", VOICE_ID_ANI_CODE, MENU_ANI_ID },
|
||||
#endif
|
||||
{"UPCode", VOICE_ID_INVALID, MENU_UPCODE },
|
||||
{"DWCode", VOICE_ID_INVALID, MENU_DWCODE },
|
||||
{"PTT ID", VOICE_ID_INVALID, MENU_PTT_ID },
|
||||
{"D ST", VOICE_ID_INVALID, MENU_D_ST },
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
{"D Resp", VOICE_ID_INVALID, MENU_D_RSP },
|
||||
{"D Hold", VOICE_ID_INVALID, MENU_D_HOLD },
|
||||
#endif
|
||||
{"D Prel", VOICE_ID_INVALID, MENU_D_PRE },
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
{"D Decd", VOICE_ID_INVALID, MENU_D_DCD },
|
||||
{"D List", VOICE_ID_INVALID, MENU_D_LIST },
|
||||
#endif
|
||||
{"D Live", VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder
|
||||
#ifdef ENABLE_AM_FIX
|
||||
{"AM Fix", VOICE_ID_INVALID, MENU_AM_FIX },
|
||||
@ -231,6 +237,7 @@ const char* gSubMenu_MDF[] =
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
const char gSubMenu_D_RSP[][11] =
|
||||
{
|
||||
"DO\nNOTHING",
|
||||
@ -238,6 +245,7 @@ const char gSubMenu_D_RSP[][11] =
|
||||
"REPLY",
|
||||
"BOTH"
|
||||
};
|
||||
#endif
|
||||
|
||||
const char* gSubMenu_PTT_ID[] =
|
||||
{
|
||||
@ -400,7 +408,10 @@ void UI_DisplayMenu(void)
|
||||
const unsigned int menu_item_x2 = LCD_WIDTH - 1;
|
||||
unsigned int i;
|
||||
char String[64]; // bigger cuz we can now do multi-line in one string (use '\n' char)
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
char Contact[16];
|
||||
#endif
|
||||
|
||||
// clear the screen buffer
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
@ -625,7 +636,9 @@ void UI_DisplayMenu(void)
|
||||
case MENU_S_ADD2:
|
||||
case MENU_STE:
|
||||
case MENU_D_ST:
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
case MENU_D_DCD:
|
||||
#endif
|
||||
case MENU_D_LIVE_DEC:
|
||||
#ifdef ENABLE_NOAA
|
||||
case MENU_NOAA_S:
|
||||
@ -743,10 +756,11 @@ void UI_DisplayMenu(void)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
case MENU_ANI_ID:
|
||||
strcpy(String, gEeprom.ANI_DTMF_ID);
|
||||
break;
|
||||
|
||||
#endif
|
||||
case MENU_UPCODE:
|
||||
strcpy(String, gEeprom.DTMF_UP_CODE);
|
||||
break;
|
||||
@ -755,6 +769,7 @@ void UI_DisplayMenu(void)
|
||||
strcpy(String, gEeprom.DTMF_DOWN_CODE);
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
case MENU_D_RSP:
|
||||
strcpy(String, gSubMenu_D_RSP[gSubMenuSelection]);
|
||||
break;
|
||||
@ -762,7 +777,7 @@ void UI_DisplayMenu(void)
|
||||
case MENU_D_HOLD:
|
||||
sprintf(String, "%ds", gSubMenuSelection);
|
||||
break;
|
||||
|
||||
#endif
|
||||
case MENU_D_PRE:
|
||||
sprintf(String, "%d*10ms", gSubMenuSelection);
|
||||
break;
|
||||
@ -775,6 +790,7 @@ void UI_DisplayMenu(void)
|
||||
strcpy(String, gSubMenu_BAT_TXT[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
case MENU_D_LIST:
|
||||
gIsDtmfContactValid = DTMF_GetContact((int)gSubMenuSelection - 1, Contact);
|
||||
if (!gIsDtmfContactValid)
|
||||
@ -782,6 +798,7 @@ void UI_DisplayMenu(void)
|
||||
else
|
||||
memmove(String, Contact, 8);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_PONMSG:
|
||||
strcpy(String, gSubMenu_PONMSG[gSubMenuSelection]);
|
||||
@ -968,6 +985,7 @@ void UI_DisplayMenu(void)
|
||||
if (strlen(gEeprom.DTMF_DOWN_CODE) > 8)
|
||||
UI_PrintString(gEeprom.DTMF_DOWN_CODE + 8, menu_item_x1, menu_item_x2, 4, 8);
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_D_LIST && gIsDtmfContactValid)
|
||||
{
|
||||
Contact[11] = 0;
|
||||
@ -975,12 +993,17 @@ void UI_DisplayMenu(void)
|
||||
sprintf(String, "ID:%s", Contact + 8);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_R_CTCS ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_T_CTCS ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_R_DCS ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_T_DCS ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_D_LIST)
|
||||
UI_MENU_GetCurrentMenuId() == MENU_T_DCS
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
|| UI_MENU_GetCurrentMenuId() == MENU_D_LIST
|
||||
#endif
|
||||
)
|
||||
|
||||
{
|
||||
sprintf(String, "%2d", gSubMenuSelection);
|
||||
UI_PrintStringSmall(String, 105, 0, 0);
|
||||
|
@ -79,16 +79,22 @@ enum
|
||||
#ifdef ENABLE_ALARM
|
||||
MENU_AL_MOD,
|
||||
#endif
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
MENU_ANI_ID,
|
||||
#endif
|
||||
MENU_UPCODE,
|
||||
MENU_DWCODE,
|
||||
MENU_PTT_ID,
|
||||
MENU_D_ST,
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
MENU_D_RSP,
|
||||
MENU_D_HOLD,
|
||||
#endif
|
||||
MENU_D_PRE,
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
MENU_D_DCD,
|
||||
MENU_D_LIST,
|
||||
#endif
|
||||
MENU_D_LIVE_DEC,
|
||||
MENU_PONMSG,
|
||||
MENU_ROGER,
|
||||
@ -142,7 +148,9 @@ extern const char* gSubMenu_MDF[4];
|
||||
#ifdef ENABLE_ALARM
|
||||
extern const char gSubMenu_AL_MOD[2][5];
|
||||
#endif
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
extern const char gSubMenu_D_RSP[4][11];
|
||||
#endif
|
||||
extern const char* gSubMenu_PTT_ID[5];
|
||||
extern const char gSubMenu_PONMSG[4][8];
|
||||
extern const char gSubMenu_ROGER[3][6];
|
||||
|
@ -79,13 +79,16 @@ void UI_DisplayStatus()
|
||||
#else
|
||||
// hmmm, what to put in it's place
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
if (gSetting_KILLED)
|
||||
{
|
||||
memset(line + x, 0xFF, 10);
|
||||
x1 = x + 10;
|
||||
}
|
||||
else
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// SCAN indicator
|
||||
if (gScanStateDir != SCAN_OFF || SCANNER_IsScanning())
|
||||
{
|
||||
@ -105,6 +108,7 @@ void UI_DisplayStatus()
|
||||
UI_PrintStringSmallBuffer(s, line + x);
|
||||
x1 = x + 7;
|
||||
}
|
||||
}
|
||||
x += 7; // font character width
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
|
Loading…
Reference in New Issue
Block a user