Skip to content

Commit

Permalink
Fix #34, Comments and empty lines cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
thnkslprpt committed Oct 13, 2022
1 parent bd6aca0 commit 7ea4e08
Show file tree
Hide file tree
Showing 16 changed files with 185 additions and 416 deletions.
64 changes: 22 additions & 42 deletions fsw/src/md_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ void MD_AppMain(void)
/* Copy any newly loaded tables */
for (TblIndex = 0; TblIndex < MD_NUM_DWELL_TABLES; TblIndex++)
{

MD_ManageDwellTable(TblIndex);

} /* end for each table loop */
Expand Down Expand Up @@ -107,7 +106,6 @@ void MD_AppMain(void)
/* Process Executive Request */
if ((Status == CFE_SUCCESS) && (BufPtr != NULL))
{

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

switch (CFE_SB_MsgIdToValue(MessageID))
Expand Down Expand Up @@ -166,8 +164,7 @@ void MD_AppMain(void)
** Exit the Application
*/
CFE_ES_ExitApp(MD_AppData.RunStatus);

} /* End of MD_AppMain */
}

/******************************************************************************/

Expand All @@ -190,7 +187,7 @@ int32 MD_AppInit(void)
if (Status != CFE_SUCCESS)
{
CFE_ES_WriteToSysLog("MD_APP:Call to CFE_EVS_Register Failed:RC=%d\n", Status);
} /* end if */
}

/*
** Set up for Software Bus Services
Expand All @@ -206,8 +203,7 @@ int32 MD_AppInit(void)
if (Status == CFE_SUCCESS)
{
Status = MD_InitTableServices();

} /* end if */
}

/*
** Issue Event Message
Expand All @@ -217,12 +213,10 @@ int32 MD_AppInit(void)
Status =
CFE_EVS_SendEvent(MD_INIT_INF_EID, CFE_EVS_EventType_INFORMATION, "MD Initialized. Version %d.%d.%d.%d",
MD_MAJOR_VERSION, MD_MINOR_VERSION, MD_REVISION, MD_MISSION_REV);

} /* end if */
}

return Status;

} /* End of MD_AppInit */
}

/******************************************************************************/
void MD_InitControlStructures(void)
Expand All @@ -246,6 +240,7 @@ void MD_InitControlStructures(void)

} /* end for TblIndex loop */
}

/******************************************************************************/
int32 MD_InitSoftwareBusServices(void)
{
Expand Down Expand Up @@ -278,59 +273,52 @@ int32 MD_InitSoftwareBusServices(void)
if (Status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(MD_CREATE_PIPE_ERR_EID, CFE_EVS_EventType_ERROR, "Failed to create pipe. RC = %d", Status);
} /* end if */
}

/*
** Subscribe to Housekeeping request commands
*/
if (Status == CFE_SUCCESS)
{

Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(MD_SEND_HK_MID), MD_AppData.CmdPipe);

if (Status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(MD_SUB_HK_ERR_EID, CFE_EVS_EventType_ERROR, "Failed to subscribe to HK requests RC = %d",
Status);
} /* end if */

} /* end if */
}
}

/*
** Subscribe to MD ground command packets
*/
if (Status == CFE_SUCCESS)
{

Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(MD_CMD_MID), MD_AppData.CmdPipe);

if (Status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(MD_SUB_CMD_ERR_EID, CFE_EVS_EventType_ERROR, "Failed to subscribe to commands. RC = %d",
Status);
} /* end if */

} /* end if */
}
}

/*
** Subscribe to MD wakeup packets
*/
if (Status == CFE_SUCCESS)
{

Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(MD_WAKEUP_MID), MD_AppData.CmdPipe);

if (Status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(MD_SUB_WAKEUP_ERR_EID, CFE_EVS_EventType_ERROR,
"Failed to subscribe to wakeup messages. RC = %d", Status);
} /* end if */

} /* end if */
}
}

return Status;

} /* End of MD_InitSoftwareBusServices */
}

/******************************************************************************/

Expand Down Expand Up @@ -446,14 +434,14 @@ int32 MD_InitTableServices(void)
"Dwell Table(s) are too large to register: %u bytes, %d entries",
(unsigned int)MD_TBL_LOAD_LNGTH, MD_DWELL_TABLE_SIZE);
TableInitValidFlag = false;
} /* end if */
}

else if (Status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(MD_TBL_REGISTER_CRIT_EID, CFE_EVS_EventType_CRITICAL,
"CFE_TBL_Register error %d received for tbl#%d", Status, TblIndex + 1);
TableInitValidFlag = false;
} /* end if */
}
else
{
/* Table is registered and valid */
Expand All @@ -476,7 +464,7 @@ int32 MD_InitTableServices(void)
CFE_ES_WriteToSysLog("MD_APP: Error 0x%08X received loading tbl#%d\n", (unsigned int)Status,
TblIndex + 1);
TableInitValidFlag = false;
} /* end if */
}
else
{
TblInits++;
Expand All @@ -503,8 +491,7 @@ int32 MD_InitTableServices(void)
{
return Status;
}

} /* End of MD_InitTableServices */
}

/******************************************************************************/
int32 MD_ManageDwellTable(uint8 TblIndex)
Expand Down Expand Up @@ -578,8 +565,7 @@ int32 MD_ManageDwellTable(uint8 TblIndex)
}

return Status;

} /* End of MD_ManageDwellTable */
}

/******************************************************************************/

Expand Down Expand Up @@ -623,7 +609,6 @@ void MD_ExecRequest(const CFE_SB_Buffer_t *BufPtr)
}
else
{

/* Process command */
switch (CommandCode)
{
Expand Down Expand Up @@ -665,8 +650,7 @@ void MD_ExecRequest(const CFE_SB_Buffer_t *BufPtr)
#endif
} /* End Switch */
}

} /* End of MD_ExecRequest */
}

/******************************************************************************/
void MD_HkStatus()
Expand Down Expand Up @@ -718,7 +702,7 @@ void MD_HkStatus()
*/
CFE_SB_TimeStampMsg(&HkPktPtr->TlmHeader.Msg);
CFE_SB_TransmitMsg(&HkPktPtr->TlmHeader.Msg, true);
} /* End of MD_HkStatus */
}

/******************************************************************************/

Expand All @@ -737,8 +721,4 @@ int16 MD_SearchCmdHndlrTbl(CFE_MSG_FcnCode_t CommandCode)
}

return TblIndx;
} /* End of MD_SearchCmdHndlrTbl() */

/************************/
/* End of File Comment */
/************************/
}
1 change: 0 additions & 1 deletion fsw/src/md_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ typedef struct
#if MD_SIGNATURE_OPTION == 1
char Signature[MD_SIGNATURE_FIELD_LENGTH]; /**< \brief Signature string used for dwell table to dwell pkt */
#endif

} MD_DwellPacketControl_t;

/**
Expand Down
10 changes: 3 additions & 7 deletions fsw/src/md_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void MD_ProcessStartCmd(const CFE_SB_Buffer_t *BufPtr)
"%s command rejected because no tables were specified in table mask (0x%04X)", "Start Dwell",
Start->TableMask);
}
} /* End of MD_ProcessStartCmd */
}

/******************************************************************************/

Expand Down Expand Up @@ -185,7 +185,7 @@ void MD_ProcessStopCmd(const CFE_SB_Buffer_t *BufPtr)
Stop->TableMask);
MD_AppData.ErrCounter++;
}
} /* End of MD_ProcessStopCmd */
}

/******************************************************************************/

Expand Down Expand Up @@ -400,7 +400,7 @@ void MD_ProcessJamCmd(const CFE_SB_Buffer_t *BufPtr)
{
MD_AppData.ErrCounter++;
}
} /* End of MD_ProcessJamCmd */
}

/******************************************************************************/
#if MD_SIGNATURE_OPTION == 1
Expand Down Expand Up @@ -473,7 +473,3 @@ void MD_ProcessSignatureCmd(const CFE_SB_Buffer_t *BufPtr)
}

#endif

/************************/
/* End of File Comment */
/************************/
20 changes: 4 additions & 16 deletions fsw/src/md_dwell_pkt.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,19 @@ void MD_DwellLoop(void)
/* Check each dwell table */
for (TblIndex = 0; TblIndex < MD_NUM_DWELL_TABLES; TblIndex++)
{

TblPtr = &MD_AppData.MD_DwellTables[TblIndex];
NumDwellAddresses = TblPtr->AddrCount;

/* Process enabled dwell tables */
if ((TblPtr->Enabled == MD_DWELL_STREAM_ENABLED) && (TblPtr->Rate > 0))
{

/*
** Handle special case that dwell pkt is already full because
** pkt size was shortened after data had been written to the pkt.
*/

if (TblPtr->CurrentEntry >= NumDwellAddresses)
{

MD_SendDwellPkt(TblIndex);

/* Initialize CurrentEntry index */
Expand Down Expand Up @@ -99,7 +96,6 @@ void MD_DwellLoop(void)

/* Case: Just filled last active entry of dwell table */
{

/*
** Send dwell packet
*/
Expand Down Expand Up @@ -141,8 +137,7 @@ void MD_DwellLoop(void)
} /* end if current dwell stream enabled */

} /* end for each dwell table */

} /* End of MD_DwellLoop */
}

/******************************************************************************/

Expand Down Expand Up @@ -199,8 +194,7 @@ int32 MD_GetDwellData(uint16 TblIndex, uint16 EntryIndex)
TblPtr->PktOffset += NumBytes;

return Status;

} /* End of MD_GetDwellData */
}

/******************************************************************************/

Expand Down Expand Up @@ -238,8 +232,7 @@ void MD_SendDwellPkt(uint16 TableIndex)
*/
CFE_SB_TimeStampMsg(&PktPtr->TlmHeader.Msg);
CFE_SB_TransmitMsg(&PktPtr->TlmHeader.Msg, true);

} /* End of MD_SendDwellPkt */
}

/******************************************************************************/

Expand All @@ -248,9 +241,4 @@ void MD_StartDwellStream(uint16 TableIndex)
MD_AppData.MD_DwellTables[TableIndex].Countdown = 1;
MD_AppData.MD_DwellTables[TableIndex].CurrentEntry = 0;
MD_AppData.MD_DwellTables[TableIndex].PktOffset = 0;

} /* End of MD_StartDwellStream */

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

0 comments on commit 7ea4e08

Please sign in to comment.