Skip to content

Commit

Permalink
Merge pull request #2309 from thnkslprpt:fix-1448-simplify-EVS_AddLog…
Browse files Browse the repository at this point in the history
…-logic

Fix #1448, Simplify and clarify EVS_AddLog logic
  • Loading branch information
dzbaker committed Dec 10, 2024
2 parents 914ad7a + 7611318 commit 25336b2
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions modules/evs/fsw/src/cfe_evs_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,15 @@ void EVS_AddLog(CFE_EVS_LongEventTlm_t *EVS_PktPtr)
/* Serialize access to event log control variables */
OS_MutSemTake(CFE_EVS_Global.EVS_SharedDataMutexID);

if ((CFE_EVS_Global.EVS_LogPtr->LogFullFlag == true) &&
(CFE_EVS_Global.EVS_LogPtr->LogMode == CFE_EVS_LogMode_DISCARD))
if (CFE_EVS_Global.EVS_LogPtr->LogFullFlag == true)
{
/* If log is full and in discard mode, just count the event */
CFE_EVS_Global.EVS_LogPtr->LogOverflowCounter++;
}
else
{
if (CFE_EVS_Global.EVS_LogPtr->LogFullFlag == true)
{
/* If log is full and in wrap mode, count it and store it */
CFE_EVS_Global.EVS_LogPtr->LogOverflowCounter++;
}

/* If the log is not full, _or_ if it is in OVERWRITE mode, add the event to the log */
if ((CFE_EVS_Global.EVS_LogPtr->LogFullFlag == false) ||
(CFE_EVS_Global.EVS_LogPtr->LogMode == CFE_EVS_LogMode_OVERWRITE))
{
/* Copy the event data to the next available entry in the log */
memcpy(&CFE_EVS_Global.EVS_LogPtr->LogEntry[CFE_EVS_Global.EVS_LogPtr->Next], EVS_PktPtr, sizeof(*EVS_PktPtr));

Expand Down

0 comments on commit 25336b2

Please sign in to comment.