Skip to content

Commit 9612639

Browse files
committed
port and command call same functions
1 parent 04267f1 commit 9612639

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

FprimeZephyrReference/Components/Burnwire/Burnwire.cpp

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,31 @@ Burnwire ::~Burnwire() {}
2727
// Handler implementations for typed input ports
2828
// ----------------------------------------------------------------------
2929
void Burnwire ::burnStart_handler(FwIndexType portNum) {
30+
this->startBurn();
31+
}
32+
33+
void Burnwire ::burnStop_handler(FwIndexType portNum) {
34+
this->stopBurn();
35+
}
36+
37+
// void Burnwire ::stop_handler(FwIndexType portNum) {
38+
// //TODO
39+
// }
40+
41+
void Burnwire::startBurn() {
3042
this->m_safetyCounter = 0;
3143
this->m_state = Fw::On::ON;
3244
this->log_ACTIVITY_HI_SetBurnwireState(Fw::On::ON);
45+
this->log_ACTIVITY_HI_SafetyTimerSet(this->m_safetyMaxCount);
3346
}
3447

35-
void Burnwire ::burnStop_handler(FwIndexType portNum) {
48+
void Burnwire::stopBurn() {
3649
this->m_state = Fw::On::OFF;
3750
this->log_ACTIVITY_HI_SetBurnwireState(Fw::On::OFF);
3851
this->gpioSet_out(0, Fw::Logic::LOW);
3952
this->gpioSet_out(1, Fw::Logic::LOW);
4053
}
4154

42-
// void Burnwire ::stop_handler(FwIndexType portNum) {
43-
// //TODO
44-
// }
45-
4655
void Burnwire ::schedIn_handler(FwIndexType portNum, U32 context) {
4756
if (this->m_state == Fw::On::ON) {
4857
this->m_safetyCounter++;
@@ -69,20 +78,14 @@ void Burnwire ::schedIn_handler(FwIndexType portNum, U32 context) {
6978
// ----------------------------------------------------------------------
7079

7180
void Burnwire ::START_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U32 max_duration) {
72-
this->m_safetyCounter = 0;
7381
this->m_safetyMaxCount = max_duration;
74-
this->m_state = Fw::On::ON;
75-
this->log_ACTIVITY_HI_SetBurnwireState(Fw::On::ON);
76-
this->log_ACTIVITY_HI_SafetyTimerSet(max_duration);
82+
this->startBurn();
7783
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
7884
}
7985

8086
void Burnwire ::STOP_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) {
81-
this->m_state = Fw::On::OFF;
82-
this->log_ACTIVITY_HI_SetBurnwireState(Fw::On::OFF);
87+
this->stopBurn();
8388
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
84-
this->gpioSet_out(0, Fw::Logic::LOW);
85-
this->gpioSet_out(1, Fw::Logic::LOW);
8689
}
8790

8891
void Burnwire ::parameterUpdated(FwPrmIdType id) {

FprimeZephyrReference/Components/Burnwire/Burnwire.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ class Burnwire final : public BurnwireComponentBase {
5252

5353
void parameterUpdated(FwPrmIdType id) override;
5454

55+
// helper functions
56+
void startBurn();
57+
58+
void stopBurn();
59+
5560
private:
5661
// ----------------------------------------------------------------------
5762
// Handler implementations for commands

0 commit comments

Comments
 (0)