Skip to content

Commit

Permalink
Merge pull request #25 from thnkslprpt/fix-24-comment-and-empty-line-…
Browse files Browse the repository at this point in the history
…cleanup

Fix #24, Remove redundant/inconsistent comments (/* end of function */, /* end if */ etc.) and clean up empty lines.
  • Loading branch information
dzbaker authored Oct 17, 2022
2 parents 9aaa3d4 + eb61810 commit 61eea35
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 48 deletions.
31 changes: 8 additions & 23 deletions fsw/src/hk_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ void HK_AppMain(void)
** Exit the Application.
*/
CFE_ES_ExitApp(HK_AppData.RunStatus);

} /* End of HK_AppMain() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -212,8 +211,7 @@ int32 HK_AppInit(void)
}

return Status;

} /* End of HK_AppInit() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -300,7 +298,6 @@ int32 HK_TableInit(void)
}

return CFE_SUCCESS;

} /* HK_TableInit */

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Expand All @@ -320,7 +317,6 @@ void HK_AppPipe(const CFE_SB_Buffer_t *BufPtr)

switch (CFE_SB_MsgIdToValue(MessageID))
{

case HK_SEND_COMBINED_PKT_MID:
if (ActualLength != sizeof(HK_Send_Out_Msg_t))
{
Expand Down Expand Up @@ -386,8 +382,7 @@ void HK_AppPipe(const CFE_SB_Buffer_t *BufPtr)
HK_ProcessIncomingHkData(BufPtr);
break;
}

} /* End of HK_AppPipe() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -399,7 +394,7 @@ void HK_SendCombinedHKCmd(const CFE_SB_Buffer_t *BufPtr)
HK_Send_Out_Msg_t *CmdPtr = (HK_Send_Out_Msg_t *)BufPtr;

HK_SendCombinedHkPacket(CmdPtr->OutMsgToSend);
} /* end of HK_SendCombinedHKCmd() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -408,7 +403,6 @@ void HK_SendCombinedHKCmd(const CFE_SB_Buffer_t *BufPtr)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void HK_HousekeepingCmd(const CFE_MSG_CommandHeader_t *Msg)
{

/* copy data into housekeeping packet */
HK_AppData.HkPacket.CmdCounter = HK_AppData.CmdCounter;
HK_AppData.HkPacket.ErrCounter = HK_AppData.ErrCounter;
Expand All @@ -419,8 +413,7 @@ void HK_HousekeepingCmd(const CFE_MSG_CommandHeader_t *Msg)
/* Send housekeeping telemetry packet... */
CFE_SB_TimeStampMsg(&HK_AppData.HkPacket.TlmHeader.Msg);
CFE_SB_TransmitMsg(&HK_AppData.HkPacket.TlmHeader.Msg, true);

} /* End of HK_HousekeepingCmd() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -429,24 +422,20 @@ void HK_HousekeepingCmd(const CFE_MSG_CommandHeader_t *Msg)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void HK_NoopCmd(const CFE_SB_Buffer_t *BufPtr)
{

size_t ExpectedLength = sizeof(HK_NoArgCmd_t);

if (HK_VerifyCmdLength(BufPtr, ExpectedLength) == HK_BAD_MSG_LENGTH_RC)
{

HK_AppData.ErrCounter++;
}
else
{

CFE_EVS_SendEvent(HK_NOOP_CMD_EID, CFE_EVS_EventType_INFORMATION, "HK No-op command, Version %d.%d.%d.%d",
HK_MAJOR_VERSION, HK_MINOR_VERSION, HK_REVISION, HK_MISSION_REV);

HK_AppData.CmdCounter++;
}

} /* End of HK_NoopCmd() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -459,17 +448,14 @@ void HK_ResetCtrsCmd(const CFE_SB_Buffer_t *BufPtr)

if (HK_VerifyCmdLength(BufPtr, ExpectedLength) == HK_BAD_MSG_LENGTH_RC)
{

HK_AppData.ErrCounter++;
}
else
{

HK_ResetHkData();
CFE_EVS_SendEvent(HK_RESET_CNTRS_CMD_EID, CFE_EVS_EventType_DEBUG, "HK Reset Counters command received");
}

} /* End of HK_ResetCtrsCmd() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -482,8 +468,7 @@ void HK_ResetHkData(void)
HK_AppData.ErrCounter = 0;
HK_AppData.CombinedPacketsSent = 0;
HK_AppData.MissingDataCtr = 0;

} /* End of HK_ResetHkData () */
}

/************************/
/* End of File Comment */
Expand Down
1 change: 0 additions & 1 deletion fsw/src/hk_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ typedef struct
hk_runtime_tbl_entry_t *RuntimeTablePtr; /**< \brief Ptr to run-time table entry */

uint8 MemPoolBuffer[HK_NUM_BYTES_IN_MEM_POOL]; /**< \brief HK mempool buffer */

} HK_AppData_t;

/*************************************************************************
Expand Down
32 changes: 11 additions & 21 deletions fsw/src/hk_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ void HK_ProcessIncomingHkData(const CFE_SB_Buffer_t *BufPtr)
"HK table definition exceeds packet length. MID:0x%08lX, Length:%d, Count:%d",
(unsigned long)CFE_SB_MsgIdToValue(MessageID), (int)MessageLength, (int)MessageErrors);
}

} /* end HK_ProcessIncomingHkData */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -108,8 +107,7 @@ void HK_ProcessIncomingHkData(const CFE_SB_Buffer_t *BufPtr)
int32 HK_ValidateHkCopyTable(void *TblPtr)
{
return HK_SUCCESS;

} /* end HK_ValidateHkCopyTable */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -256,8 +254,7 @@ int32 HK_ProcessNewCopyTable(hk_copy_table_entry_t *CpyTblPtr, hk_runtime_tbl_en
}

return CFE_SUCCESS;

} /* end HK_ProcessNewCopyTable */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -353,8 +350,7 @@ int32 HK_TearDownOldCopyTable(hk_copy_table_entry_t *CpyTblPtr, hk_runtime_tbl_e
}

return CFE_SUCCESS;

} /* end HK_TearDownOldCopyTable */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -379,7 +375,6 @@ void HK_SendCombinedHkPacket(CFE_SB_MsgId_t WhichMidToSend)
/* Empty table entries are defined by NULL's in this field */
if (RtTblEntry->OutputPktAddr != NULL)
{

OutBuffer = (CFE_SB_Buffer_t *)RtTblEntry->OutputPktAddr;
CFE_MSG_GetMsgId(&OutBuffer->Msg, &ThisEntrysOutMid);

Expand Down Expand Up @@ -418,8 +413,7 @@ void HK_SendCombinedHkPacket(CFE_SB_MsgId_t WhichMidToSend)
"Combined HK Packet 0x%08lX is not found in current HK Copy Table",
(unsigned long)CFE_SB_MsgIdToValue(WhichMidToSend));
}

} /* end HK_SendCombinedHkPacket */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -439,7 +433,7 @@ int32 HK_CheckStatusOfTables(void)
}

return HKStatus;
} /* end HK_CheckStatusOfTables */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -537,7 +531,7 @@ int32 HK_CheckStatusOfCopyTable(void)
}

return HKStatus;
} /* end HK_CheckStatusOfCopyTable */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -580,7 +574,7 @@ int32 HK_CheckStatusOfDumpTable(void)
}

return HKStatus;
} /* end HK_CheckStatusOfDumpTable */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -616,8 +610,7 @@ int32 HK_CheckForMissingData(CFE_SB_MsgId_t OutPktToCheck, CFE_SB_MsgId_t *Missi
} while ((Loop < HK_COPY_TABLE_ENTRIES) && (Status == HK_NO_MISSING_DATA));

return Status;

} /* end HK_CheckForMissingData */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -644,8 +637,7 @@ void HK_SetFlagsToNotPresent(CFE_SB_MsgId_t OutPkt)
RtTblEntry->DataPresent = HK_DATA_NOT_PRESENT;
}
}

} /* end HK_SetFlagsToNotPresent */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -663,7 +655,6 @@ int32 HK_VerifyCmdLength(const CFE_SB_Buffer_t *BufPtr, size_t ExpectedLength)

if (ExpectedLength != ActualLength)
{

CFE_MSG_GetMsgId(&BufPtr->Msg, &MessageID);
CFE_MSG_GetFcnCode(&BufPtr->Msg, &CommandCode);

Expand All @@ -676,8 +667,7 @@ int32 HK_VerifyCmdLength(const CFE_SB_Buffer_t *BufPtr, size_t ExpectedLength)
}

return Status;

} /* End of HK_VerifyCmdLength () */
}

/************************/
/* End of File Comment */
Expand Down
1 change: 0 additions & 1 deletion fsw/tables/hk_cpy_tbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,6 @@ hk_copy_table_entry_t HK_CopyTable[HK_COPY_TABLE_ENTRIES] = {
0,
0,
},

};

/*
Expand Down
2 changes: 0 additions & 2 deletions unit-test/hk_app_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ void Test_HK_AppMain_InitFail(void)
*/
void Test_HK_AppMain_SingleRunLoop(void)
{

/* Arrange */
CFE_SB_MsgId_t forced_MsgID = HK_UT_MID_100;
size_t forced_MsgSize = 0; /* invalid message size */
Expand Down Expand Up @@ -1425,7 +1424,6 @@ void Test_HK_ResetHkData(void)
*/
void UtTest_Setup(void)
{

/* Test functions for HK_AppMain */
UtTest_Add(Test_HK_AppMain_Success, HK_Test_Setup, HK_Test_TearDown, "Test_HK_AppMain_Success");
UtTest_Add(Test_HK_AppMain_InitFail, HK_Test_Setup, HK_Test_TearDown, "Test_HK_AppMain_InitFail");
Expand Down

0 comments on commit 61eea35

Please sign in to comment.