diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index c2b4bc4d..3c204427 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -1028,7 +1028,7 @@ void ThermalController::ctrlMgt() { PoolReadGuard pg(&imtqThermalSet); auto heaterReq = static_cast(imtqThermalSet.heaterRequest.value); - // TODO: remove heaterReq? + // TODO: remove heaterReq? if (heaterReq == ThermalComponentIF::STATE_REQUEST_OPERATIONAL) { sensors[0].first = sensorTemperatures.mgt.isValid(); sensors[0].second = sensorTemperatures.mgt.value; diff --git a/mission/system/objects/ComSubsystem.cpp b/mission/system/objects/ComSubsystem.cpp index c6a8cfc9..f2c4a821 100644 --- a/mission/system/objects/ComSubsystem.cpp +++ b/mission/system/objects/ComSubsystem.cpp @@ -23,6 +23,7 @@ ComSubsystem::ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequence } void ComSubsystem::performChildOperation() { + Subsystem::performChildOperation(); readEventQueue(); if (performRecoveryToRxOnly and not isInTransition) { startRxOnlyRecovery(true); @@ -37,8 +38,6 @@ void ComSubsystem::performChildOperation() { if (countdownActive) { checkTransmitterCountdown(); } - - Subsystem::performChildOperation(); } MessageQueueId_t ComSubsystem::getCommandQueue() const { return Subsystem::getCommandQueue(); } diff --git a/mission/system/objects/EiveSystem.cpp b/mission/system/objects/EiveSystem.cpp index 284beb49..df8ddfc3 100644 --- a/mission/system/objects/EiveSystem.cpp +++ b/mission/system/objects/EiveSystem.cpp @@ -7,6 +7,8 @@ #include #include +#include "mission/sysDefs.h" + EiveSystem::EiveSystem(object_id_t setObjectId, uint32_t maxNumberOfSequences, uint32_t maxNumberOfTables) : Subsystem(setObjectId, maxNumberOfSequences, maxNumberOfTables) { @@ -18,15 +20,15 @@ EiveSystem::EiveSystem(object_id_t setObjectId, uint32_t maxNumberOfSequences, void EiveSystem::announceMode(bool recursive) { const char* modeStr = "UNKNOWN"; switch (mode) { - case (acs::AcsMode::OFF): { - modeStr = "OFF"; + case (satsystem::Mode::BOOT): { + modeStr = "OFF/BOOT"; break; } - case (acs::AcsMode::SAFE): { + case (satsystem::Mode::SAFE): { modeStr = "SAFE"; break; } - case (acs::AcsMode::PTG_IDLE): { + case (satsystem::Mode::PTG_IDLE): { modeStr = "POINTING IDLE"; break; } @@ -48,8 +50,12 @@ void EiveSystem::announceMode(bool recursive) { } void EiveSystem::performChildOperation() { + Subsystem::performChildOperation(); handleEventMessages(); - return Subsystem::performChildOperation(); + if (not isInTransition and performSafeRecovery) { + commandSelfToSafe(); + performSafeRecovery = false; + } } ReturnValue_t EiveSystem::initialize() { @@ -85,6 +91,11 @@ void EiveSystem::handleEventMessages() { switch (event.getEvent()) { case tcsCtrl::OBC_OVERHEATING: case tcsCtrl::PCDU_SYSTEM_OVERHEATING: { + if (isInTransition) { + performSafeRecovery = true; + return; + } + commandSelfToSafe(); break; } @@ -98,14 +109,5 @@ void EiveSystem::handleEventMessages() { } } } -void EiveSystem::commandSelfToSafe() { - if (fallbackCommandCd.hasTimedOut()) { - CommandMessage msg; - ModeMessage::setCmdModeMessage(msg, acs::AcsMode::SAFE, 0); - ReturnValue_t result = commandQueue->sendMessage(commandQueue->getId(), &msg); - if (result != returnvalue::OK) { - sif::error << "EiveSystem: Commanding EIVE-System to SAFE failed" << std::endl; - } - fallbackCommandCd.resetTimer(); - } -} + +void EiveSystem::commandSelfToSafe() { startTransition(satsystem::Mode::SAFE, 0); } diff --git a/mission/system/objects/EiveSystem.h b/mission/system/objects/EiveSystem.h index ab586e42..06110775 100644 --- a/mission/system/objects/EiveSystem.h +++ b/mission/system/objects/EiveSystem.h @@ -9,7 +9,7 @@ class EiveSystem : public Subsystem { private: MessageQueueIF* eventQueue = nullptr; - Countdown fallbackCommandCd = Countdown(30000); + bool performSafeRecovery = false; ReturnValue_t initialize() override; void performChildOperation() override;