mirror of
https://github.com/DualTachyon/uv-k5-firmware.git
synced 2024-12-09 09:30:36 +08:00
More DTMF improvements.
This commit is contained in:
parent
567c3ed7aa
commit
1053f0a64c
14
app/app.c
14
app/app.c
@ -122,7 +122,7 @@ void FUN_000051e8(void)
|
||||
|
||||
if (gStepDirection == 0 && g_20000381 == 0) {
|
||||
if (gRxInfo->DTMF_DECODING_ENABLE || gSetting_KILLED) {
|
||||
if (gDTMF_CallState == DTMF_CALL_NONE) {
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_NONE) {
|
||||
if (g_20000411 == 0x01) {
|
||||
g_2000033A = 500;
|
||||
gSystickFlag7 = false;
|
||||
@ -652,7 +652,7 @@ static void FUN_00008334(void)
|
||||
FUNCTION_Select(FUNCTION_0);
|
||||
}
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT) {
|
||||
g_200003BE = 0;
|
||||
gDTMF_ReplyState = DTMF_REPLY_UP_CODE;
|
||||
RADIO_SomethingWithTransmit();
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
@ -720,7 +720,7 @@ void APP_Update(void)
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) {
|
||||
if (gSystickFlag7 && gVoiceWriteIndex == 0) {
|
||||
if (gStepDirection == 0 && g_20000381 == 0) {
|
||||
if (!gPttIsPressed && !gFmRadioMode && gDTMF_CallState == DTMF_CALL_NONE && gCurrentFunction != FUNCTION_POWER_SAVE) {
|
||||
if (!gPttIsPressed && !gFmRadioMode && gDTMF_CallState == DTMF_CALL_STATE_NONE && gCurrentFunction != FUNCTION_POWER_SAVE) {
|
||||
FUN_00007f4c();
|
||||
if (g_2000041F == 1 && gScreenToDisplay == DISPLAY_MAIN) {
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
@ -744,7 +744,7 @@ void APP_Update(void)
|
||||
}
|
||||
|
||||
if (gSchedulePowerSave) {
|
||||
if (gEeprom.BATTERY_SAVE == 0 || gStepDirection || g_20000381 || gFmRadioMode || gPttIsPressed || gScreenToDisplay != DISPLAY_MAIN || gKeyBeingHeld || gDTMF_CallState != DTMF_CALL_NONE) {
|
||||
if (gEeprom.BATTERY_SAVE == 0 || gStepDirection || g_20000381 || gFmRadioMode || gPttIsPressed || gScreenToDisplay != DISPLAY_MAIN || gKeyBeingHeld || gDTMF_CallState != DTMF_CALL_STATE_NONE) {
|
||||
gBatterySaveCountdown = 1000;
|
||||
} else {
|
||||
if ((IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) && IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[1])) || !gIsNoaaMode) {
|
||||
@ -1198,11 +1198,11 @@ LAB_00004b08:
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
if (gDTMF_CallState != DTMF_CALL_NONE && gCurrentFunction != FUNCTION_TRANSMIT && gCurrentFunction != FUNCTION_RECEIVE) {
|
||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE && gCurrentFunction != FUNCTION_TRANSMIT && gCurrentFunction != FUNCTION_RECEIVE) {
|
||||
if (gDTMF_AUTO_RESET_TIME) {
|
||||
gDTMF_AUTO_RESET_TIME--;
|
||||
if (gDTMF_AUTO_RESET_TIME == 0) {
|
||||
gDTMF_CallState = DTMF_CALL_NONE;
|
||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
}
|
||||
@ -2005,7 +2005,7 @@ Skip:
|
||||
RADIO_ConfigureNOAA();
|
||||
RADIO_SetupRegisters(true);
|
||||
gDTMF_AUTO_RESET_TIME = 0;
|
||||
gDTMF_CallState = DTMF_CALL_NONE;
|
||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
||||
g_200003C3 = 0;
|
||||
g_200003BD = 0;
|
||||
gVFO_RSSI_Level[0] = 0;
|
||||
|
38
app/dtmf.c
38
app/dtmf.c
@ -44,6 +44,8 @@ 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;
|
||||
|
||||
bool DTMF_ValidateCodes(char *pCode, uint8_t Size)
|
||||
{
|
||||
@ -193,23 +195,23 @@ void DTMF_HandleRequest(void)
|
||||
if (gEeprom.PERMIT_REMOTE_KILL) {
|
||||
gSetting_KILLED = true;
|
||||
SETTINGS_SaveSettings();
|
||||
g_200003BE = 2;
|
||||
gDTMF_ReplyState = DTMF_REPLY_AB;
|
||||
if (gFmRadioMode) {
|
||||
FM_TurnOff();
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
}
|
||||
} else {
|
||||
g_200003BE = 0;
|
||||
gDTMF_ReplyState = DTMF_REPLY_UP_CODE;
|
||||
}
|
||||
} else {
|
||||
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, gEeprom.REVIVE_CODE);
|
||||
if (DTMF_CompareMessage(gDTMF_Received + Offset, String, 9, true)) {
|
||||
gSetting_KILLED = false;
|
||||
SETTINGS_SaveSettings();
|
||||
g_200003BE = 2;
|
||||
gDTMF_ReplyState = DTMF_REPLY_AB;
|
||||
}
|
||||
}
|
||||
gDTMF_CallState = DTMF_CALL_NONE;
|
||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
||||
gUpdateDisplay = true;
|
||||
gUpdateStatus = true;
|
||||
return;
|
||||
@ -222,7 +224,7 @@ void DTMF_HandleRequest(void)
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (gDTMF_CallState == DTMF_CALL_1 && g_20000438 == 0 && gDTMF_WriteIndex >= 9) {
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_1 && gDTMF_CallMode == DTMF_CALL_MODE_NOT_GROUP && gDTMF_WriteIndex >= 9) {
|
||||
Offset = gDTMF_WriteIndex - 9;
|
||||
sprintf(String, "%s%c%s", gDTMF_String, gEeprom.DTMF_SEPARATE_CODE, "AAAAA");
|
||||
if (DTMF_CompareMessage(gDTMF_Received + Offset, String, 9, false)) {
|
||||
@ -233,7 +235,7 @@ void DTMF_HandleRequest(void)
|
||||
if (gSetting_KILLED) {
|
||||
return;
|
||||
}
|
||||
if (gDTMF_CallState != DTMF_CALL_NONE) {
|
||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE) {
|
||||
return;
|
||||
}
|
||||
if (gDTMF_WriteIndex < 7) {
|
||||
@ -245,7 +247,7 @@ void DTMF_HandleRequest(void)
|
||||
if (!DTMF_CompareMessage(gDTMF_Received + Offset, String, 4, true)) {
|
||||
return;
|
||||
}
|
||||
gDTMF_CallState = DTMF_CALL_RECEIVED;
|
||||
gDTMF_CallState = DTMF_CALL_STATE_RECEIVED;
|
||||
memcpy(gDTMF_Callee, gDTMF_Received + Offset, 3);
|
||||
memcpy(gDTMF_Caller, gDTMF_Received + Offset + 4, 3);
|
||||
|
||||
@ -257,7 +259,7 @@ void DTMF_HandleRequest(void)
|
||||
gDTMF_DecodeRingCountdown = 20;
|
||||
// Fallthrough
|
||||
case 2:
|
||||
g_200003BE = 3;
|
||||
gDTMF_ReplyState = DTMF_REPLY_AAAAA;
|
||||
break;
|
||||
case 1:
|
||||
gDTMF_DecodeRing = true;
|
||||
@ -265,12 +267,12 @@ void DTMF_HandleRequest(void)
|
||||
break;
|
||||
default:
|
||||
gDTMF_DecodeRing = false;
|
||||
g_200003BE = 0;
|
||||
gDTMF_ReplyState = DTMF_REPLY_UP_CODE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (g_20000439) {
|
||||
g_200003BE = 0;
|
||||
gDTMF_ReplyState = DTMF_REPLY_UP_CODE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -280,9 +282,9 @@ void DTMF_Reply(void)
|
||||
const char *pString;
|
||||
uint16_t Delay;
|
||||
|
||||
switch (g_200003BE) {
|
||||
case 1:
|
||||
if (g_20000438 == 2) {
|
||||
switch (gDTMF_ReplyState) {
|
||||
case DTMF_REPLY_ANI:
|
||||
if (gDTMF_CallMode == DTMF_CALL_MODE_2) {
|
||||
pString = gDTMF_String;
|
||||
} else {
|
||||
sprintf(String, "%s%c%s", gDTMF_String, gEeprom.DTMF_SEPARATE_CODE, gEeprom.ANI_DTMF_ID);
|
||||
@ -290,25 +292,25 @@ void DTMF_Reply(void)
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case DTMF_REPLY_AB:
|
||||
pString = "AB";
|
||||
break;
|
||||
|
||||
case 3:
|
||||
case DTMF_REPLY_AAAAA:
|
||||
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, "AAAAA");
|
||||
pString = String;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (gDTMF_CallState != DTMF_CALL_NONE || (gCrossTxRadioInfo->DTMF_PTT_ID_TX_MODE != PTT_ID_BOT && gCrossTxRadioInfo->DTMF_PTT_ID_TX_MODE != PTT_ID_BOTH)) {
|
||||
g_200003BE = 0;
|
||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE || (gCrossTxRadioInfo->DTMF_PTT_ID_TX_MODE != PTT_ID_BOT && gCrossTxRadioInfo->DTMF_PTT_ID_TX_MODE != PTT_ID_BOTH)) {
|
||||
gDTMF_ReplyState = DTMF_REPLY_UP_CODE;
|
||||
return;
|
||||
}
|
||||
pString = gEeprom.DTMF_UP_CODE;
|
||||
break;
|
||||
}
|
||||
|
||||
g_200003BE = 0;
|
||||
gDTMF_ReplyState = DTMF_REPLY_UP_CODE;
|
||||
Delay = gEeprom.DTMF_PRELOAD_TIME;
|
||||
if (gEeprom.DTMF_SIDE_TONE) {
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
|
25
app/dtmf.h
25
app/dtmf.h
@ -21,13 +21,30 @@
|
||||
#include <stdint.h>
|
||||
|
||||
enum DTMF_CallState_t {
|
||||
DTMF_CALL_NONE = 0U,
|
||||
DTMF_CALL_1 = 1U,
|
||||
DTMF_CALL_RECEIVED = 2U,
|
||||
DTMF_CALL_STATE_NONE = 0U,
|
||||
DTMF_CALL_STATE_1 = 1U,
|
||||
DTMF_CALL_STATE_RECEIVED = 2U,
|
||||
};
|
||||
|
||||
typedef enum DTMF_CallState_t DTMF_CallState_t;
|
||||
|
||||
enum DTMF_ReplyState_t {
|
||||
DTMF_REPLY_UP_CODE = 0U,
|
||||
DTMF_REPLY_ANI = 1U,
|
||||
DTMF_REPLY_AB = 2U,
|
||||
DTMF_REPLY_AAAAA = 3U,
|
||||
};
|
||||
|
||||
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_2 = 2U,
|
||||
};
|
||||
|
||||
typedef enum DTMF_CallMode_t DTMF_CallMode_t;
|
||||
|
||||
extern char gDTMF_String[15];
|
||||
extern char gDTMF_InputBox[15];
|
||||
extern char gDTMF_Received[16];
|
||||
@ -45,6 +62,8 @@ 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;
|
||||
|
||||
bool DTMF_ValidateCodes(char *pCode, uint8_t Size);
|
||||
bool DTMF_GetContact(uint8_t Index, char *pContact);
|
||||
|
@ -134,13 +134,13 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
}
|
||||
gDTMF_InputBox[gDTMF_InputIndex] = 0;
|
||||
if (gDTMF_InputIndex == 3) {
|
||||
g_20000438 = DTMF_IsGroupCall(gDTMF_InputBox, 3);
|
||||
gDTMF_CallMode = DTMF_IsGroupCall(gDTMF_InputBox, 3);
|
||||
} else {
|
||||
g_20000438 = 2;
|
||||
gDTMF_CallMode = DTMF_CALL_MODE_2;
|
||||
}
|
||||
sprintf(gDTMF_String, "%s", gDTMF_InputBox);
|
||||
g_200003C0 = gDTMF_InputIndex;
|
||||
g_200003BE = 1;
|
||||
gDTMF_ReplyState = DTMF_REPLY_ANI;
|
||||
gDTMF_State = 0;
|
||||
}
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
|
@ -84,7 +84,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
}
|
||||
|
||||
if (Function == FUNCTION_0) {
|
||||
if (g_200003BE) {
|
||||
if (gDTMF_ReplyState) {
|
||||
RADIO_Something();
|
||||
}
|
||||
if (PreviousFunction == FUNCTION_TRANSMIT) {
|
||||
@ -98,7 +98,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
if (gFmRadioMode) {
|
||||
g_2000038E = 500;
|
||||
}
|
||||
if (gDTMF_CallState != DTMF_CALL_1 && gDTMF_CallState != DTMF_CALL_RECEIVED) {
|
||||
if (gDTMF_CallState != DTMF_CALL_STATE_1 && gDTMF_CallState != DTMF_CALL_STATE_RECEIVED) {
|
||||
gBatterySaveCountdown = 1000;
|
||||
gSchedulePowerSave = false;
|
||||
return;
|
||||
|
2
misc.c
2
misc.c
@ -111,7 +111,6 @@ uint8_t g_200003B4;
|
||||
uint16_t g_200003B6;
|
||||
uint16_t g_200003B8;
|
||||
uint8_t g_200003BD;
|
||||
uint8_t g_200003BE;
|
||||
uint8_t g_200003C0;
|
||||
uint8_t g_200003C3;
|
||||
uint16_t g_200003E2;
|
||||
@ -132,7 +131,6 @@ uint8_t g_20000427;
|
||||
bool gKeyBeingHeld;
|
||||
bool gPttIsPressed;
|
||||
uint8_t gPttDebounceCounter;
|
||||
uint8_t g_20000438;
|
||||
bool g_20000439;
|
||||
uint8_t gMenuListCount;
|
||||
uint8_t g_20000458;
|
||||
|
2
misc.h
2
misc.h
@ -136,7 +136,6 @@ extern uint8_t g_200003B4;
|
||||
extern uint16_t g_200003B6;
|
||||
extern uint16_t g_200003B8;
|
||||
extern uint8_t g_200003BD;
|
||||
extern uint8_t g_200003BE;
|
||||
extern uint8_t g_200003C0;
|
||||
extern uint8_t g_200003C3;
|
||||
extern uint16_t g_200003E2;
|
||||
@ -157,7 +156,6 @@ extern uint8_t g_20000427;
|
||||
extern bool gKeyBeingHeld;
|
||||
extern bool gPttIsPressed;
|
||||
extern uint8_t gPttDebounceCounter;
|
||||
extern uint8_t g_20000438;
|
||||
extern bool g_20000439;
|
||||
extern uint8_t gMenuListCount;
|
||||
extern uint8_t g_20000458;
|
||||
|
14
radio.c
14
radio.c
@ -737,18 +737,18 @@ void RADIO_SomethingWithTransmit(void)
|
||||
RADIO_SomethingElse(Value);
|
||||
g_20000383 = 0;
|
||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||
g_200003BE = 0;
|
||||
gDTMF_ReplyState = DTMF_REPLY_UP_CODE;
|
||||
return;
|
||||
}
|
||||
|
||||
Skip:
|
||||
if (g_200003BE == 1) {
|
||||
if (g_20000438 == 2) {
|
||||
if (gDTMF_ReplyState == DTMF_REPLY_ANI) {
|
||||
if (gDTMF_CallMode == DTMF_CALL_MODE_2) {
|
||||
g_200003BD = 1;
|
||||
gDTMF_CallState = DTMF_CALL_NONE;
|
||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
||||
g_200003C3 = 6;
|
||||
} else {
|
||||
gDTMF_CallState = DTMF_CALL_1;
|
||||
gDTMF_CallState = DTMF_CALL_STATE_1;
|
||||
g_200003BD = 0;
|
||||
}
|
||||
}
|
||||
@ -761,7 +761,7 @@ Skip:
|
||||
gTxTimeoutReached = false;
|
||||
g_200003FD = 0;
|
||||
gRTTECountdown = 0;
|
||||
g_200003BE = 0;
|
||||
gDTMF_ReplyState = DTMF_REPLY_UP_CODE;
|
||||
}
|
||||
|
||||
void RADIO_EnableCxCSS(void)
|
||||
@ -800,7 +800,7 @@ void RADIO_SendEndOfTransmission(void)
|
||||
} else if (gEeprom.ROGER == ROGER_MODE_MDC) {
|
||||
BK4819_PlayRogerMDC();
|
||||
}
|
||||
if (gDTMF_CallState == DTMF_CALL_NONE && (gCrossTxRadioInfo->DTMF_PTT_ID_TX_MODE == PTT_ID_EOT || gCrossTxRadioInfo->DTMF_PTT_ID_TX_MODE == PTT_ID_BOTH)) {
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_NONE && (gCrossTxRadioInfo->DTMF_PTT_ID_TX_MODE == PTT_ID_EOT || gCrossTxRadioInfo->DTMF_PTT_ID_TX_MODE == PTT_ID_BOTH)) {
|
||||
if (gEeprom.DTMF_SIDE_TONE) {
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
gEnableSpeaker = true;
|
||||
|
10
ui/main.c
10
ui/main.c
@ -64,17 +64,17 @@ void UI_DisplayMain(void)
|
||||
}
|
||||
|
||||
if (Channel != i) {
|
||||
if (gDTMF_CallState != DTMF_CALL_NONE || g_200003BD || gDTMF_InputMode) {
|
||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE || g_200003BD || gDTMF_InputMode) {
|
||||
char Contact[16];
|
||||
|
||||
if (!gDTMF_InputMode) {
|
||||
if (gDTMF_CallState == DTMF_CALL_1) {
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_1) {
|
||||
if (gDTMF_State == 2) {
|
||||
strcpy(String, "CALL OUT(RSP)");
|
||||
} else {
|
||||
strcpy(String, "CALL OUT");
|
||||
}
|
||||
} else if (gDTMF_CallState == DTMF_CALL_RECEIVED) {
|
||||
} else if (gDTMF_CallState == DTMF_CALL_STATE_RECEIVED) {
|
||||
if (DTMF_FindContact(gDTMF_Caller, Contact)) {
|
||||
sprintf(String, "CALL:%s", Contact);
|
||||
} else {
|
||||
@ -96,13 +96,13 @@ void UI_DisplayMain(void)
|
||||
memset(Contact, 0, sizeof(Contact));
|
||||
|
||||
if (!gDTMF_InputMode) {
|
||||
if (gDTMF_CallState == DTMF_CALL_1) {
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_1) {
|
||||
if (DTMF_FindContact(gDTMF_String, Contact)) {
|
||||
sprintf(String, ">%s", Contact);
|
||||
} else {
|
||||
sprintf(String, ">%s", gDTMF_String);
|
||||
}
|
||||
} else if (gDTMF_CallState == DTMF_CALL_RECEIVED) {
|
||||
} else if (gDTMF_CallState == DTMF_CALL_STATE_RECEIVED) {
|
||||
if (DTMF_FindContact(gDTMF_Callee, Contact)) {
|
||||
sprintf(String, ">%s", Contact);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user