From 8e054910d33d959e20495e2a7f5babff4c21ac1b Mon Sep 17 00:00:00 2001 From: kevin-f-ortega Date: Mon, 21 Oct 2024 09:29:28 -0700 Subject: [PATCH] Update per feedback (#87) * fixed testToDo typo * fixed filename * rewording * making note consitent with other notes * initializing variable and correctly calling assert --- Components/Led/Led.cpp | 9 ++++----- docs/component-implementation-1.md | 2 +- docs/component-implementation-2.md | 9 ++++----- docs/full-integration.md | 2 +- docs/requirements.md | 2 +- docs/unit-testing.md | 5 ++--- 6 files changed, 13 insertions(+), 16 deletions(-) diff --git a/Components/Led/Led.cpp b/Components/Led/Led.cpp index 8c20595..dabee8d 100644 --- a/Components/Led/Led.cpp +++ b/Components/Led/Led.cpp @@ -18,13 +18,13 @@ Led ::Led(const char* const compName) : LedComponentBase(compName) {} Led ::~Led() {} void Led ::parameterUpdated(FwPrmIdType id) { - Fw::ParamValid isValid; + Fw::ParamValid isValid = Fw::ParamValid::INVALID; switch (id) { case PARAMID_BLINK_INTERVAL: { // Read back the parameter value const U32 interval = this->paramGet_BLINK_INTERVAL(isValid); // NOTE: isValid is always VALID in parameterUpdated as it was just properly set - FW_ASSERT(isValid == Fw::ParamValid::VALID, isValid); + FW_ASSERT(isValid == Fw::ParamValid::VALID, static_cast(isValid)); // Emit the blink interval set event this->log_ACTIVITY_HI_BlinkIntervalSet(interval); @@ -44,9 +44,8 @@ void Led ::run_handler(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context) { // Read back the parameter value Fw::ParamValid isValid = Fw::ParamValid::INVALID; U32 interval = this->paramGet_BLINK_INTERVAL(isValid); - - // Force interval to be 0 when invalid or not set - interval = ((isValid == Fw::ParamValid::INVALID) || (isValid == Fw::ParamValid::UNINIT)) ? 0 : interval; + FW_ASSERT((isValid != Fw::ParamValid::INVALID) && (isValid != Fw::ParamValid::UNINIT), + static_cast(isValid)); // Only perform actions when set to blinking if (this->m_blinking && (interval != 0)) { diff --git a/docs/component-implementation-1.md b/docs/component-implementation-1.md index 0a31031..e74c30f 100644 --- a/docs/component-implementation-1.md +++ b/docs/component-implementation-1.md @@ -157,7 +157,7 @@ Verify your component is building correctly by running the following command in fprime-util build ``` -Fix any errors that occur before proceeding with the rest of the tutorial. +> Fix any errors that occur before proceeding with the rest of the tutorial. ### Component State diff --git a/docs/component-implementation-2.md b/docs/component-implementation-2.md index e5b50b9..494d100 100644 --- a/docs/component-implementation-2.md +++ b/docs/component-implementation-2.md @@ -106,9 +106,8 @@ void Led ::run_handler(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context) { // Read back the parameter value Fw::ParamValid isValid = Fw::ParamValid::INVALID; U32 interval = this->paramGet_BLINK_INTERVAL(isValid); - - // Force interval to be 0 when invalid or not set - interval = ((isValid == Fw::ParamValid::INVALID) || (isValid == Fw::ParamValid::UNINIT)) ? 0 : interval; + FW_ASSERT((isValid != Fw::ParamValid::INVALID) && (isValid != Fw::ParamValid::UNINIT), + static_cast(isValid)); // Only perform actions when set to blinking if (this->m_blinking && (interval != 0)) { @@ -195,13 +194,13 @@ Save file and in your `led-blinker/Components/Led` directory, open `Led.cpp` and ```cpp void Led ::parameterUpdated(FwPrmIdType id) { - Fw::ParamValid isValid; + Fw::ParamValid isValid = Fw::ParamValid::INVALID; switch (id) { case PARAMID_BLINK_INTERVAL: { // Read back the parameter value const U32 interval = this->paramGet_BLINK_INTERVAL(isValid); // NOTE: isValid is always VALID in parameterUpdated as it was just properly set - FW_ASSERT(isValid == Fw::ParamValid::VALID, isValid); + FW_ASSERT(isValid == Fw::ParamValid::VALID, static_cast(isValid)); // Emit the blink interval set event // TODO: Emit an event with, severity activity high, named BlinkIntervalSet that takes in an argument of diff --git a/docs/full-integration.md b/docs/full-integration.md index 1c920b7..acdf3a7 100644 --- a/docs/full-integration.md +++ b/docs/full-integration.md @@ -51,7 +51,7 @@ This is done by adding the following at the end of the `configureTopology` funct } ``` -And since this code uses `Fw::Logger`, you will need to add the following line near the top of the `Led.cpp` file. +And since this code uses `Fw::Logger`, you will need to add the following line near the top of the `led-blinker/LedBlinker/Top/LedBlinkerTopology.cpp` file. ```c++ #include diff --git a/docs/requirements.md b/docs/requirements.md index ba5ef59..cce2320 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -1,6 +1,6 @@ # Specifying Requirements -In this addendum to the tutorial, you will learn a bit about specifying requirements. Software requirements are derived from higher-level system requirements and represent the detail needed to implement the software. +In this section to the tutorial, you will learn a bit about specifying requirements. Software requirements are derived from higher-level system requirements and represent the detail needed to implement the software. ## System Requirements diff --git a/docs/unit-testing.md b/docs/unit-testing.md index 8789138..6d5387a 100644 --- a/docs/unit-testing.md +++ b/docs/unit-testing.md @@ -64,14 +64,13 @@ fprime-util check ## Add a New Test Case -Now that unit tests have been written, we can add our first unit test case. First, remove the default `ToDo` test and add a new test case called `testBlinking`. -In `led-blinker/Components/Led/test/ut/LedTester.hpp` rename the declaration for `testToDo` to be `testBlinking` instead: +Now that unit tests have been written, we can add our first unit test case. First, remove the default `toDo` test and add a new test case called `testBlinking`. In `led-blinker/Components/Led/test/ut/LedTester.hpp` rename the declaration for `toDo` to be `testBlinking` instead: ```c++ void testBlinking(); ``` -In `led-blinker/Components/Led/test/ut/LedTester.cpp` rename the definition for `testToDo` to be `testBlinking`: +In `led-blinker/Components/Led/test/ut/LedTester.cpp` rename the definition for `toDo` to be `testBlinking`: ```c++ void LedTester ::testBlinking() {