Skip to content

Commit

Permalink
Merge guarded code. Simplify DTMF_CheckGroupCall
Browse files Browse the repository at this point in the history
  • Loading branch information
JuantAldea authored and egzumer committed Dec 28, 2023
1 parent f35ce8d commit e5cff16
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions app/dtmf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
22 changes: 11 additions & 11 deletions app/dtmf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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

0 comments on commit e5cff16

Please sign in to comment.