Skip to content

Commit

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

Fix #58, Remove redundant/inconsistent comments (/* end of function */, /* end if */ etc.) and clean up empty lines.
  • Loading branch information
dzbaker authored Oct 14, 2022
2 parents 68e9c65 + 8a08639 commit b59d70a
Show file tree
Hide file tree
Showing 19 changed files with 387 additions and 833 deletions.
31 changes: 10 additions & 21 deletions fsw/src/sc_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ void SC_AppMain(void)

/* Let cFE kill the app */
CFE_ES_ExitApp(RunStatus);

} /* end SC_AppMain() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -225,8 +224,7 @@ int32 SC_AppInit(void)
SC_MAJOR_VERSION, SC_MINOR_VERSION, SC_REVISION, SC_MISSION_REV);

return (CFE_SUCCESS);

} /* end SC_AppInit() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -295,8 +293,7 @@ int32 SC_InitTables(void)
SC_RegisterManageCmds();

return (CFE_SUCCESS);

} /* end SC_InitTables() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -321,8 +318,7 @@ int32 SC_RegisterAllTables(void)
}

return (CFE_SUCCESS);

} /* end SC_RegisterAllTables() */
}

int32 SC_RegisterDumpOnlyTables(void)
{
Expand Down Expand Up @@ -370,8 +366,7 @@ int32 SC_RegisterDumpOnlyTables(void)
}

return (CFE_SUCCESS);

} /* end SC_RegisterDumpOnlyTables() */
}

int32 SC_RegisterLoadableTables(void)
{
Expand Down Expand Up @@ -418,8 +413,7 @@ int32 SC_RegisterLoadableTables(void)
}

return (CFE_SUCCESS);

} /* end SC_RegisterLoadableTables() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -464,8 +458,8 @@ int32 SC_GetDumpTablePointers(void)
}

return (CFE_SUCCESS);
}

} /* end SC_GetDumpTablePointers() */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* Get buffer pointers for loadable tables */
Expand Down Expand Up @@ -520,8 +514,7 @@ int32 SC_GetLoadTablePointers(void)
}

return (CFE_SUCCESS);

} /* end SC_GetLoadTablePointers() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -576,7 +569,7 @@ void SC_LoadDefaultTables(void)
/* Display startup RTS not loaded count */
CFE_EVS_SendEvent(SC_RTS_LOAD_FAIL_COUNT_INFO_EID, CFE_EVS_EventType_INFORMATION,
"RTS table files not loaded at initialization = %d of %d", (int)NotLoadedCount, SC_NUMBER_OF_RTS);
} /* end SC_LoadDefaultTables() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -616,8 +609,4 @@ void SC_RegisterManageCmds(void)
CFE_TBL_NotifyByMessage(SC_OperData.RtsTblHandle[i], CFE_SB_ValueToMsgId(SC_CMD_MID), SC_MANAGE_TABLE_CC,
SC_TBL_ID_RTS_0 + i);
}
} /* End SC_RegisterManageCmds() */

/************************/
/* End of File Comment */
/************************/
}
38 changes: 10 additions & 28 deletions fsw/src/sc_atsrq.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void SC_StartAtsCmd(const CFE_SB_Buffer_t *BufPtr)

} /* end if */
}
} /* end SC_StartAtsCmd */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -170,8 +170,7 @@ void SC_StopAtsCmd(const CFE_SB_Buffer_t *BufPtr)

SC_OperData.HkPacket.CmdCtr++;
}

} /* end SC_StopAtsCmd */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -238,7 +237,6 @@ bool SC_BeginAts(uint16 AtsIndex, uint16 TimeOffset)
*/
if (TimeIndex == SC_OperData.AtsInfoTblAddr[AtsIndex].NumberOfCommands)
{

CFE_EVS_SendEvent(SC_ATS_SKP_ALL_ERR_EID, CFE_EVS_EventType_ERROR,
"All ATS commands were skipped, ATS stopped");

Expand Down Expand Up @@ -271,8 +269,7 @@ bool SC_BeginAts(uint16 AtsIndex, uint16 TimeOffset)
} /* end if */

return (ReturnCode);

} /* end SC_BeginAts */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -281,7 +278,6 @@ bool SC_BeginAts(uint16 AtsIndex, uint16 TimeOffset)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void SC_KillAts(void)
{

if (SC_OperData.AtsCtrlBlckAddr->AtpState != SC_IDLE)
{
/* Increment the ats use counter */
Expand All @@ -294,8 +290,7 @@ void SC_KillAts(void)

/* reset the time of the next ats command */
SC_AppData.NextCmdTime[SC_ATP] = SC_MAX_TIME;

} /* end SC_KillAts */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -304,7 +299,6 @@ void SC_KillAts(void)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void SC_GroundSwitchCmd(const CFE_SB_Buffer_t *BufPtr)
{

uint16 NewAtsIndex; /* the index of the ats to switch to*/

if (SC_VerifyCmdLength(&BufPtr->Msg, sizeof(SC_NoArgsCmd_t)))
Expand All @@ -318,7 +312,6 @@ void SC_GroundSwitchCmd(const CFE_SB_Buffer_t *BufPtr)
/* Now check to see if the new ATS has commands in it */
if (SC_OperData.AtsInfoTblAddr[NewAtsIndex].NumberOfCommands > 0)
{

/* set the global switch pend flag */
SC_OperData.AtsCtrlBlckAddr->SwitchPendFlag = true;

Expand Down Expand Up @@ -353,7 +346,7 @@ void SC_GroundSwitchCmd(const CFE_SB_Buffer_t *BufPtr)

} /* end if */
}
} /* end SC_GroundSwitchCmd */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -371,19 +364,16 @@ void SC_ServiceSwitchPend(void)
*/
if (SC_CompareAbsTime(SC_AppData.NextCmdTime[SC_ATP], SC_AppData.CurrentTime))
{

/* make sure that an ATS is still running on the ATP */
if (SC_OperData.AtsCtrlBlckAddr->AtpState == SC_EXECUTING)
{

/* get the ATS number to switch to and from */
OldAtsIndex = SC_ATS_NUM_TO_INDEX(SC_OperData.AtsCtrlBlckAddr->AtsNumber);
NewAtsIndex = SC_ToggleAtsIndex();

/* Now check to see if the new ATS has commands in it */
if (SC_OperData.AtsInfoTblAddr[NewAtsIndex].NumberOfCommands > 0)
{

/* stop the current ATS */
SC_KillAts();

Expand All @@ -395,7 +385,6 @@ void SC_ServiceSwitchPend(void)
*/
if (SC_BeginAts(NewAtsIndex, 1))
{

SC_OperData.AtsCtrlBlckAddr->AtpState = SC_EXECUTING;

CFE_EVS_SendEvent(SC_ATS_SERVICE_SWTCH_INF_EID, CFE_EVS_EventType_INFORMATION,
Expand Down Expand Up @@ -424,8 +413,7 @@ void SC_ServiceSwitchPend(void)
SC_OperData.AtsCtrlBlckAddr->SwitchPendFlag = false;

} /* end if */

} /* end SC_ServiceSwitchPend */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -435,7 +423,6 @@ void SC_ServiceSwitchPend(void)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool SC_InlineSwitch(void)
{

uint16 NewAtsIndex; /* the index of the ats to switch to*/
uint16 OldAtsIndex; /* the index of the ats to switch from*/
bool ReturnCode; /* return code for function */
Expand Down Expand Up @@ -497,8 +484,7 @@ bool SC_InlineSwitch(void)
SC_OperData.AtsCtrlBlckAddr->SwitchPendFlag = false;

return (ReturnCode);

} /* end function */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -627,7 +613,7 @@ void SC_JumpAtsCmd(const CFE_SB_Buffer_t *BufPtr)

} /* end if */
}
} /* end SC_JumpAtsCmd */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -659,7 +645,7 @@ void SC_ContinueAtsOnFailureCmd(const CFE_SB_Buffer_t *BufPtr)
"Continue-ATS-On-Failure command, State: %d", State);
}
}
} /* end SC_ContinueAtsOnFailureCmd */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -729,8 +715,4 @@ void SC_AppendAtsCmd(const CFE_SB_Buffer_t *BufPtr)
SC_OperData.HkPacket.AppendEntryCount);
}
}
} /* end SC_AppendAtsCmd */

/************************/
/* End of File Comment */
/************************/
}
34 changes: 11 additions & 23 deletions fsw/src/sc_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ void SC_ProcessAtpCmd(void)
}

} /* end if next ATS command time */
} /* end SC_ProcessAtpCmd */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -290,7 +290,6 @@ void SC_ProcessAtpCmd(void)

void SC_ProcessRtpCommand(void)
{

SC_RtsEntry_t *EntryPtr; /* a pointer to an RTS entry header */
uint16 RtsIndex; /* the RTS index for the cmd */
uint16 CmdOffset; /* the location of the cmd */
Expand Down Expand Up @@ -395,7 +394,7 @@ void SC_ProcessRtpCommand(void)
SC_KillRts(RtsIndex);
} /* end if */
} /* end if */
} /* end SC_ProcessRtpCommand */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -444,15 +443,13 @@ void SC_SendHkPacket(void)
*/
for (i = 0; i < (SC_NUMBER_OF_RTS + (SC_NUMBER_OF_RTS_IN_UINT16 - 1)) / SC_NUMBER_OF_RTS_IN_UINT16; i++)
{

SC_OperData.HkPacket.RtsExecutingStatus[i] = 0;
SC_OperData.HkPacket.RtsDisabledStatus[i] = 0;

} /* end for */

for (i = 0; i < SC_NUMBER_OF_RTS; i++)
{

if (SC_OperData.RtsInfoTblAddr[i].DisabledFlag == true)
{
CFE_SET(SC_OperData.HkPacket.RtsDisabledStatus[i / SC_NUMBER_OF_RTS_IN_UINT16],
Expand All @@ -468,8 +465,7 @@ void SC_SendHkPacket(void)
/* send the status packet */
CFE_SB_TimeStampMsg(&SC_OperData.HkPacket.TlmHeader.Msg);
CFE_SB_TransmitMsg(&SC_OperData.HkPacket.TlmHeader.Msg, true);

} /* end SC_SendHkPacket */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -492,7 +488,7 @@ void SC_ResetCountersCmd(const CFE_SB_Buffer_t *BufPtr)
SC_OperData.HkPacket.RtsActiveCtr = 0;
SC_OperData.HkPacket.RtsActiveErrCtr = 0;
}
} /* end SC_ResetCountersCmd */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -507,7 +503,7 @@ void SC_NoOpCmd(const CFE_SB_Buffer_t *BufPtr)
CFE_EVS_SendEvent(SC_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION, "No-op command. Version %d.%d.%d.%d",
SC_MAJOR_VERSION, SC_MINOR_VERSION, SC_REVISION, SC_MISSION_REV);
}
} /* End SC_NoOpCmd */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -537,7 +533,6 @@ void SC_ProcessRequest(const CFE_SB_Buffer_t *BufPtr)
case SC_SEND_HK_MID:
if (SC_VerifyCmdLength(&BufPtr->Msg, sizeof(SC_NoArgsCmd_t)))
{

/* set during init to power on or processor reset auto-exec RTS */
if (SC_AppData.AutoStartRTS != 0)
{
Expand Down Expand Up @@ -615,7 +610,7 @@ void SC_ProcessRequest(const CFE_SB_Buffer_t *BufPtr)
SC_OperData.HkPacket.CmdErrCtr++;
break;
} /* end switch */
} /* end SC_ProcessRequest */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -710,7 +705,7 @@ void SC_ProcessCommand(const CFE_SB_Buffer_t *BufPtr)
SC_OperData.HkPacket.CmdErrCtr++;
break;
} /* end switch */
} /* end ProcessSequenceRequest */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -770,7 +765,7 @@ void SC_TableManageCmd(const CFE_SB_Buffer_t *BufPtr)
CFE_EVS_SendEvent(SC_TABLE_MANAGE_ID_ERR_EID, CFE_EVS_EventType_ERROR,
"Table manage command packet error: table ID = %d", (int)TableID);
}
} /* End SC_TableManageCmd() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -789,8 +784,7 @@ void SC_ManageRtsTable(int32 ArrayIndex)
}

SC_ManageTable(RTS, ArrayIndex);

} /* End SC_ManageRtsTable() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -809,8 +803,7 @@ void SC_ManageAtsTable(int32 ArrayIndex)
}

SC_ManageTable(ATS, ArrayIndex);

} /* End SC_ManageAtsTable() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -886,9 +879,4 @@ void SC_ManageTable(SC_TableType type, int32 ArrayIndex)
"ATS Append table manage process error: Result = 0x%X", (unsigned int)Result);
}
}

} /* End SC_ManageTable() */

/************************/
/* End of File Comment */
/************************/
}
Loading

0 comments on commit b59d70a

Please sign in to comment.