From b8b3a46357e3a80efc19ad26d58fa894f5c8f645 Mon Sep 17 00:00:00 2001 From: Avi Weiss Date: Tue, 30 Jan 2024 09:56:37 +1000 Subject: [PATCH] Fix #106, Simplify loop in `LC_SampleAPReq` by removing `continue` --- .github/pull_request_template.md | 2 +- config/default_lc_interface_cfg.h | 2 +- config/default_lc_internal_cfg.h | 2 +- config/default_lc_mission_cfg.h | 2 +- config/default_lc_msg.h | 2 +- config/default_lc_msgstruct.h | 2 +- config/default_lc_platform_cfg.h | 2 +- config/default_lc_tblstruct.h | 4 ++-- fsw/src/lc_cmds.c | 20 +++++++++----------- fsw/src/lc_watch.c | 4 ++-- unit-test/lc_utils_tests.c | 8 ++++---- 11 files changed, 24 insertions(+), 26 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 4834b96..453df4a 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -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. diff --git a/config/default_lc_interface_cfg.h b/config/default_lc_interface_cfg.h index e04bb21..823ec85 100644 --- a/config/default_lc_interface_cfg.h +++ b/config/default_lc_interface_cfg.h @@ -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. */ diff --git a/config/default_lc_internal_cfg.h b/config/default_lc_internal_cfg.h index 65009bc..b4562e9 100644 --- a/config/default_lc_internal_cfg.h +++ b/config/default_lc_internal_cfg.h @@ -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. */ diff --git a/config/default_lc_mission_cfg.h b/config/default_lc_mission_cfg.h index 79add33..26e9548 100644 --- a/config/default_lc_mission_cfg.h +++ b/config/default_lc_mission_cfg.h @@ -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. */ diff --git a/config/default_lc_msg.h b/config/default_lc_msg.h index 5d17b57..3e5819a 100644 --- a/config/default_lc_msg.h +++ b/config/default_lc_msg.h @@ -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. */ diff --git a/config/default_lc_msgstruct.h b/config/default_lc_msgstruct.h index 2f69451..3c611f8 100644 --- a/config/default_lc_msgstruct.h +++ b/config/default_lc_msgstruct.h @@ -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. * diff --git a/config/default_lc_platform_cfg.h b/config/default_lc_platform_cfg.h index 055e135..205c336 100644 --- a/config/default_lc_platform_cfg.h +++ b/config/default_lc_platform_cfg.h @@ -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. */ diff --git a/config/default_lc_tblstruct.h b/config/default_lc_tblstruct.h index 6b3d4b4..ffcd466 100644 --- a/config/default_lc_tblstruct.h +++ b/config/default_lc_tblstruct.h @@ -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. */ @@ -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 */ diff --git a/fsw/src/lc_cmds.c b/fsw/src/lc_cmds.c index b4a5f8f..604e976 100644 --- a/fsw/src/lc_cmds.c +++ b/fsw/src/lc_cmds.c @@ -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; + } } } } @@ -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; } @@ -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; } @@ -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) diff --git a/fsw/src/lc_watch.c b/fsw/src/lc_watch.c index cc1cb9f..fe2e349 100644 --- a/fsw/src/lc_watch.c +++ b/fsw/src/lc_watch.c @@ -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 @@ -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; diff --git a/unit-test/lc_utils_tests.c b/unit-test/lc_utils_tests.c index 2f1c105..0239874 100644 --- a/unit-test/lc_utils_tests.c +++ b/unit-test/lc_utils_tests.c @@ -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"); }