Skip to content

Commit

Permalink
Fix nasa#77, Combine consecutive, mutually-exclusive status checks
Browse files Browse the repository at this point in the history
  • Loading branch information
thnkslprpt committed Mar 5, 2023
1 parent 76915e9 commit 49f95bc
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions fsw/src/hs_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,14 +405,6 @@ void HS_EnableEventMonCmd(const CFE_SB_Buffer_t *BufPtr)
{
Status = CFE_SB_SubscribeEx(CFE_SB_ValueToMsgId(CFE_EVS_LONG_EVENT_MSG_MID), HS_AppData.EventPipe,
CFE_SB_DEFAULT_QOS, HS_EVENT_PIPE_DEPTH);

if (Status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(HS_EVENTMON_LONG_SUB_EID, CFE_EVS_EventType_ERROR,
"Event Monitor Enable: Error Subscribing to long-format Events,RC=0x%08X",
(unsigned int)Status);
}

if (Status == CFE_SUCCESS)
{
Status = CFE_SB_SubscribeEx(CFE_SB_ValueToMsgId(CFE_EVS_SHORT_EVENT_MSG_MID), HS_AppData.EventPipe,
Expand All @@ -425,6 +417,12 @@ void HS_EnableEventMonCmd(const CFE_SB_Buffer_t *BufPtr)
(unsigned int)Status);
}
}
else
{
CFE_EVS_SendEvent(HS_EVENTMON_LONG_SUB_EID, CFE_EVS_EventType_ERROR,
"Event Monitor Enable: Error Subscribing to long-format Events,RC=0x%08X",
(unsigned int)Status);
}
}

if (Status == CFE_SUCCESS)
Expand Down Expand Up @@ -462,13 +460,6 @@ void HS_DisableEventMonCmd(const CFE_SB_Buffer_t *BufPtr)
{
Status = CFE_SB_Unsubscribe(CFE_SB_ValueToMsgId(CFE_EVS_LONG_EVENT_MSG_MID), HS_AppData.EventPipe);

if (Status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(HS_EVENTMON_LONG_UNSUB_EID, CFE_EVS_EventType_ERROR,
"Event Monitor Disable: Error Unsubscribing from long-format Events,RC=0x%08X",
(unsigned int)Status);
}

if (Status == CFE_SUCCESS)
{
Status = CFE_SB_Unsubscribe(CFE_SB_ValueToMsgId(CFE_EVS_SHORT_EVENT_MSG_MID), HS_AppData.EventPipe);
Expand All @@ -480,6 +471,12 @@ void HS_DisableEventMonCmd(const CFE_SB_Buffer_t *BufPtr)
(unsigned int)Status);
}
}
else
{
CFE_EVS_SendEvent(HS_EVENTMON_LONG_UNSUB_EID, CFE_EVS_EventType_ERROR,
"Event Monitor Disable: Error Unsubscribing from long-format Events,RC=0x%08X",
(unsigned int)Status);
}
}

if (Status == CFE_SUCCESS)
Expand Down

0 comments on commit 49f95bc

Please sign in to comment.