Skip to content

Commit

Permalink
Update per feedback (#87)
Browse files Browse the repository at this point in the history
* fixed testToDo typo

* fixed filename

* rewording

* making note consitent with other notes

* initializing variable and correctly calling assert
  • Loading branch information
kevin-f-ortega authored and thomas-bc committed Oct 21, 2024
1 parent 0411f43 commit 8e05491
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 16 deletions.
9 changes: 4 additions & 5 deletions Components/Led/Led.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<FwAssertArgType>(isValid));

// Emit the blink interval set event
this->log_ACTIVITY_HI_BlinkIntervalSet(interval);
Expand All @@ -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<FwAssertArgType>(isValid));

// Only perform actions when set to blinking
if (this->m_blinking && (interval != 0)) {
Expand Down
2 changes: 1 addition & 1 deletion docs/component-implementation-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 4 additions & 5 deletions docs/component-implementation-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<FwAssertArgType>(isValid));

// Only perform actions when set to blinking
if (this->m_blinking && (interval != 0)) {
Expand Down Expand Up @@ -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<FwAssertArgType>(isValid));
// Emit the blink interval set event
// TODO: Emit an event with, severity activity high, named BlinkIntervalSet that takes in an argument of
Expand Down
2 changes: 1 addition & 1 deletion docs/full-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <Fw/Logger/Logger.hpp>
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
5 changes: 2 additions & 3 deletions docs/unit-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 8e05491

Please sign in to comment.