Skip to content

Commit 207e503

Browse files
committed
Component restructure to follow sdd
1 parent e961503 commit 207e503

File tree

4 files changed

+17
-34
lines changed

4 files changed

+17
-34
lines changed

FprimeZephyrReference/Components/Watchdog/Watchdog.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,23 @@ void Watchdog ::run_handler(FwIndexType portNum, U32 context) {
3030
this->tlmWrite_WatchdogTransitions(this->m_transitions);
3131

3232
this->gpioSet_out(0, (Fw::On::ON == this->m_state) ? Fw::Logic::HIGH : Fw::Logic::LOW);
33-
34-
this->log_ACTIVITY_LO_WatchdogState(this->m_state);
3533
}
3634
}
3735

3836
void Watchdog ::stop_handler(FwIndexType portNum) {
3937
// Set the stop flag to stop watchdog petting
4038
this->m_stopRequested = true;
39+
this->log_ACTIVITY_HI_WatchdogStop();
4140
}
4241

4342
// ----------------------------------------------------------------------
4443
// Handler implementations for commands
4544
// ----------------------------------------------------------------------
4645

47-
//test
48-
void Watchdog ::STOP_WATCHDOG_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) {
49-
// Set the stop flag to stop watchdog petting
50-
this->m_stopRequested = true;
46+
void Watchdog ::TEST_STOP_WATCHDOG_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) {
47+
// call stop handler
48+
this->stop_handler(0);
5149

52-
//rather, call stop handler here and emit event`
5350
// Provide command response
5451
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
5552
}

FprimeZephyrReference/Components/Watchdog/Watchdog.fpp

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,16 @@ module Components {
33
passive component Watchdog {
44

55
@ Command to stop the watchdog petter
6-
sync command STOP_WATCHDOG(
6+
sync command TEST_STOP_WATCHDOG(
77
)
88

9-
# get rid
10-
@ Telemetry channel to report watchdog petter state.
11-
telemetry WatchdogState: Fw.On
12-
13-
# keep but make it U32
149
@ Telemetry channel counting watchdog petter transitions
15-
telemetry WatchdogTransitions: U64
16-
17-
# get rid of all events except the stop watchdog event
18-
@ Reports the state we set for the watchdog petter.
19-
event SetWatchdogState($state: Fw.On) \
20-
severity activity high \
21-
format "Set watchdog state to {}."
10+
telemetry WatchdogTransitions: U32
2211

2312
@ Event logged when the watchdog petter LED turns on or off
24-
event WatchdogState(onOff: Fw.On) \
25-
severity activity low \
26-
format "Watchdog is {}"
13+
event WatchdogStop() \
14+
severity activity high \
15+
format "Watchdog no longer being pet!"
2716

2817
@ Port receiving calls from the rate group
2918
sync input port run: Svc.Sched

FprimeZephyrReference/Components/Watchdog/Watchdog.hpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
#define Components_Watchdog_HPP
99

1010
#include "FprimeZephyrReference/Components/Watchdog/WatchdogComponentAc.hpp"
11+
// Need to explicitly include because Fw.On is no longer a tlm channel I believe
12+
#include "Fw/Types/OnEnumAc.hpp"
13+
#include <atomic>
1114

1215
namespace Components {
1316

@@ -50,18 +53,13 @@ class Watchdog : public WatchdogComponentBase {
5053
// Handler implementations for commands
5154
// ----------------------------------------------------------------------
5255

53-
// test prefix
54-
void STOP_WATCHDOG_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) override;
56+
void TEST_STOP_WATCHDOG_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) override;
5557

5658

57-
58-
Fw::On m_state = Fw::On::OFF; //! Keeps track if LED is on or off
59-
//U32
60-
U64 m_transitions = 0; //! The number of on/off transitions that have occurred
61-
//! from FSW boot up
62-
63-
// this should be an atomic (std::atomic)
64-
bool m_stopRequested = false; //! Flag to stop the watchdog petting
59+
std::atomic_bool m_stopRequested{false}; //! Flag to stop the watchdog petting
60+
Fw::On m_state = Fw::On::OFF; //! Keeps track of GPIO state
61+
U32 m_transitions = 0; //! The number of on/off transitions that have occurred
62+
//! from FSW boot up
6563
};
6664

6765
} // namespace Components

FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ telemetry packets ReferenceDeploymentPackets {
3232

3333
packet Led id 5 group 4 {
3434
ReferenceDeployment.watchdog.WatchdogTransitions
35-
ReferenceDeployment.watchdog.WatchdogState
3635
}
3736

3837

0 commit comments

Comments
 (0)