power updates
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2023-03-14 13:56:19 +01:00
parent c9e16642c5
commit 6688499128
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
7 changed files with 39 additions and 33 deletions

View File

@ -32,6 +32,8 @@ will consitute of a breaking change warranting a new major release:
`returnvalue::FAILED` in switch state getter. `returnvalue::FAILED` in switch state getter.
- Wait 1 second before commanding SAFE mode. This ensures or at least increases the chance that - Wait 1 second before commanding SAFE mode. This ensures or at least increases the chance that
the switch states were initialized. the switch states were initialized.
- Dual Lane Assemblies: The returnvalues of the dual lane power state machine FSM are not ignored
anymore.
# [v1.37.0] 2023-03-11 # [v1.37.0] 2023-03-11

View File

@ -203,7 +203,7 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI
auto acuFdir = new GomspacePowerFdir(objects::ACU_HANDLER); auto acuFdir = new GomspacePowerFdir(objects::ACU_HANDLER);
ACUHandler* acuhandler = ACUHandler* acuhandler =
new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie, acuFdir); new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie, acuFdir);
auto pcduHandler = new PCDUHandler(objects::PCDU_HANDLER, 50); auto pcduHandler = new PcduHandler(objects::PCDU_HANDLER, 50);
/** /**
* Setting PCDU devices to mode normal immediately after start up because PCDU is always * Setting PCDU devices to mode normal immediately after start up because PCDU is always

2
fsfw

@ -1 +1 @@
Subproject commit 9a8d775eb1a8788ad844215bf2a42d9f707767c0 Subproject commit 0b0a0299bc044e67413d8912ceb76a779d76ee4e

View File

@ -5,8 +5,8 @@ target_sources(
Tmp1075Handler.cpp Tmp1075Handler.cpp
PcduHandler.cpp PcduHandler.cpp
P60DockHandler.cpp P60DockHandler.cpp
PDU1Handler.cpp Pdu1Handler.cpp
PDU2Handler.cpp Pdu2Handler.cpp
ACUHandler.cpp ACUHandler.cpp
SyrlinksHandler.cpp SyrlinksHandler.cpp
Max31865PT1000Handler.cpp Max31865PT1000Handler.cpp

View File

@ -7,7 +7,7 @@
#include <mission/devices/PcduHandler.h> #include <mission/devices/PcduHandler.h>
#include <mission/devices/devicedefinitions/GomSpacePackets.h> #include <mission/devices/devicedefinitions/GomSpacePackets.h>
PCDUHandler::PCDUHandler(object_id_t setObjectId, size_t cmdQueueSize) PcduHandler::PcduHandler(object_id_t setObjectId, size_t cmdQueueSize)
: SystemObject(setObjectId), : SystemObject(setObjectId),
poolManager(this, nullptr), poolManager(this, nullptr),
p60CoreHk(objects::P60DOCK_HANDLER), p60CoreHk(objects::P60DOCK_HANDLER),
@ -22,9 +22,9 @@ PCDUHandler::PCDUHandler(object_id_t setObjectId, size_t cmdQueueSize)
std::memset(switchStates, SWITCH_STATE_UNKNOWN, sizeof(switchStates)); std::memset(switchStates, SWITCH_STATE_UNKNOWN, sizeof(switchStates));
} }
PCDUHandler::~PCDUHandler() {} PcduHandler::~PcduHandler() {}
ReturnValue_t PCDUHandler::performOperation(uint8_t counter) { ReturnValue_t PcduHandler::performOperation(uint8_t counter) {
if (counter == DeviceHandlerIF::PERFORM_OPERATION) { if (counter == DeviceHandlerIF::PERFORM_OPERATION) {
readCommandQueue(); readCommandQueue();
} }
@ -52,7 +52,7 @@ ReturnValue_t PCDUHandler::performOperation(uint8_t counter) {
return returnvalue::OK; return returnvalue::OK;
} }
ReturnValue_t PCDUHandler::initialize() { ReturnValue_t PcduHandler::initialize() {
ReturnValue_t result; ReturnValue_t result;
IPCStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE); IPCStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
@ -100,7 +100,7 @@ ReturnValue_t PCDUHandler::initialize() {
return returnvalue::OK; return returnvalue::OK;
} }
void PCDUHandler::initializeSwitchStates() { void PcduHandler::initializeSwitchStates() {
using namespace pcdu; using namespace pcdu;
try { try {
for (uint8_t idx = 0; idx < NUMBER_OF_SWITCHES; idx++) { for (uint8_t idx = 0; idx < NUMBER_OF_SWITCHES; idx++) {
@ -117,7 +117,7 @@ void PCDUHandler::initializeSwitchStates() {
} }
} }
void PCDUHandler::readCommandQueue() { void PcduHandler::readCommandQueue() {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
CommandMessage command; CommandMessage command;
@ -130,9 +130,9 @@ void PCDUHandler::readCommandQueue() {
} }
} }
MessageQueueId_t PCDUHandler::getCommandQueue() const { return commandQueue->getId(); } MessageQueueId_t PcduHandler::getCommandQueue() const { return commandQueue->getId(); }
void PCDUHandler::handleChangedDataset(sid_t sid, store_address_t storeId, bool* clearMessage) { void PcduHandler::handleChangedDataset(sid_t sid, store_address_t storeId, bool* clearMessage) {
if (sid == sid_t(objects::PDU2_HANDLER, static_cast<uint32_t>(P60System::SetIds::CORE))) { if (sid == sid_t(objects::PDU2_HANDLER, static_cast<uint32_t>(P60System::SetIds::CORE))) {
updateHkTableDataset(storeId, &pdu2CoreHk, &timeStampPdu2HkDataset); updateHkTableDataset(storeId, &pdu2CoreHk, &timeStampPdu2HkDataset);
updatePdu2SwitchStates(); updatePdu2SwitchStates();
@ -144,7 +144,7 @@ void PCDUHandler::handleChangedDataset(sid_t sid, store_address_t storeId, bool*
} }
} }
void PCDUHandler::updateHkTableDataset(store_address_t storeId, LocalPoolDataSetBase* dataset, void PcduHandler::updateHkTableDataset(store_address_t storeId, LocalPoolDataSetBase* dataset,
CCSDSTime::CDS_short* datasetTimeStamp) { CCSDSTime::CDS_short* datasetTimeStamp) {
ReturnValue_t result; ReturnValue_t result;
@ -170,7 +170,7 @@ void PCDUHandler::updateHkTableDataset(store_address_t storeId, LocalPoolDataSet
} }
} }
void PCDUHandler::updatePdu2SwitchStates() { void PcduHandler::updatePdu2SwitchStates() {
using namespace pcdu; using namespace pcdu;
using namespace PDU2; using namespace PDU2;
GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU2; GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU2;
@ -207,7 +207,7 @@ void PCDUHandler::updatePdu2SwitchStates() {
} }
} }
void PCDUHandler::updatePdu1SwitchStates() { void PcduHandler::updatePdu1SwitchStates() {
using namespace pcdu; using namespace pcdu;
using namespace PDU1; using namespace PDU1;
PoolReadGuard rg0(&switcherSet); PoolReadGuard rg0(&switcherSet);
@ -244,9 +244,9 @@ void PCDUHandler::updatePdu1SwitchStates() {
} }
} }
LocalDataPoolManager* PCDUHandler::getHkManagerHandle() { return &poolManager; } LocalDataPoolManager* PcduHandler::getHkManagerHandle() { return &poolManager; }
ReturnValue_t PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) { ReturnValue_t PcduHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) {
using namespace pcdu; using namespace pcdu;
ReturnValue_t result; ReturnValue_t result;
uint16_t memoryAddress = 0; uint16_t memoryAddress = 0;
@ -396,9 +396,9 @@ ReturnValue_t PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onO
return result; return result;
} }
ReturnValue_t PCDUHandler::sendFuseOnCommand(uint8_t fuseNr) { return returnvalue::OK; } ReturnValue_t PcduHandler::sendFuseOnCommand(uint8_t fuseNr) { return returnvalue::OK; }
ReturnValue_t PCDUHandler::getSwitchState(uint8_t switchNr) const { ReturnValue_t PcduHandler::getSwitchState(uint8_t switchNr) const {
if (switchNr >= pcdu::NUMBER_OF_SWITCHES) { if (switchNr >= pcdu::NUMBER_OF_SWITCHES) {
sif::debug << "PCDUHandler::getSwitchState: Invalid switch number" << std::endl; sif::debug << "PCDUHandler::getSwitchState: Invalid switch number" << std::endl;
return returnvalue::FAILED; return returnvalue::FAILED;
@ -409,7 +409,7 @@ ReturnValue_t PCDUHandler::getSwitchState(uint8_t switchNr) const {
currentState = switchStates[switchNr]; currentState = switchStates[switchNr];
} }
if (currentState == SWITCH_STATE_UNKNOWN) { if (currentState == SWITCH_STATE_UNKNOWN) {
return returnvalue::FAILED; return PowerSwitchIF::SWITCH_UNKNOWN;
} }
if (currentState == 1) { if (currentState == 1) {
return PowerSwitchIF::SWITCH_ON; return PowerSwitchIF::SWITCH_ON;
@ -418,13 +418,13 @@ ReturnValue_t PCDUHandler::getSwitchState(uint8_t switchNr) const {
} }
} }
ReturnValue_t PCDUHandler::getFuseState(uint8_t fuseNr) const { return returnvalue::OK; } ReturnValue_t PcduHandler::getFuseState(uint8_t fuseNr) const { return returnvalue::OK; }
uint32_t PCDUHandler::getSwitchDelayMs(void) const { return 20000; } uint32_t PcduHandler::getSwitchDelayMs(void) const { return 20000; }
object_id_t PCDUHandler::getObjectId() const { return SystemObject::getObjectId(); } object_id_t PcduHandler::getObjectId() const { return SystemObject::getObjectId(); }
ReturnValue_t PCDUHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, ReturnValue_t PcduHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) { LocalDataPoolManager& poolManager) {
using namespace pcdu; using namespace pcdu;
localDataPoolMap.emplace(PoolIds::PDU1_SWITCHES, &pdu1Switches); localDataPoolMap.emplace(PoolIds::PDU1_SWITCHES, &pdu1Switches);
@ -435,7 +435,7 @@ ReturnValue_t PCDUHandler::initializeLocalDataPool(localpool::DataPool& localDat
return returnvalue::OK; return returnvalue::OK;
} }
ReturnValue_t PCDUHandler::initializeAfterTaskCreation() { ReturnValue_t PcduHandler::initializeAfterTaskCreation() {
if (executingTask != nullptr) { if (executingTask != nullptr) {
pstIntervalMs = executingTask->getPeriodMs(); pstIntervalMs = executingTask->getPeriodMs();
} }
@ -446,11 +446,11 @@ ReturnValue_t PCDUHandler::initializeAfterTaskCreation() {
return returnvalue::OK; return returnvalue::OK;
} }
uint32_t PCDUHandler::getPeriodicOperationFrequency() const { return pstIntervalMs; } uint32_t PcduHandler::getPeriodicOperationFrequency() const { return pstIntervalMs; }
void PCDUHandler::setTaskIF(PeriodicTaskIF* task) { executingTask = task; } void PcduHandler::setTaskIF(PeriodicTaskIF* task) { executingTask = task; }
LocalPoolDataSetBase* PCDUHandler::getDataSetHandle(sid_t sid) { LocalPoolDataSetBase* PcduHandler::getDataSetHandle(sid_t sid) {
if (sid == switcherSet.getSid()) { if (sid == switcherSet.getSid()) {
return &switcherSet; return &switcherSet;
} else { } else {
@ -459,7 +459,7 @@ LocalPoolDataSetBase* PCDUHandler::getDataSetHandle(sid_t sid) {
} }
} }
void PCDUHandler::checkAndUpdatePduSwitch(GOMSPACE::Pdu pdu, pcdu::Switches switchIdx, void PcduHandler::checkAndUpdatePduSwitch(GOMSPACE::Pdu pdu, pcdu::Switches switchIdx,
uint8_t setValue) { uint8_t setValue) {
using namespace pcdu; using namespace pcdu;
if (switchStates[switchIdx] != setValue) { if (switchStates[switchIdx] != setValue) {

View File

@ -20,13 +20,13 @@
* This is necessary because the FSFW manages all power related functionalities via one * This is necessary because the FSFW manages all power related functionalities via one
* power object. This includes for example switching on and off of devices. * power object. This includes for example switching on and off of devices.
*/ */
class PCDUHandler : public PowerSwitchIF, class PcduHandler : public PowerSwitchIF,
public HasLocalDataPoolIF, public HasLocalDataPoolIF,
public SystemObject, public SystemObject,
public ExecutableObjectIF { public ExecutableObjectIF {
public: public:
PCDUHandler(object_id_t setObjectId, size_t cmdQueueSize = 20); PcduHandler(object_id_t setObjectId, size_t cmdQueueSize = 20);
virtual ~PCDUHandler(); virtual ~PcduHandler();
virtual ReturnValue_t initialize() override; virtual ReturnValue_t initialize() override;
virtual ReturnValue_t performOperation(uint8_t counter) override; virtual ReturnValue_t performOperation(uint8_t counter) override;

View File

@ -19,7 +19,10 @@ DualLaneAssemblyBase::DualLaneAssemblyBase(object_id_t objectId, PowerSwitchIF*
void DualLaneAssemblyBase::performChildOperation() { void DualLaneAssemblyBase::performChildOperation() {
using namespace duallane; using namespace duallane;
if (pwrStateMachine.active()) { if (pwrStateMachine.active()) {
pwrStateMachineWrapper(); ReturnValue_t result = pwrStateMachineWrapper();
if (result != returnvalue::OK) {
handleModeTransitionFailed(result);
}
} }
// Only perform the regular child operation if the power state machine is not active. // Only perform the regular child operation if the power state machine is not active.
// It does not make any sense to command device modes while the power switcher is busy // It does not make any sense to command device modes while the power switcher is busy
@ -112,6 +115,7 @@ void DualLaneAssemblyBase::handleModeReached() {
pwrStateMachine.start(targetMode, targetSubmode); pwrStateMachine.start(targetMode, targetSubmode);
// Now we can switch off the power. After that, the AssemblyBase::handleModeReached function // Now we can switch off the power. After that, the AssemblyBase::handleModeReached function
// will be called // will be called
// Ignore failures for now.
pwrStateMachineWrapper(); pwrStateMachineWrapper();
} else { } else {
finishModeOp(); finishModeOp();