Skip to content

Commit

Permalink
Fix #106, Simplify loop in LC_SampleAPReq by removing continue
Browse files Browse the repository at this point in the history
  • Loading branch information
thnkslprpt committed Jul 9, 2024
1 parent 7cc9525 commit b8b3a46
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A clear and concise description of what the contribution is.
**Testing performed**
Steps taken to test the contribution:
1. Build steps '...'
1. Execution steps '...'
2. Execution steps '...'

**Expected behavior changes**
A clear and concise description of how this contribution will change behavior and level of impact.
Expand Down
2 changes: 1 addition & 1 deletion config/default_lc_interface_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* the interface(s) of this module. This includes the CMD/TLM message
* interface, tables definitions, and/or the public API, if applicable.
*
* @note This file may be overridden/superceded by mission-provided defintions
* @note This file may be overridden/superceded by mission-provided definitions
* either by overriding this header or by generating definitions from a command/data
* dictionary tool.
*/
Expand Down
2 changes: 1 addition & 1 deletion config/default_lc_internal_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* to items in this file only affect the local module and will be transparent
* to external entities that are using the public interface(s).
*
* @note This file may be overridden/superceded by mission-provided defintions
* @note This file may be overridden/superceded by mission-provided definitions
* either by overriding this header or by generating definitions from a command/data
* dictionary tool.
*/
Expand Down
2 changes: 1 addition & 1 deletion config/default_lc_mission_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* the interface(s) of this module. This includes the CMD/TLM message
* interface, tables definitions, and/or the public API, if applicable.
*
* @note This file may be overridden/superceded by mission-provided defintions
* @note This file may be overridden/superceded by mission-provided definitions
* either by overriding this header or by generating definitions from a command/data
* dictionary tool.
*/
Expand Down
2 changes: 1 addition & 1 deletion config/default_lc_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* This is a compatibility header for the "lc_msg.h" file that has
* traditionally provided the message definitions for cFS apps.
*
* @note This file may be overridden/superceded by mission-provided defintions
* @note This file may be overridden/superceded by mission-provided definitions
* either by overriding this header or by generating definitions from a command/data
* dictionary tool.
*/
Expand Down
2 changes: 1 addition & 1 deletion config/default_lc_msgstruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*
* Provides default definitions for message structures
*
* @note This file may be overridden/superceded by mission-provided defintions
* @note This file may be overridden/superceded by mission-provided definitions
* either by overriding this header or by generating definitions from a command/data
* dictionary tool.
*
Expand Down
2 changes: 1 addition & 1 deletion config/default_lc_platform_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* These definitions are now provided in two separate files, one for
* the public/mission scope and one for internal scope.
*
* @note This file may be overridden/superceded by mission-provided defintions
* @note This file may be overridden/superceded by mission-provided definitions
* either by overriding this header or by generating definitions from a command/data
* dictionary tool.
*/
Expand Down
4 changes: 2 additions & 2 deletions config/default_lc_tblstruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*
* Provides default definitions for LC table structures
*
* @note This file may be overridden/superceded by mission-provided defintions
* @note This file may be overridden/superceded by mission-provided definitions
* either by overriding this header or by generating definitions from a command/data
* dictionary tool.
*/
Expand Down Expand Up @@ -180,4 +180,4 @@ typedef struct
uint32 CumulativeEventMsgsSent; /**< \brief Total number of event messages sent */
} LC_ARTEntry_t;

#endif /* LC_TABLE_STRUCTS_H */
#endif /* LC_TABLE_STRUCT_H */
20 changes: 9 additions & 11 deletions fsw/src/lc_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,14 @@ void LC_SampleAPReq(const CFE_SB_Buffer_t *BufPtr)
{
for (WatchIndex = 0; WatchIndex < LC_MAX_WATCHPOINTS; WatchIndex++)
{
if (LC_OperData.WRTPtr[WatchIndex].CountdownToStale == 0)
if (LC_OperData.WRTPtr[WatchIndex].CountdownToStale > 0)
{
continue;
}

LC_OperData.WRTPtr[WatchIndex].CountdownToStale--;
LC_OperData.WRTPtr[WatchIndex].CountdownToStale--;

if (LC_OperData.WRTPtr[WatchIndex].CountdownToStale == 0)
{
LC_OperData.WRTPtr[WatchIndex].WatchResult = LC_WATCH_STALE;
if (LC_OperData.WRTPtr[WatchIndex].CountdownToStale == 0)
{
LC_OperData.WRTPtr[WatchIndex].WatchResult = LC_WATCH_STALE;
}
}
}
}
Expand Down Expand Up @@ -175,7 +173,7 @@ CFE_Status_t LC_SendHkCmd(const CFE_MSG_CommandHeader_t *MsgPtr)
ByteData |= TempByteData;
}

/* Update houskeeping watch results array */
/* Update housekeeping watch results array */
/* SAD: HKIndex is derived from TableIndex, ensuring it stays within the bounds of the WPResults array */
PayloadPtr->WPResults[HKIndex] = ByteData;
}
Expand Down Expand Up @@ -248,7 +246,7 @@ CFE_Status_t LC_SendHkCmd(const CFE_MSG_CommandHeader_t *MsgPtr)
}
}

/* Update houskeeping action results array */
/* Update housekeeping action results array */
/* SAD: HKIndex is derived from TableIndex, ensuring it stays within the bounds of the APResults array */
PayloadPtr->APResults[HKIndex] = ByteData;
}
Expand Down Expand Up @@ -630,7 +628,7 @@ void LC_ResetResultsWP(uint32 StartIndex, uint32 EndIndex, bool ResetStatsCmd)
{
uint32 TableIndex;

/* reset selected entries in watchoint results table */
/* reset selected entries in watchpoint results table */
for (TableIndex = StartIndex; TableIndex <= EndIndex; TableIndex++)
{
if (!ResetStatsCmd)
Expand Down
4 changes: 2 additions & 2 deletions fsw/src/lc_watch.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

/*
* An ISO-compliant math.h header should provide "isnan" and "isfinite" macros
* as they are dicatated by C99. However some C libraries still in use are not
* as they are dictated by C99. However some C libraries still in use are not
* fully compliant. If these macros are not defined, define a substitute here.
*
* Note these are not ideal/complete implementations of these macros, but they
Expand Down Expand Up @@ -370,7 +370,7 @@ void LC_ProcessWP(uint16 WatchIndex, const CFE_SB_Buffer_t *BufPtr, CFE_TIME_Sys
if (SizedDataValid == true)
{
/*
** Get the last evalution result for this watchpoint
** Get the last evaluation result for this watchpoint
*/
PreviousResult = LC_OperData.WRTPtr[WatchIndex].WatchResult;

Expand Down
8 changes: 4 additions & 4 deletions unit-test/lc_utils_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,11 @@ void UtTest_Setup(void)
UtTest_Add(LC_UpdateTaskCDS_Test_Nominal, LC_Test_Setup, LC_Test_TearDown, "LC_UpdateTaskCDS_Test_Nominal");

UtTest_Add(LC_PerformMaintenance_Test_NominalNoCDS, LC_Test_Setup, LC_Test_TearDown,
"LC_PerfomMaintenance_Test_NominalNoCDS");
"LC_PerformMaintenance_Test_NominalNoCDS");
UtTest_Add(LC_PerformMaintenance_Test_NominalCDS, LC_Test_Setup, LC_Test_TearDown,
"LC_PerfomMaintenance_Test_NominalCDS");
"LC_PerformMaintenance_Test_NominalCDS");
UtTest_Add(LC_PerformMaintenance_Test_UpdateCDSFail, LC_Test_Setup, LC_Test_TearDown,
"LC_PerfomMaintenance_Test_UpdateCDSFail");
"LC_PerformMaintenance_Test_UpdateCDSFail");
UtTest_Add(LC_PerformMaintenance_Test_ManageTablesFail, LC_Test_Setup, LC_Test_TearDown,
"LC_PerfomMaintenance_Test_ManageTablesFail");
"LC_PerformMaintenance_Test_ManageTablesFail");
}

0 comments on commit b8b3a46

Please sign in to comment.