Skip to content

Commit 66cf490

Browse files
committed
add more param sets
1 parent c3b35c0 commit 66cf490

3 files changed

Lines changed: 43 additions & 6 deletions

File tree

fsw/lioness-sw/LionessSw/Components/WatchdogEmulator/WatchdogEmulator.cpp

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Components {
1313
// ----------------------------------------------------------------------
1414

1515
WatchdogEmulator ::WatchdogEmulator(const char* const compName)
16-
: WatchdogEmulatorComponentBase(compName), m_countdownTicks(TIMEOUT_TICKS), m_resetAsserted(false) {}
16+
: WatchdogEmulatorComponentBase(compName), m_countdownTicks(0), m_resetAsserted(false) {}
1717

1818
WatchdogEmulator ::~WatchdogEmulator() {}
1919

@@ -25,8 +25,9 @@ void WatchdogEmulator ::kickIn_handler(FwIndexType portNum, U32 code) {
2525
static_cast<void>(portNum);
2626
static_cast<void>(code);
2727

28-
this->m_countdownTicks = TIMEOUT_TICKS;
28+
this->m_countdownTicks = this->getTimeoutTicks();
2929
this->m_resetAsserted = false;
30+
this->tlmWrite_CountdownTicks(this->m_countdownTicks);
3031
}
3132

3233
void WatchdogEmulator ::schedIn_handler(FwIndexType portNum, U32 context) {
@@ -42,12 +43,31 @@ void WatchdogEmulator ::schedIn_handler(FwIndexType portNum, U32 context) {
4243
this->log_ACTIVITY_HI_ResetAsserted();
4344
this->m_resetAsserted = true;
4445
}
46+
47+
this->tlmWrite_CountdownTicks(this->m_countdownTicks);
4548
}
4649

4750
void WatchdogEmulator ::SET_COUNTDOWN_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U32 ticks) {
4851
this->m_countdownTicks = ticks;
4952
this->m_resetAsserted = false;
53+
this->tlmWrite_CountdownTicks(this->m_countdownTicks);
5054
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
5155
}
5256

57+
// ----------------------------------------------------------------------
58+
// Private helpers
59+
// ----------------------------------------------------------------------
60+
61+
// Returns the configured TIMEOUT_TICKS, falling back to the FPP-declared
62+
// default if PrmDb has not yet served a valid value (e.g. before the
63+
// first loadParameters() completes).
64+
U32 WatchdogEmulator ::getTimeoutTicks() {
65+
Fw::ParamValid valid;
66+
const U32 timeout = this->paramGet_TIMEOUT_TICKS(valid);
67+
if (valid == Fw::ParamValid::VALID || valid == Fw::ParamValid::DEFAULT) {
68+
return timeout;
69+
}
70+
return 50U;
71+
}
72+
5373
} // namespace Components

fsw/lioness-sw/LionessSw/Components/WatchdogEmulator/WatchdogEmulator.fpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,25 @@ module Components {
22
@ Watchdog emulator for host-based watchdog testing
33
passive component WatchdogEmulator {
44
@ Kick input from the watchdog component under test.
5-
sync input port kickIn: Svc.WatchDog
5+
guarded input port kickIn: Svc.WatchDog
66

77
@ Scheduler tick used to count down timeout ticks.
8-
sync input port schedIn: Svc.Sched
8+
guarded input port schedIn: Svc.Sched
99

1010
@ Reset signal asserted when countdown expires.
1111
output port resetOut: Fw.Signal
1212

1313
@ Manually set the watchdog countdown in scheduler ticks.
14-
sync command SET_COUNTDOWN(
14+
guarded command SET_COUNTDOWN(
1515
ticks: U32 @< Countdown value in ticks.
1616
)
1717

18+
@ Default countdown reload value in scheduler ticks.
19+
param TIMEOUT_TICKS: U32 default 50
20+
21+
@ Current countdown value in scheduler ticks.
22+
telemetry CountdownTicks: U32
23+
1824
@ Countdown reached zero and reset was asserted.
1925
event ResetAsserted \
2026
severity activity high \
@@ -32,5 +38,14 @@ module Components {
3238
@ Enables event handling
3339
import Fw.Event
3440

41+
@ Enables telemetry channels handling
42+
import Fw.Channel
43+
44+
@ Port to return the value of a parameter
45+
param get port prmGetOut
46+
47+
@ Port to set the value of a parameter
48+
param set port prmSetOut
49+
3550
}
3651
}

fsw/lioness-sw/LionessSw/Components/WatchdogEmulator/WatchdogEmulator.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ class WatchdogEmulator final : public WatchdogEmulatorComponentBase {
5151
U32 ticks //!< Countdown value in ticks
5252
) override;
5353

54-
static constexpr U32 TIMEOUT_TICKS = 50;
54+
//! Read the current TIMEOUT_TICKS parameter, falling back to the FPP default.
55+
U32 getTimeoutTicks();
56+
5557
U32 m_countdownTicks;
5658
bool m_resetAsserted;
5759
};

0 commit comments

Comments
 (0)