From e5cff16d98e190998c1511c5f5f7db8139ebd23e Mon Sep 17 00:00:00 2001 From: Juan Antonio Date: Mon, 25 Dec 2023 14:20:15 +0100 Subject: [PATCH] Merge guarded code. Simplify DTMF_CheckGroupCall --- app/dtmf.c | 10 +++++----- app/dtmf.h | 24 ++++++++++++------------ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/dtmf.c b/app/dtmf.c index 9437073..f94723e 100644 --- a/app/dtmf.c +++ b/app/dtmf.c @@ -212,12 +212,12 @@ static bool CompareMessage(const char *pMsg, const char *pTemplate, const unsign DTMF_CallMode_t DTMF_CheckGroupCall(const char *pMsg, const unsigned int size) { - unsigned int i; - for (i = 0; i < size; i++) - if (pMsg[i] == gEeprom.DTMF_GROUP_CALL_CODE) - break; + for (unsigned int i = 0; i < size; i++) + if (pMsg[i] == gEeprom.DTMF_GROUP_CALL_CODE) { + return DTMF_CALL_MODE_GROUP; + } - return (i < size) ? DTMF_CALL_MODE_GROUP : DTMF_CALL_MODE_NOT_GROUP; + return DTMF_CALL_MODE_NOT_GROUP; } #endif diff --git a/app/dtmf.h b/app/dtmf.h index 2b23de4..8e112b3 100644 --- a/app/dtmf.h +++ b/app/dtmf.h @@ -78,7 +78,17 @@ extern uint8_t gDTMF_PreviousIndex; extern char gDTMF_RX_live[20]; extern uint8_t gDTMF_RX_live_timeout; +extern DTMF_ReplyState_t gDTMF_ReplyState; + +bool DTMF_ValidateCodes(char *pCode, const unsigned int size); +char DTMF_GetCharacter(const unsigned int code); +void DTMF_clear_input_box(void); +void DTMF_Append(const char code); +void DTMF_Reply(void); +void DTMF_SendEndOfTransmission(void); + #ifdef ENABLE_DTMF_CALLING + extern char gDTMF_RX[17]; extern uint8_t gDTMF_RX_index; extern uint8_t gDTMF_RX_timeout; @@ -97,23 +107,13 @@ extern DTMF_CallState_t gDTMF_CallState; extern DTMF_CallMode_t gDTMF_CallMode; extern bool gDTMF_IsTx; extern uint8_t gDTMF_TxStopCountdown_500ms; -#endif -extern DTMF_ReplyState_t gDTMF_ReplyState; -bool DTMF_ValidateCodes(char *pCode, const unsigned int size); -char DTMF_GetCharacter(const unsigned int code); -void DTMF_clear_input_box(void); -void DTMF_Append(const char vode); -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 - -void DTMF_SendEndOfTransmission(void); + +#endif #endif