diff --git a/CHANGELOG.md b/CHANGELOG.md index 55857ce1..f6d76e95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,9 @@ will consitute of a breaking change warranting a new major release: CFDP interface. - Proper back pressure handling for the CFDP handler, where the `LiveTmTask` is able to throttle the CFDP handler. +- Added CFDP fault handler events. +- The EIVE system will command the payload OFF explicitely again when receiving the + `power::POWER_LEVEL_CRITICAL` event. ## Fixed @@ -38,6 +41,11 @@ will consitute of a breaking change warranting a new major release: - Possible bugfix for PL PCDU parameter JSON handling which might not have been initialized properly from the JSON file. +## Changed + +- Added a 3 second delay in the EIVE system between commanding all PL components except the SUPV, + and the SUPV itself OFF when the power level becomes low or critical. + # [v7.1.0] 2023-10-11 - Bumped `eive-tmtc` to v5.8.0. diff --git a/bsp_hosted/fsfwconfig/events/translateEvents.cpp b/bsp_hosted/fsfwconfig/events/translateEvents.cpp index 7c04e9f5..62dafe33 100644 --- a/bsp_hosted/fsfwconfig/events/translateEvents.cpp +++ b/bsp_hosted/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 314 translations. + * @brief Auto-generated event translation file. Contains 315 translations. * @details - * Generated on: 2023-10-13 15:23:30 + * Generated on: 2023-10-19 11:29:35 */ #include "translateEvents.h" @@ -319,6 +319,7 @@ const char *DUMP_HK_CANCELLED_STRING = "DUMP_HK_CANCELLED"; const char *DUMP_CFDP_CANCELLED_STRING = "DUMP_CFDP_CANCELLED"; const char *TEMPERATURE_ALL_ONES_START_STRING = "TEMPERATURE_ALL_ONES_START"; const char *TEMPERATURE_ALL_ONES_RECOVERY_STRING = "TEMPERATURE_ALL_ONES_RECOVERY"; +const char *FAULT_HANDLER_TRIGGERED_STRING = "FAULT_HANDLER_TRIGGERED"; const char *translateEvents(Event event) { switch ((event & 0xFFFF)) { @@ -950,6 +951,8 @@ const char *translateEvents(Event event) { return TEMPERATURE_ALL_ONES_START_STRING; case (14501): return TEMPERATURE_ALL_ONES_RECOVERY_STRING; + case (14600): + return FAULT_HANDLER_TRIGGERED_STRING; default: return "UNKNOWN_EVENT"; } diff --git a/bsp_hosted/fsfwconfig/objects/translateObjects.cpp b/bsp_hosted/fsfwconfig/objects/translateObjects.cpp index 5cb8e295..8a61f2ed 100644 --- a/bsp_hosted/fsfwconfig/objects/translateObjects.cpp +++ b/bsp_hosted/fsfwconfig/objects/translateObjects.cpp @@ -1,8 +1,8 @@ /** * @brief Auto-generated object translation file. * @details - * Contains 174 translations. - * Generated on: 2023-10-13 15:23:30 + * Contains 175 translations. + * Generated on: 2023-10-19 11:29:35 */ #include "translateObjects.h" @@ -161,6 +161,7 @@ const char *PUS_TM_FUNNEL_STRING = "PUS_TM_FUNNEL"; const char *CFDP_TM_FUNNEL_STRING = "CFDP_TM_FUNNEL"; const char *CFDP_HANDLER_STRING = "CFDP_HANDLER"; const char *CFDP_DISTRIBUTOR_STRING = "CFDP_DISTRIBUTOR"; +const char *CFDP_FAULT_HANDLER_STRING = "CFDP_FAULT_HANDLER"; const char *EIVE_SYSTEM_STRING = "EIVE_SYSTEM"; const char *ACS_SUBSYSTEM_STRING = "ACS_SUBSYSTEM"; const char *PL_SUBSYSTEM_STRING = "PL_SUBSYSTEM"; @@ -493,6 +494,8 @@ const char *translateObject(object_id_t object) { return CFDP_HANDLER_STRING; case 0x73000206: return CFDP_DISTRIBUTOR_STRING; + case 0x73000207: + return CFDP_FAULT_HANDLER_STRING; case 0x73010000: return EIVE_SYSTEM_STRING; case 0x73010001: diff --git a/common/config/eive/eventSubsystemIds.h b/common/config/eive/eventSubsystemIds.h index 84ac42d5..370a00b8 100644 --- a/common/config/eive/eventSubsystemIds.h +++ b/common/config/eive/eventSubsystemIds.h @@ -41,6 +41,7 @@ enum : uint8_t { PERSISTENT_TM_STORE = 143, SYRLINKS_COM = 144, SUS_HANDLER = 145, + CFDP_APP = 146, COMMON_SUBSYSTEM_ID_END }; diff --git a/common/config/eive/objects.h b/common/config/eive/objects.h index d6b15b8d..c7e56715 100644 --- a/common/config/eive/objects.h +++ b/common/config/eive/objects.h @@ -166,6 +166,7 @@ enum commonObjects : uint32_t { CFDP_TM_FUNNEL = 0x73000102, CFDP_HANDLER = 0x73000205, CFDP_DISTRIBUTOR = 0x73000206, + CFDP_FAULT_HANDLER = 0x73000207, MISC_TM_STORE = 0x73020001, OK_TM_STORE = 0x73020002, NOT_OK_TM_STORE = 0x73020003, diff --git a/generators/bsp_hosted_events.csv b/generators/bsp_hosted_events.csv index 24e48628..eafa7584 100644 --- a/generators/bsp_hosted_events.csv +++ b/generators/bsp_hosted_events.csv @@ -313,3 +313,4 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 14314;0x37ea;DUMP_CFDP_CANCELLED;LOW;P1: Number of dumped packets. P2: Total dumped bytes.;mission/persistentTmStoreDefs.h 14500;0x38a4;TEMPERATURE_ALL_ONES_START;MEDIUM;Detected invalid values, starting invalid message counting;mission/acs/SusHandler.h 14501;0x38a5;TEMPERATURE_ALL_ONES_RECOVERY;INFO;Detected valid values again, resetting invalid message counter. P1: Invalid message counter.;mission/acs/SusHandler.h +14600;0x3908;FAULT_HANDLER_TRIGGERED;LOW;P1: CFDP fault handler code. P2: CFDP condition code.;mission/cfdp/defs.h diff --git a/generators/bsp_hosted_objects.csv b/generators/bsp_hosted_objects.csv index 689a58f2..254d093a 100644 --- a/generators/bsp_hosted_objects.csv +++ b/generators/bsp_hosted_objects.csv @@ -153,6 +153,7 @@ 0x73000102;CFDP_TM_FUNNEL 0x73000205;CFDP_HANDLER 0x73000206;CFDP_DISTRIBUTOR +0x73000207;CFDP_FAULT_HANDLER 0x73010000;EIVE_SYSTEM 0x73010001;ACS_SUBSYSTEM 0x73010002;PL_SUBSYSTEM diff --git a/generators/bsp_hosted_subsystems.csv b/generators/bsp_hosted_subsystems.csv index c9c90629..36828fda 100644 --- a/generators/bsp_hosted_subsystems.csv +++ b/generators/bsp_hosted_subsystems.csv @@ -61,3 +61,4 @@ 143;PERSISTENT_TM_STORE 144;SYRLINKS_COM 145;SUS_HANDLER +146;CFDP_APP diff --git a/generators/bsp_q7s_events.csv b/generators/bsp_q7s_events.csv index 24e48628..eafa7584 100644 --- a/generators/bsp_q7s_events.csv +++ b/generators/bsp_q7s_events.csv @@ -313,3 +313,4 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 14314;0x37ea;DUMP_CFDP_CANCELLED;LOW;P1: Number of dumped packets. P2: Total dumped bytes.;mission/persistentTmStoreDefs.h 14500;0x38a4;TEMPERATURE_ALL_ONES_START;MEDIUM;Detected invalid values, starting invalid message counting;mission/acs/SusHandler.h 14501;0x38a5;TEMPERATURE_ALL_ONES_RECOVERY;INFO;Detected valid values again, resetting invalid message counter. P1: Invalid message counter.;mission/acs/SusHandler.h +14600;0x3908;FAULT_HANDLER_TRIGGERED;LOW;P1: CFDP fault handler code. P2: CFDP condition code.;mission/cfdp/defs.h diff --git a/generators/bsp_q7s_objects.csv b/generators/bsp_q7s_objects.csv index 10cfed26..1ada26dd 100644 --- a/generators/bsp_q7s_objects.csv +++ b/generators/bsp_q7s_objects.csv @@ -158,6 +158,7 @@ 0x73000102;CFDP_TM_FUNNEL 0x73000205;CFDP_HANDLER 0x73000206;CFDP_DISTRIBUTOR +0x73000207;CFDP_FAULT_HANDLER 0x73010000;EIVE_SYSTEM 0x73010001;ACS_SUBSYSTEM 0x73010002;PL_SUBSYSTEM diff --git a/generators/bsp_q7s_subsystems.csv b/generators/bsp_q7s_subsystems.csv index c9c90629..36828fda 100644 --- a/generators/bsp_q7s_subsystems.csv +++ b/generators/bsp_q7s_subsystems.csv @@ -61,3 +61,4 @@ 143;PERSISTENT_TM_STORE 144;SYRLINKS_COM 145;SUS_HANDLER +146;CFDP_APP diff --git a/generators/events/translateEvents.cpp b/generators/events/translateEvents.cpp index 7c04e9f5..62dafe33 100644 --- a/generators/events/translateEvents.cpp +++ b/generators/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 314 translations. + * @brief Auto-generated event translation file. Contains 315 translations. * @details - * Generated on: 2023-10-13 15:23:30 + * Generated on: 2023-10-19 11:29:35 */ #include "translateEvents.h" @@ -319,6 +319,7 @@ const char *DUMP_HK_CANCELLED_STRING = "DUMP_HK_CANCELLED"; const char *DUMP_CFDP_CANCELLED_STRING = "DUMP_CFDP_CANCELLED"; const char *TEMPERATURE_ALL_ONES_START_STRING = "TEMPERATURE_ALL_ONES_START"; const char *TEMPERATURE_ALL_ONES_RECOVERY_STRING = "TEMPERATURE_ALL_ONES_RECOVERY"; +const char *FAULT_HANDLER_TRIGGERED_STRING = "FAULT_HANDLER_TRIGGERED"; const char *translateEvents(Event event) { switch ((event & 0xFFFF)) { @@ -950,6 +951,8 @@ const char *translateEvents(Event event) { return TEMPERATURE_ALL_ONES_START_STRING; case (14501): return TEMPERATURE_ALL_ONES_RECOVERY_STRING; + case (14600): + return FAULT_HANDLER_TRIGGERED_STRING; default: return "UNKNOWN_EVENT"; } diff --git a/generators/objects/translateObjects.cpp b/generators/objects/translateObjects.cpp index 5b99d6f0..d8046cb8 100644 --- a/generators/objects/translateObjects.cpp +++ b/generators/objects/translateObjects.cpp @@ -1,8 +1,8 @@ /** * @brief Auto-generated object translation file. * @details - * Contains 178 translations. - * Generated on: 2023-10-13 15:23:30 + * Contains 179 translations. + * Generated on: 2023-10-19 11:29:35 */ #include "translateObjects.h" @@ -166,6 +166,7 @@ const char *PUS_TM_FUNNEL_STRING = "PUS_TM_FUNNEL"; const char *CFDP_TM_FUNNEL_STRING = "CFDP_TM_FUNNEL"; const char *CFDP_HANDLER_STRING = "CFDP_HANDLER"; const char *CFDP_DISTRIBUTOR_STRING = "CFDP_DISTRIBUTOR"; +const char *CFDP_FAULT_HANDLER_STRING = "CFDP_FAULT_HANDLER"; const char *EIVE_SYSTEM_STRING = "EIVE_SYSTEM"; const char *ACS_SUBSYSTEM_STRING = "ACS_SUBSYSTEM"; const char *PL_SUBSYSTEM_STRING = "PL_SUBSYSTEM"; @@ -507,6 +508,8 @@ const char *translateObject(object_id_t object) { return CFDP_HANDLER_STRING; case 0x73000206: return CFDP_DISTRIBUTOR_STRING; + case 0x73000207: + return CFDP_FAULT_HANDLER_STRING; case 0x73010000: return EIVE_SYSTEM_STRING; case 0x73010001: diff --git a/linux/fsfwconfig/events/translateEvents.cpp b/linux/fsfwconfig/events/translateEvents.cpp index 7c04e9f5..62dafe33 100644 --- a/linux/fsfwconfig/events/translateEvents.cpp +++ b/linux/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 314 translations. + * @brief Auto-generated event translation file. Contains 315 translations. * @details - * Generated on: 2023-10-13 15:23:30 + * Generated on: 2023-10-19 11:29:35 */ #include "translateEvents.h" @@ -319,6 +319,7 @@ const char *DUMP_HK_CANCELLED_STRING = "DUMP_HK_CANCELLED"; const char *DUMP_CFDP_CANCELLED_STRING = "DUMP_CFDP_CANCELLED"; const char *TEMPERATURE_ALL_ONES_START_STRING = "TEMPERATURE_ALL_ONES_START"; const char *TEMPERATURE_ALL_ONES_RECOVERY_STRING = "TEMPERATURE_ALL_ONES_RECOVERY"; +const char *FAULT_HANDLER_TRIGGERED_STRING = "FAULT_HANDLER_TRIGGERED"; const char *translateEvents(Event event) { switch ((event & 0xFFFF)) { @@ -950,6 +951,8 @@ const char *translateEvents(Event event) { return TEMPERATURE_ALL_ONES_START_STRING; case (14501): return TEMPERATURE_ALL_ONES_RECOVERY_STRING; + case (14600): + return FAULT_HANDLER_TRIGGERED_STRING; default: return "UNKNOWN_EVENT"; } diff --git a/linux/fsfwconfig/objects/translateObjects.cpp b/linux/fsfwconfig/objects/translateObjects.cpp index 5b99d6f0..d8046cb8 100644 --- a/linux/fsfwconfig/objects/translateObjects.cpp +++ b/linux/fsfwconfig/objects/translateObjects.cpp @@ -1,8 +1,8 @@ /** * @brief Auto-generated object translation file. * @details - * Contains 178 translations. - * Generated on: 2023-10-13 15:23:30 + * Contains 179 translations. + * Generated on: 2023-10-19 11:29:35 */ #include "translateObjects.h" @@ -166,6 +166,7 @@ const char *PUS_TM_FUNNEL_STRING = "PUS_TM_FUNNEL"; const char *CFDP_TM_FUNNEL_STRING = "CFDP_TM_FUNNEL"; const char *CFDP_HANDLER_STRING = "CFDP_HANDLER"; const char *CFDP_DISTRIBUTOR_STRING = "CFDP_DISTRIBUTOR"; +const char *CFDP_FAULT_HANDLER_STRING = "CFDP_FAULT_HANDLER"; const char *EIVE_SYSTEM_STRING = "EIVE_SYSTEM"; const char *ACS_SUBSYSTEM_STRING = "ACS_SUBSYSTEM"; const char *PL_SUBSYSTEM_STRING = "PL_SUBSYSTEM"; @@ -507,6 +508,8 @@ const char *translateObject(object_id_t object) { return CFDP_HANDLER_STRING; case 0x73000206: return CFDP_DISTRIBUTOR_STRING; + case 0x73000207: + return CFDP_FAULT_HANDLER_STRING; case 0x73010000: return EIVE_SYSTEM_STRING; case 0x73010001: diff --git a/mission/cfdp/CfdpFaultHandler.h b/mission/cfdp/CfdpFaultHandler.h index 565606c6..09ba0847 100644 --- a/mission/cfdp/CfdpFaultHandler.h +++ b/mission/cfdp/CfdpFaultHandler.h @@ -1,28 +1,35 @@ #ifndef MISSION_CFDP_CFDPFAULTHANDLER_H_ #define MISSION_CFDP_CFDPFAULTHANDLER_H_ +#include "defs.h" #include "fsfw/cfdp.h" namespace cfdp { -class EiveFaultHandler : public cfdp::FaultHandlerBase { +class EiveFaultHandler : public cfdp::FaultHandlerBase, public SystemObject { public: + EiveFaultHandler(object_id_t objectId) : SystemObject(objectId) {} + void noticeOfSuspensionCb(cfdp::TransactionId& id, cfdp::ConditionCode code) override { sif::warning << "Notice of suspension detected for transaction " << id << " with condition code: " << cfdp::getConditionCodeString(code) << std::endl; + triggerEvent(cfdp::FAULT_HANDLER_TRIGGERED, FaultHandlerCode::NOTICE_OF_SUSPENSION, code); } void noticeOfCancellationCb(cfdp::TransactionId& id, cfdp::ConditionCode code) override { sif::warning << "Notice of suspension detected for transaction " << id << " with condition code: " << cfdp::getConditionCodeString(code) << std::endl; + triggerEvent(cfdp::FAULT_HANDLER_TRIGGERED, FaultHandlerCode::NOTICE_OF_CANCELLATION, code); } void abandonCb(cfdp::TransactionId& id, cfdp::ConditionCode code) override { sif::warning << "Transaction " << id << " was abandoned, condition code : " << cfdp::getConditionCodeString(code) << std::endl; + triggerEvent(cfdp::FAULT_HANDLER_TRIGGERED, FaultHandlerCode::ABANDON_TRANSACTION, code); } void ignoreCb(cfdp::TransactionId& id, cfdp::ConditionCode code) override { sif::warning << "Fault ignored for transaction " << id << ", condition code: " << cfdp::getConditionCodeString(code) << std::endl; + triggerEvent(cfdp::FAULT_HANDLER_TRIGGERED, FaultHandlerCode::IGNORE_ERROR, code); } }; diff --git a/mission/cfdp/defs.h b/mission/cfdp/defs.h new file mode 100644 index 00000000..249bec04 --- /dev/null +++ b/mission/cfdp/defs.h @@ -0,0 +1,16 @@ +#ifndef MISSION_CFDP_DEFS_H_ +#define MISSION_CFDP_DEFS_H_ + +#include "eive/eventSubsystemIds.h" +#include "fsfw/events/Event.h" + +namespace cfdp { + +static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CFDP_APP; + +//! [EXPORT] : [COMMENT] P1: CFDP fault handler code. P2: CFDP condition code. +static constexpr Event FAULT_HANDLER_TRIGGERED = event::makeEvent(SUBSYSTEM_ID, 0, severity::LOW); + +} // namespace cfdp + +#endif /* MISSION_CFDP_DEFS_H_ */ diff --git a/mission/genericFactory.cpp b/mission/genericFactory.cpp index 25b59f9b..47cb1a5f 100644 --- a/mission/genericFactory.cpp +++ b/mission/genericFactory.cpp @@ -86,7 +86,6 @@ EntityId REMOTE_CFDP_ID(UnsignedByteField(config::EIVE_GROUND_CFDP_ENT RemoteEntityCfg GROUND_REMOTE_CFG(REMOTE_CFDP_ID); OneRemoteConfigProvider REMOTE_CFG_PROVIDER(GROUND_REMOTE_CFG); HostFilesystem HOST_FS; -EiveFaultHandler EIVE_FAULT_HANDLER; } // namespace cfdp @@ -290,7 +289,8 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun cfdp::EntityId localId(apid); GROUND_REMOTE_CFG.defaultChecksum = cfdp::ChecksumType::CRC_32; GROUND_REMOTE_CFG.maxFileSegmentLen = config::CFDP_MAX_FILE_SEGMENT_LEN; - CfdpHandlerCfg cfdpCfg(localId, indicationCfg, *eiveUserHandler, EIVE_FAULT_HANDLER, PACKET_LIST, + auto eiveFaultHandler = new EiveFaultHandler(objects::CFDP_FAULT_HANDLER); + CfdpHandlerCfg cfdpCfg(localId, indicationCfg, *eiveUserHandler, *eiveFaultHandler, PACKET_LIST, LOST_SEGMENTS, REMOTE_CFG_PROVIDER); auto* cfdpHandler = new CfdpHandler(params, cfdpCfg, signals::CFDP_CHANNEL_THROTTLE_SIGNAL); // All CFDP packets arrive wrapped inside CCSDS space packets diff --git a/mission/system/EiveSystem.cpp b/mission/system/EiveSystem.cpp index 0df0fc95..cd450502 100644 --- a/mission/system/EiveSystem.cpp +++ b/mission/system/EiveSystem.cpp @@ -70,6 +70,9 @@ void EiveSystem::performChildOperation() { } pdecRecoveryLogic(); i2cRecoveryLogic(); + if (forcePlOffState != ForcePlOffState::NONE) { + forceOffPayload(); + } } ReturnValue_t EiveSystem::initialize() { @@ -203,10 +206,14 @@ void EiveSystem::handleEventMessages() { break; } case power::POWER_LEVEL_LOW: { - forceOffPayload(); + forcePlOffState = ForcePlOffState::FORCE_ALL_EXCEPT_SUPV_OFF; break; } - case power::POWER_LEVEL_CRITICAL: + case power::POWER_LEVEL_CRITICAL: { + // Force payload off in any case. It really should not be on when the power level + // becomes critical, but better be safe than sorry.. + forcePlOffState = ForcePlOffState::FORCE_ALL_EXCEPT_SUPV_OFF; + // Also set the STR assembly to faulty, which should cause a fallback to SAFE mode. CommandMessage msg; HealthMessage::setHealthMessage(&msg, HealthMessage::HEALTH_SET, HasHealthIF::FAULTY); ReturnValue_t result = MessageQueueSenderIF::sendMessage( @@ -216,6 +223,7 @@ void EiveSystem::handleEventMessages() { << std::endl; } break; + } } break; default: @@ -403,37 +411,45 @@ void EiveSystem::pdecRecoveryLogic() { void EiveSystem::forceOffPayload() { CommandMessage msg; + ReturnValue_t result; // set PL to faulty HealthMessage::setHealthMessage(&msg, HealthMessage::HEALTH_SET, HasHealthIF::FAULTY); - ReturnValue_t result = commandQueue->sendMessage(plPcduQueueId, &msg); - if (result != returnvalue::OK) { - sif::error << "EIVE System: Sending FAULTY command to PL PCDU failed" << std::endl; + if (forcePlOffState == ForcePlOffState::FORCE_ALL_EXCEPT_SUPV_OFF) { + result = commandQueue->sendMessage(plocMpsocQueueId, &msg); + if (result != returnvalue::OK) { + sif::error << "EIVE System: Sending FAULTY command to PLOC MPSOC failed" << std::endl; + } + result = commandQueue->sendMessage(cameraQueueId, &msg); + if (result != returnvalue::OK) { + sif::error << "EIVE System: Sending FAULTY command to PL CAM failed" << std::endl; + } + result = commandQueue->sendMessage(scexQueueId, &msg); + if (result != returnvalue::OK) { + sif::error << "EIVE System: Sending FAULTY command to SCEX failed" << std::endl; + } + result = commandQueue->sendMessage(radSensorQueueId, &msg); + if (result != returnvalue::OK) { + sif::error << "EIVE System: Sending FAULTY command to RAD SENSOR failed" << std::endl; + } + result = commandQueue->sendMessage(plPcduQueueId, &msg); + if (result != returnvalue::OK) { + sif::error << "EIVE System: Sending FAULTY command to PL PCDU failed" << std::endl; + } + forcePlOffState = ForcePlOffState::WAITING; + supvOffDelay.resetTimer(); } - result = commandQueue->sendMessage(plocMpsocQueueId, &msg); - if (result != returnvalue::OK) { - sif::error << "EIVE System: Sending FAULTY command to PLOC MPSOC failed" << std::endl; + if (forcePlOffState == ForcePlOffState::WAITING and supvOffDelay.hasTimedOut()) { + forcePlOffState = ForcePlOffState::FORCE_SUPV_OFF; } - result = commandQueue->sendMessage(plocSupervisorQueueId, &msg); - if (result != returnvalue::OK) { - sif::error << "EIVE System: Sending FAULTY command to PLOC SUPERVISOR failed" << std::endl; - } - - result = commandQueue->sendMessage(cameraQueueId, &msg); - if (result != returnvalue::OK) { - sif::error << "EIVE System: Sending FAULTY command to PL CAM failed" << std::endl; - } - - result = commandQueue->sendMessage(scexQueueId, &msg); - if (result != returnvalue::OK) { - sif::error << "EIVE System: Sending FAULTY command to SCEX failed" << std::endl; - } - - result = commandQueue->sendMessage(radSensorQueueId, &msg); - if (result != returnvalue::OK) { - sif::error << "EIVE System: Sending FAULTY command to RAD SENSOR failed" << std::endl; + if (forcePlOffState == ForcePlOffState::FORCE_SUPV_OFF) { + result = commandQueue->sendMessage(plocSupervisorQueueId, &msg); + if (result != returnvalue::OK) { + sif::error << "EIVE System: Sending FAULTY command to PLOC SUPERVISOR failed" << std::endl; + } + forcePlOffState = ForcePlOffState::NONE; } } diff --git a/mission/system/EiveSystem.h b/mission/system/EiveSystem.h index 78f8bdc9..fed5791a 100644 --- a/mission/system/EiveSystem.h +++ b/mission/system/EiveSystem.h @@ -22,6 +22,12 @@ class EiveSystem : public Subsystem, public HasActionsIF { [[nodiscard]] MessageQueueId_t getCommandQueue() const override; private: + enum class ForcePlOffState { + NONE, + FORCE_ALL_EXCEPT_SUPV_OFF, + WAITING, + FORCE_SUPV_OFF + } forcePlOffState = ForcePlOffState::NONE; enum class I2cRebootState { NONE, SYSTEM_MODE_BOOT, @@ -37,6 +43,7 @@ class EiveSystem : public Subsystem, public HasActionsIF { bool alreadyTriedI2cRecovery = false; uint8_t frameDirtyErrorCounter = 0; + Countdown supvOffDelay = Countdown(3000); Countdown frameDirtyCheckCd = Countdown(10000); // If the PDEC reset was already attempted in the last 2 minutes, there is a high chance that // only a full reboot will fix the issue.