TCS subsystem continued
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2022-03-22 15:49:22 +01:00
parent 73e3d29ed0
commit ce8253b940
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
12 changed files with 167 additions and 127 deletions

View File

@ -324,7 +324,8 @@ void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
#endif
}
void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF, PowerSwitchIF* pwrSwitcher) {
void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
PowerSwitchIF* pwrSwitcher) {
using namespace gpio;
GpioCookie* gpioCookieSus = new GpioCookie();
GpioCallback* susgpio = nullptr;
@ -379,96 +380,85 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComI
susHandlers[0]->setParent(objects::SUS_BOARD_ASS);
susHandlers[0]->setCustomFdir(fdir);
spiCookie =
new SpiCookie(addresses::SUS_1, gpioIds::CS_SUS_1, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
spiCookie = new SpiCookie(addresses::SUS_1, gpioIds::CS_SUS_1, q7s::SPI_DEFAULT_DEV,
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[1] = new SusHandler(objects::SUS_1, 1, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_1);
susHandlers[1]->setParent(objects::SUS_BOARD_ASS);
susHandlers[1]->setCustomFdir(fdir);
spiCookie =
new SpiCookie(addresses::SUS_2, gpioIds::CS_SUS_2, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
spiCookie = new SpiCookie(addresses::SUS_2, gpioIds::CS_SUS_2, q7s::SPI_DEFAULT_DEV,
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[2] = new SusHandler(objects::SUS_2, 2, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_2);
susHandlers[2]->setParent(objects::SUS_BOARD_ASS);
susHandlers[2]->setCustomFdir(fdir);
spiCookie =
new SpiCookie(addresses::SUS_3, gpioIds::CS_SUS_3, std::string(q7s::SPI_DEFAULT_DEV),
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
spiCookie = new SpiCookie(addresses::SUS_3, gpioIds::CS_SUS_3, std::string(q7s::SPI_DEFAULT_DEV),
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[3] = new SusHandler(objects::SUS_3, 3, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_3);
susHandlers[3]->setParent(objects::SUS_BOARD_ASS);
susHandlers[3]->setCustomFdir(fdir);
spiCookie =
new SpiCookie(addresses::SUS_4, gpioIds::CS_SUS_4, std::string(q7s::SPI_DEFAULT_DEV),
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
spiCookie = new SpiCookie(addresses::SUS_4, gpioIds::CS_SUS_4, std::string(q7s::SPI_DEFAULT_DEV),
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[4] = new SusHandler(objects::SUS_4, 4, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_4);
susHandlers[4]->setParent(objects::SUS_BOARD_ASS);
susHandlers[4]->setCustomFdir(fdir);
spiCookie =
new SpiCookie(addresses::SUS_5, gpioIds::CS_SUS_5, std::string(q7s::SPI_DEFAULT_DEV),
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
spiCookie = new SpiCookie(addresses::SUS_5, gpioIds::CS_SUS_5, std::string(q7s::SPI_DEFAULT_DEV),
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[5] = new SusHandler(objects::SUS_5, 5, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_5);
susHandlers[5]->setParent(objects::SUS_BOARD_ASS);
susHandlers[5]->setCustomFdir(fdir);
spiCookie =
new SpiCookie(addresses::SUS_6, gpioIds::CS_SUS_6, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
spiCookie = new SpiCookie(addresses::SUS_6, gpioIds::CS_SUS_6, q7s::SPI_DEFAULT_DEV,
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[6] = new SusHandler(objects::SUS_6, 6, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_6);
susHandlers[6]->setParent(objects::SUS_BOARD_ASS);
susHandlers[6]->setCustomFdir(fdir);
spiCookie =
new SpiCookie(addresses::SUS_7, gpioIds::CS_SUS_7, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[7] = new SusHandler(objects::SUS_7, 7, objects::SPI_COM_IF, spiCookie);
spiCookie = new SpiCookie(addresses::SUS_7, gpioIds::CS_SUS_7, q7s::SPI_DEFAULT_DEV,
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[7] = new SusHandler(objects::SUS_7, 7, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_7);
susHandlers[7]->setParent(objects::SUS_BOARD_ASS);
susHandlers[7]->setCustomFdir(fdir);
spiCookie =
new SpiCookie(addresses::SUS_8, gpioIds::CS_SUS_8, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
spiCookie = new SpiCookie(addresses::SUS_8, gpioIds::CS_SUS_8, q7s::SPI_DEFAULT_DEV,
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[8] = new SusHandler(objects::SUS_8, 8, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_8);
susHandlers[8]->setParent(objects::SUS_BOARD_ASS);
susHandlers[8]->setCustomFdir(fdir);
spiCookie =
new SpiCookie(addresses::SUS_9, gpioIds::CS_SUS_9, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[9] = new SusHandler(objects::SUS_9, 9, objects::SPI_COM_IF, spiCookie);
spiCookie = new SpiCookie(addresses::SUS_9, gpioIds::CS_SUS_9, q7s::SPI_DEFAULT_DEV,
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[9] = new SusHandler(objects::SUS_9, 9, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_9);
susHandlers[9]->setParent(objects::SUS_BOARD_ASS);
susHandlers[9]->setCustomFdir(fdir);
spiCookie =
new SpiCookie(addresses::SUS_10, gpioIds::CS_SUS_10, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[10] = new SusHandler(objects::SUS_10, 10, objects::SPI_COM_IF, spiCookie);
spiCookie = new SpiCookie(addresses::SUS_10, gpioIds::CS_SUS_10, q7s::SPI_DEFAULT_DEV,
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[10] = new SusHandler(objects::SUS_10, 10, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_10);
susHandlers[10]->setParent(objects::SUS_BOARD_ASS);
susHandlers[10]->setCustomFdir(fdir);
spiCookie =
new SpiCookie(addresses::SUS_11, gpioIds::CS_SUS_11, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
spiCookie = new SpiCookie(addresses::SUS_11, gpioIds::CS_SUS_11, q7s::SPI_DEFAULT_DEV,
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[11] = new SusHandler(objects::SUS_11, 11, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_11);
susHandlers[11]->setParent(objects::SUS_BOARD_ASS);
susHandlers[11]->setCustomFdir(fdir);
for(auto& sus: susHandlers) {
if(sus != nullptr) {
for (auto& sus : susHandlers) {
if (sus != nullptr) {
#if OBSW_TEST_SUS == 1
sus->setStartUpImmediately();
sus->setToGoToNormalMode(true);
@ -485,7 +475,7 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComI
SusAssHelper susAssHelper = SusAssHelper(susIds);
auto susAss =
new SusAssembly(objects::SUS_BOARD_ASS, objects::NO_OBJECT, pwrSwitcher, susAssHelper);
static_cast<void>(susAss);
static_cast<void>(susAss);
#endif /* OBSW_ADD_SUN_SENSORS == 1 */
}

View File

@ -18,7 +18,8 @@ void createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher
void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF);
void createTmpComponents();
void createRadSensorComponent(LinuxLibgpioIF* gpioComIF);
void createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF, PowerSwitchIF* pwrSwitcher);
void createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
PowerSwitchIF* pwrSwitcher);
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF,
PowerSwitchIF* pwrSwitcher);
void createHeaterComponents();

2
fsfw

@ -1 +1 @@
Subproject commit 16f2fa9327393ba8848817cc5a22497201c41d13
Subproject commit d791fc87b7bba11c1baa68d544cd991028ff3330

View File

@ -7,6 +7,7 @@ target_sources(${LIB_EIVE_MISSION} PRIVATE
ComSubsystem.cpp
TcsSubsystem.cpp
DualLanePowerStateMachine.cpp
PowerStateMachineBase.cpp
DualLaneAssemblyBase.cpp
AcsBoardFdir.cpp

View File

@ -63,8 +63,8 @@ bool DualLaneAssemblyBase::isUseable(object_id_t object, Mode_t mode) {
}
ReturnValue_t DualLaneAssemblyBase::pwrStateMachineWrapper() {
using namespace duallane;
OpCodes opCode = pwrStateMachine.powerStateMachine();
using namespace power;
OpCodes opCode = pwrStateMachine.fsm();
if (customRecoveryStates == RecoveryCustomStates::IDLE) {
if (opCode == OpCodes::NONE) {
return RETURN_OK;
@ -163,7 +163,7 @@ void DualLaneAssemblyBase::handleModeTransitionFailed(ReturnValue_t result) {
}
bool DualLaneAssemblyBase::checkAndHandleRecovery() {
using namespace duallane;
using namespace power;
OpCodes opCode = OpCodes::NONE;
if (recoveryState == RECOVERY_IDLE) {
return AssemblyBase::checkAndHandleRecovery();
@ -173,14 +173,14 @@ bool DualLaneAssemblyBase::checkAndHandleRecovery() {
customRecoveryStates = RecoveryCustomStates::POWER_SWITCHING_OFF;
}
if (customRecoveryStates == POWER_SWITCHING_OFF) {
opCode = pwrStateMachine.powerStateMachine();
opCode = pwrStateMachine.fsm();
if (opCode == OpCodes::TO_OFF_DONE or opCode == OpCodes::TIMEOUT_OCCURED) {
customRecoveryStates = RecoveryCustomStates::POWER_SWITCHING_ON;
pwrStateMachine.start(targetMode, targetSubmode);
}
}
if (customRecoveryStates == POWER_SWITCHING_ON) {
opCode = pwrStateMachine.powerStateMachine();
opCode = pwrStateMachine.fsm();
if (opCode == OpCodes::TO_NOT_OFF_DONE or opCode == OpCodes::TIMEOUT_OCCURED) {
customRecoveryStates = RecoveryCustomStates::DONE;
}

View File

@ -7,37 +7,16 @@ DualLanePowerStateMachine::DualLanePowerStateMachine(pcduSwitches::Switches swit
pcduSwitches::Switches switchB,
PowerSwitchIF* pwrSwitcher,
dur_millis_t checkTimeout)
: SWITCH_A(switchA), SWITCH_B(switchB), pwrSwitcher(pwrSwitcher), checkTimeout(checkTimeout) {}
: PowerStateMachineBase(pwrSwitcher, checkTimeout), SWITCH_A(switchA), SWITCH_B(switchB) {}
void DualLanePowerStateMachine::setCheckTimeout(dur_millis_t timeout) {
checkTimeout.setTimeout(timeout);
}
void DualLanePowerStateMachine::start(Mode_t mode, Submode_t submode) {
reset();
checkTimeout.resetTimer();
targetMode = mode;
targetSubmode = submode;
state = duallane::PwrStates::SWITCHING_POWER;
}
duallane::PwrStates DualLanePowerStateMachine::getState() const { return state; }
bool DualLanePowerStateMachine::active() {
if (state == duallane::PwrStates::IDLE or state == duallane::PwrStates::MODE_COMMANDING) {
return false;
}
return true;
}
duallane::OpCodes DualLanePowerStateMachine::powerStateMachine() {
power::OpCodes DualLanePowerStateMachine::fsm() {
using namespace duallane;
ReturnValue_t switchStateA = RETURN_OK;
ReturnValue_t switchStateB = RETURN_OK;
if (state == PwrStates::IDLE or state == PwrStates::MODE_COMMANDING) {
if (state == power::States::IDLE or state == power::States::MODE_COMMANDING) {
return opResult;
}
if (state == PwrStates::SWITCHING_POWER or state == PwrStates::CHECKING_POWER) {
if (state == power::States::SWITCHING_POWER or state == power::States::CHECKING_POWER) {
switchStateA = pwrSwitcher->getSwitchState(SWITCH_A);
switchStateB = pwrSwitcher->getSwitchState(SWITCH_B);
} else {
@ -45,8 +24,8 @@ duallane::OpCodes DualLanePowerStateMachine::powerStateMachine() {
}
if (targetMode == HasModesIF::MODE_OFF) {
if (switchStateA == PowerSwitchIF::SWITCH_OFF and switchStateB == PowerSwitchIF::SWITCH_OFF) {
state = PwrStates::IDLE;
opResult = OpCodes::TO_OFF_DONE;
state = power::States::IDLE;
opResult = power::OpCodes::TO_OFF_DONE;
return opResult;
}
} else {
@ -54,8 +33,8 @@ duallane::OpCodes DualLanePowerStateMachine::powerStateMachine() {
case (A_SIDE): {
if (switchStateA == PowerSwitchIF::SWITCH_ON and
switchStateB == PowerSwitchIF::SWITCH_OFF) {
state = PwrStates::MODE_COMMANDING;
opResult = OpCodes::TO_NOT_OFF_DONE;
state = power::States::MODE_COMMANDING;
opResult = power::OpCodes::TO_NOT_OFF_DONE;
return opResult;
}
break;
@ -63,22 +42,22 @@ duallane::OpCodes DualLanePowerStateMachine::powerStateMachine() {
case (B_SIDE): {
if (switchStateA == PowerSwitchIF::SWITCH_OFF and
switchStateB == PowerSwitchIF::SWITCH_ON) {
state = PwrStates::MODE_COMMANDING;
opResult = OpCodes::TO_NOT_OFF_DONE;
state = power::States::MODE_COMMANDING;
opResult = power::OpCodes::TO_NOT_OFF_DONE;
return opResult;
}
break;
}
case (DUAL_MODE): {
if (switchStateA == PowerSwitchIF::SWITCH_ON and switchStateB == PowerSwitchIF::SWITCH_ON) {
state = PwrStates::MODE_COMMANDING;
opResult = OpCodes::TO_NOT_OFF_DONE;
state = power::States::MODE_COMMANDING;
opResult = power::OpCodes::TO_NOT_OFF_DONE;
return opResult;
}
}
}
}
if (state == PwrStates::SWITCHING_POWER) {
if (state == power::States::SWITCHING_POWER) {
if (targetMode == HasModesIF::MODE_OFF) {
if (switchStateA != PowerSwitchIF::SWITCH_OFF) {
pwrSwitcher->sendSwitchCommand(SWITCH_A, PowerSwitchIF::SWITCH_OFF);
@ -121,20 +100,12 @@ duallane::OpCodes DualLanePowerStateMachine::powerStateMachine() {
}
}
}
state = PwrStates::CHECKING_POWER;
state = power::States::CHECKING_POWER;
}
if (state == PwrStates::CHECKING_POWER) {
if (state == power::States::CHECKING_POWER) {
if (checkTimeout.hasTimedOut()) {
return OpCodes::TIMEOUT_OCCURED;
return power::OpCodes::TIMEOUT_OCCURED;
}
}
return opResult;
}
void DualLanePowerStateMachine::reset() {
state = duallane::PwrStates::IDLE;
opResult = duallane::OpCodes::NONE;
targetMode = HasModesIF::MODE_OFF;
targetSubmode = 0;
checkTimeout.resetTimer();
}

View File

@ -3,32 +3,23 @@
#include <devices/powerSwitcherList.h>
#include <fsfw/modes/HasModesIF.h>
#include <mission/system/PowerStateMachineBase.h>
#include "definitions.h"
class AssemblyBase;
class PowerSwitchIF;
class DualLanePowerStateMachine : public HasReturnvaluesIF {
class DualLanePowerStateMachine : public PowerStateMachineBase {
public:
DualLanePowerStateMachine(pcduSwitches::Switches switchA, pcduSwitches::Switches switchB,
PowerSwitchIF* pwrSwitcher, dur_millis_t checkTimeout = 5000);
void setCheckTimeout(dur_millis_t timeout);
void reset();
void start(Mode_t mode, Submode_t submode);
bool active();
duallane::PwrStates getState() const;
duallane::OpCodes powerStateMachine();
power::OpCodes fsm() override;
const pcduSwitches::Switches SWITCH_A;
const pcduSwitches::Switches SWITCH_B;
private:
duallane::OpCodes opResult = duallane::OpCodes::NONE;
duallane::PwrStates state = duallane::PwrStates::IDLE;
PowerSwitchIF* pwrSwitcher = nullptr;
Mode_t targetMode = HasModesIF::MODE_OFF;
Submode_t targetSubmode = 0;
Countdown checkTimeout;
};
#endif /* MISSION_SYSTEM_DUALLANEPOWERSTATEMACHINE_H_ */

View File

@ -0,0 +1,33 @@
#include "PowerStateMachineBase.h"
PowerStateMachineBase::PowerStateMachineBase(PowerSwitchIF *pwrSwitcher, dur_millis_t checkTimeout)
: pwrSwitcher(pwrSwitcher), checkTimeout(checkTimeout) {}
void PowerStateMachineBase::reset() {
state = power::States::IDLE;
opResult = power::OpCodes::NONE;
targetMode = HasModesIF::MODE_OFF;
targetSubmode = 0;
checkTimeout.resetTimer();
}
void PowerStateMachineBase::setCheckTimeout(dur_millis_t timeout) {
checkTimeout.setTimeout(timeout);
}
void PowerStateMachineBase::start(Mode_t mode, Submode_t submode) {
reset();
checkTimeout.resetTimer();
targetMode = mode;
targetSubmode = submode;
state = power::States::SWITCHING_POWER;
}
power::States PowerStateMachineBase::getState() const { return state; }
bool PowerStateMachineBase::active() {
if (state == power::States::IDLE or state == power::States::MODE_COMMANDING) {
return false;
}
return true;
}

View File

@ -0,0 +1,31 @@
#ifndef MISSION_SYSTEM_POWERSTATEMACHINE_H_
#define MISSION_SYSTEM_POWERSTATEMACHINE_H_
#include <fsfw/modes/HasModesIF.h>
#include <fsfw/power/PowerSwitchIF.h>
#include <fsfw/timemanager/Countdown.h>
#include "definitions.h"
class PowerStateMachineBase : public HasReturnvaluesIF {
public:
PowerStateMachineBase(PowerSwitchIF* pwrSwitcher, dur_millis_t checkTimeout);
virtual power::OpCodes fsm() = 0;
void setCheckTimeout(dur_millis_t timeout);
void reset();
void start(Mode_t mode, Submode_t submode);
bool active();
power::States getState() const;
protected:
power::OpCodes opResult = power::OpCodes::NONE;
power::States state = power::States::IDLE;
PowerSwitchIF* pwrSwitcher = nullptr;
Mode_t targetMode = HasModesIF::MODE_OFF;
Submode_t targetSubmode = 0;
Countdown checkTimeout;
};
#endif /* MISSION_SYSTEM_POWERSTATEMACHINE_H_ */

View File

@ -1,23 +1,34 @@
#include "TcsSubsystem.h"
TcsSubsystem::TcsSubsystem(object_id_t objectId, object_id_t parentId, TcsBoardHelper helper)
: SubsystemBase(objectId, parentId, MODE_OFF, 24), helper(helper) {
}
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
ReturnValue_t TcsSubsystem::handleCommandMessage(CommandMessage *message) {
return RETURN_OK;
}
TcsSubsystem::TcsSubsystem(object_id_t objectId, object_id_t parentId, PowerSwitchIF* pwrSwitcher,
power::Switch_t theSwitch, TcsBoardHelper helper)
: SubsystemBase(objectId, parentId, MODE_OFF, 24),
switcher(pwrSwitcher, theSwitch),
helper(helper) {}
void TcsSubsystem::performChildOperation() {
}
ReturnValue_t TcsSubsystem::handleCommandMessage(CommandMessage* message) { return RETURN_OK; }
void TcsSubsystem::performChildOperation() {}
ReturnValue_t TcsSubsystem::checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t *msToReachTheMode) {
return RETURN_OK;
uint32_t* msToReachTheMode) {
if (mode == MODE_ON or mode == MODE_OFF or mode == DeviceHandlerIF::MODE_NORMAL) {
return RETURN_OK;
}
return HasModesIF::INVALID_MODE;
}
ReturnValue_t TcsSubsystem::initialize() {
ReturnValue_t result = RETURN_OK;
for (const auto& obj : helper.rtdIds) {
result = registerChild(obj);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
}
return SubsystemBase::initialize();
}
void TcsSubsystem::startTransition(Mode_t mode, Submode_t submode) {
}
void TcsSubsystem::startTransition(Mode_t mode, Submode_t submode) {}

View File

@ -1,31 +1,37 @@
#ifndef MISSION_SYSTEM_TCSSUBSYSTEM_H_
#define MISSION_SYSTEM_TCSSUBSYSTEM_H_
#include <fsfw/container/FixedArrayList.h>
#include <fsfw/power/PowerSwitcher.h>
#include <fsfw/subsystem/SubsystemBase.h>
struct TcsBoardHelper {
TcsBoardHelper(std::array<object_id_t, 16> rtdIds): rtdIds(rtdIds) {}
TcsBoardHelper(std::array<object_id_t, 16> rtdIds) : rtdIds(rtdIds) {}
std::array<object_id_t, 16> rtdIds = {};
};
class TcsSubsystem: public SubsystemBase {
public:
TcsSubsystem(object_id_t objectId, object_id_t parentId, TcsBoardHelper helper);
class TcsSubsystem : public SubsystemBase {
public:
TcsSubsystem(object_id_t objectId, object_id_t parentId, PowerSwitchIF *pwrSwitcher,
power::Switch_t switcher, TcsBoardHelper helper);
ReturnValue_t initialize() override;
private:
private:
static constexpr uint8_t NUMBER_RTDS = 16;
PowerSwitcher switcher;
TcsBoardHelper helper;
FixedArrayList<ModeListEntry, NUMBER_RTDS> modeTable;
ReturnValue_t handleCommandMessage(CommandMessage *message) override;
void performChildOperation() override;
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t *msToReachTheMode) override;
uint32_t *msToReachTheMode) override;
void startTransition(Mode_t mode, Submode_t submode) override;
TcsBoardHelper helper;
};
#endif /* MISSION_SYSTEM_TCSSUBSYSTEM_H_ */

View File

@ -3,10 +3,15 @@
#include <fsfw/modes/ModeMessage.h>
namespace power {
enum class States { IDLE, SWITCHING_POWER, CHECKING_POWER, MODE_COMMANDING };
enum class OpCodes { NONE, TO_OFF_DONE, TO_NOT_OFF_DONE, TIMEOUT_OCCURED };
} // namespace power
namespace duallane {
enum class PwrStates { IDLE, SWITCHING_POWER, CHECKING_POWER, MODE_COMMANDING };
enum class OpCodes { NONE, TO_OFF_DONE, TO_NOT_OFF_DONE, TIMEOUT_OCCURED };
enum Submodes : Submode_t { A_SIDE = 0, B_SIDE = 1, DUAL_MODE = 2 };
} // namespace duallane