@@ -13,7 +13,7 @@ namespace Components {
1313// ----------------------------------------------------------------------
1414
1515WatchdogEmulator ::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
1818WatchdogEmulator ::~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
3233void 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
4750void 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
0 commit comments