Skip to content

Commit 04267f1

Browse files
committed
appease linters
1 parent 24f2f7c commit 04267f1

File tree

3 files changed

+40
-11
lines changed

3 files changed

+40
-11
lines changed

FprimeZephyrReference/Components/Burnwire/Burnwire.cpp

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,31 @@ namespace Components {
1212
// Component construction and destruction
1313
// ----------------------------------------------------------------------
1414

15-
Burnwire ::Burnwire(const char* const compName) : BurnwireComponentBase(compName) {}
15+
Burnwire ::Burnwire(const char* const compName) : BurnwireComponentBase(compName) {
16+
this->m_safetyCounter = 0;
17+
this->m_state = Fw::On::OFF;
18+
Fw::ParamValid valid;
19+
this->m_safetyMaxCount = this->paramGet_SAFETY_TIMER(valid);
20+
this->log_ACTIVITY_HI_SafetyTimerSet(this->m_safetyMaxCount);
21+
this->log_ACTIVITY_HI_SafetyTimerSet(m_safetyMaxCount);
22+
}
1623

1724
Burnwire ::~Burnwire() {}
1825

1926
// ----------------------------------------------------------------------
2027
// Handler implementations for typed input ports
2128
// ----------------------------------------------------------------------
2229
void Burnwire ::burnStart_handler(FwIndexType portNum) {
23-
// TODO
30+
this->m_safetyCounter = 0;
31+
this->m_state = Fw::On::ON;
32+
this->log_ACTIVITY_HI_SetBurnwireState(Fw::On::ON);
2433
}
2534

2635
void Burnwire ::burnStop_handler(FwIndexType portNum) {
27-
// TODO
36+
this->m_state = Fw::On::OFF;
37+
this->log_ACTIVITY_HI_SetBurnwireState(Fw::On::OFF);
38+
this->gpioSet_out(0, Fw::Logic::LOW);
39+
this->gpioSet_out(1, Fw::Logic::LOW);
2840
}
2941

3042
// void Burnwire ::stop_handler(FwIndexType portNum) {
@@ -40,7 +52,7 @@ void Burnwire ::schedIn_handler(FwIndexType portNum, U32 context) {
4052
this->log_ACTIVITY_HI_SafetyTimerStatus(Fw::On::ON);
4153
}
4254

43-
if (this->m_safetyCounter >= m_safetyMaxCount) {
55+
if (this->m_safetyCounter >= this->m_safetyMaxCount) {
4456
// 30 seconds reached → turn OFF
4557
this->gpioSet_out(0, Fw::Logic::LOW);
4658
this->gpioSet_out(1, Fw::Logic::LOW);
@@ -56,14 +68,12 @@ void Burnwire ::schedIn_handler(FwIndexType portNum, U32 context) {
5668
// Handler implementations for commands
5769
// ----------------------------------------------------------------------
5870

59-
void Burnwire ::START_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) {
60-
// reset count to 0
71+
void Burnwire ::START_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U32 max_duration) {
6172
this->m_safetyCounter = 0;
62-
// update private member variable
73+
this->m_safetyMaxCount = max_duration;
6374
this->m_state = Fw::On::ON;
64-
// send event
6575
this->log_ACTIVITY_HI_SetBurnwireState(Fw::On::ON);
66-
// confirm response
76+
this->log_ACTIVITY_HI_SafetyTimerSet(max_duration);
6777
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
6878
}
6979

@@ -75,4 +85,13 @@ void Burnwire ::STOP_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) {
7585
this->gpioSet_out(1, Fw::Logic::LOW);
7686
}
7787

88+
void Burnwire ::parameterUpdated(FwPrmIdType id) {
89+
if (id == this->PARAMID_SAFETY_TIMER) {
90+
Fw::ParamValid valid;
91+
this->m_safetyMaxCount = this->paramGet_SAFETY_TIMER(valid);
92+
this->log_ACTIVITY_HI_SafetyTimerSet(this->m_safetyMaxCount);
93+
}
94+
this->log_ACTIVITY_HI_SafetyTimerSet(m_safetyMaxCount);
95+
}
96+
7897
} // namespace Components

FprimeZephyrReference/Components/Burnwire/Burnwire.fpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ module Components {
88

99
# @ Examplesync command
1010
sync command START_BURNWIRE(
11+
max_duration: U32
1112
)
1213

14+
15+
1316
sync command STOP_BURNWIRE(
1417
)
1518

@@ -26,6 +29,10 @@ module Components {
2629
severity activity high\
2730
format "Safety Timer State: {} "
2831

32+
event SafetyTimerSet(max_duration: U32) \
33+
severity activity high\
34+
format "Safety Timer Set to: {} seconds"
35+
2936
# @ Example port: receiving calls from the rate group
3037
# sync input port run: Svc.Sched
3138

@@ -43,6 +50,7 @@ module Components {
4350

4451
# @ Example parameter
4552
# param PARAMETER_NAME: U32
53+
param SAFETY_TIMER: U32 default 5
4654

4755
###############################################################################
4856
# Standard AC Ports: Required for Channels, Events, Commands, and Parameters #

FprimeZephyrReference/Components/Burnwire/Burnwire.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,23 @@ class Burnwire final : public BurnwireComponentBase {
5050
U32 context //!< The call order
5151
) override;
5252

53+
void parameterUpdated(FwPrmIdType id) override;
54+
5355
private:
5456
// ----------------------------------------------------------------------
5557
// Handler implementations for commands
5658
// ----------------------------------------------------------------------
5759

5860
//! Handler implementation for command START_BURNWIRE
59-
void START_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) override;
61+
void START_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U32 max_duration) override;
6062

6163
//! Handler implementation for command STOP_BURNWIRE
6264
void STOP_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) override;
6365

6466
Fw::On m_state = Fw::On::OFF; // keeps track if burnwire is on or off
6567
std::atomic<U32> m_safetyCounter; // makes this an atomic variable (so its set only in one command),
6668
// you read and write half the value bc a corrupted read could be dangerouts
67-
U32 m_safetyMaxCount = 5; // make this a aparamater
69+
U32 m_safetyMaxCount = 5; // max count for safety timer (default 10 seconds)
6870
};
6971

7072
} // namespace Components

0 commit comments

Comments
 (0)