From 0697cca88a4881e3c980528251293cb8237fd9ad Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 25 Apr 2022 13:36:11 +0200 Subject: [PATCH 01/17] started acs subsystem --- bsp_q7s/core/ObjectFactory.cpp | 4 +- common/config/commonObjects.h | 8 +- generators/fsfwgen | 2 +- mission/system/objects/definitions.h | 6 ++ mission/system/tree/CMakeLists.txt | 2 + mission/system/tree/acsModeTree.cpp | 26 ++++-- mission/system/tree/acsModeTree.h | 4 +- mission/system/tree/payloadModeTree.cpp | 116 ++++++++++++++++++++++++ mission/system/tree/payloadModeTree.h | 12 +++ mission/system/tree/system.cpp | 9 ++ mission/system/tree/system.h | 10 ++ 11 files changed, 183 insertions(+), 16 deletions(-) create mode 100644 mission/system/tree/payloadModeTree.cpp create mode 100644 mission/system/tree/payloadModeTree.h create mode 100644 mission/system/tree/system.cpp create mode 100644 mission/system/tree/system.h diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 19457188..9489dbc3 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -42,7 +42,7 @@ #include "mission/system/objects/SusAssembly.h" #include "mission/system/objects/SusFdir.h" #include "mission/system/objects/TcsBoardAssembly.h" -#include "mission/system/tree/acsModeTree.h" +#include "mission/system/tree/system.h" #include "tmtc/apid.h" #include "tmtc/pusIds.h" @@ -208,7 +208,7 @@ void ObjectFactory::produce(void* args) { new PlocUpdater(objects::PLOC_UPDATER); new PlocMemoryDumper(objects::PLOC_MEMORY_DUMPER); - satsystem::initAcsSubsystem(); + satsystem::init(); } void ObjectFactory::createTmpComponents() { diff --git a/common/config/commonObjects.h b/common/config/commonObjects.h index 0b27a023..fff9b465 100644 --- a/common/config/commonObjects.h +++ b/common/config/commonObjects.h @@ -38,7 +38,7 @@ enum commonObjects: uint32_t { GYRO_2_ADIS_HANDLER = 0x44120212, GYRO_3_L3G_HANDLER = 0x44120313, PLPCDU_HANDLER = 0x44300000, - + SCEX_HANDLER = 0x44400000, IMTQ_HANDLER = 0x44140014, PLOC_MPSOC_HANDLER = 0x44330015, PLOC_SUPERVISOR_HANDLER = 0x44330016, @@ -99,8 +99,12 @@ enum commonObjects: uint32_t { SUS_BOARD_ASS = 0x73000002, TCS_BOARD_ASS = 0x73000003, RW_ASS = 0x73000004, - ACS_SUBSYSTEM = 0x73010001, + PLOC_SWITCHER = 0x73000005, + CAM_SWITCHER = 0x73000006, EIVE_SYSTEM = 0x73010000, + ACS_SUBSYSTEM = 0x73010001, + PL_SUBSYSTEM = 0x73010002, + PLOC_SUBSYSTEM = 0x73010003, }; } diff --git a/generators/fsfwgen b/generators/fsfwgen index d2bdabbf..2a408e8c 160000 --- a/generators/fsfwgen +++ b/generators/fsfwgen @@ -1 +1 @@ -Subproject commit d2bdabbf0f213747efc18cb45fcf2a2294b14bc8 +Subproject commit 2a408e8c7dd2ebe974b9699fb5aee0889aa86392 diff --git a/mission/system/objects/definitions.h b/mission/system/objects/definitions.h index aee127bb..99868659 100644 --- a/mission/system/objects/definitions.h +++ b/mission/system/objects/definitions.h @@ -16,4 +16,10 @@ enum Submodes : Submode_t { A_SIDE = 0, B_SIDE = 1, DUAL_MODE = 2 }; } // namespace duallane +namespace payload { + +enum Modes { NONE = 0, DAC = 1, CAM = 2, PL_DATA = 3, EARTH_OBSV = 4, SCEX = 5 }; + +} + #endif /* MISSION_SYSTEM_DEFINITIONS_H_ */ diff --git a/mission/system/tree/CMakeLists.txt b/mission/system/tree/CMakeLists.txt index f88891d4..c5bddc3f 100644 --- a/mission/system/tree/CMakeLists.txt +++ b/mission/system/tree/CMakeLists.txt @@ -1,3 +1,5 @@ target_sources(${LIB_EIVE_MISSION} PRIVATE acsModeTree.cpp + payloadModeTree.cpp + system.cpp ) diff --git a/mission/system/tree/acsModeTree.cpp b/mission/system/tree/acsModeTree.cpp index e5748f08..3fca1ce0 100644 --- a/mission/system/tree/acsModeTree.cpp +++ b/mission/system/tree/acsModeTree.cpp @@ -8,6 +8,8 @@ #include "mission/controller/controllerdefinitions/AcsControllerDefinitions.h" +// Alias for checker function +namespace { void checkInsert(ReturnValue_t result, const char* ctx); void buildOffSequence(Subsystem* ss, ModeListEntry& eh); void buildDetumbleSequence(Subsystem* ss, ModeListEntry& entryHelper); @@ -15,8 +17,8 @@ void buildSafeSequence(Subsystem* ss, ModeListEntry& entryHelper); void buildIdleSequence(Subsystem* ss, ModeListEntry& entryHelper); void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& entryHelper); void buildTargetPtSequence(Subsystem* ss, ModeListEntry& entryHelper); +} // namespace -// Alias for checker function const auto CHK = checkInsert; static const auto OFF = HasModesIF::MODE_OFF; static const auto NML = DeviceHandlerIF::MODE_NORMAL; @@ -73,7 +75,7 @@ auto ACS_TABLE_TARGET_PT_TRANS_0 = auto ACS_TABLE_TARGET_PT_TRANS_1 = std::make_pair((acs::CtrlModes::TARGET_PT << 24) | 3, FixedArrayList()); -void satsystem::initAcsSubsystem() { +void satsystem::acs::init() { ModeListEntry entry; Subsystem* acsSubsystem = new Subsystem(objects::ACS_SUBSYSTEM, objects::EIVE_SYSTEM, 12, 24); buildOffSequence(acsSubsystem, entry); @@ -82,11 +84,13 @@ void satsystem::initAcsSubsystem() { buildIdleSequence(acsSubsystem, entry); buildIdleChargeSequence(acsSubsystem, entry); buildTargetPtSequence(acsSubsystem, entry); - acsSubsystem->setInitialMode(HasModesIF::MODE_OFF); + acsSubsystem->setInitialMode(OFF); } +namespace { + void buildOffSequence(Subsystem* ss, ModeListEntry& eh) { - std::string context = "satsystem::buildOffSequence"; + std::string context = "satsystem::acs::buildOffSequence"; auto ctxc = context.c_str(); // Insert Helper Table auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& table) { @@ -125,7 +129,7 @@ void buildOffSequence(Subsystem* ss, ModeListEntry& eh) { } void buildSafeSequence(Subsystem* ss, ModeListEntry& eh) { - std::string context = "satsystem::buildSafeSequence"; + std::string context = "satsystem::acs::buildSafeSequence"; auto ctxc = context.c_str(); // Insert Helper Table auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, @@ -174,7 +178,7 @@ void buildSafeSequence(Subsystem* ss, ModeListEntry& eh) { } void buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) { - std::string context = "satsystem::buildDetumbleSequence"; + std::string context = "satsystem::acs::buildDetumbleSequence"; auto ctxc = context.c_str(); // Insert Helper Table auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, @@ -226,7 +230,7 @@ void buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) { } void buildIdleSequence(Subsystem* ss, ModeListEntry& eh) { - std::string context = "satsystem::buildIdleSequence"; + std::string context = "satsystem::acs::buildIdleSequence"; auto ctxc = context.c_str(); // Insert Helper Table auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, @@ -273,7 +277,7 @@ void buildIdleSequence(Subsystem* ss, ModeListEntry& eh) { } void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& eh) { - std::string context = "satsystem::buildIdleChargeSequence"; + std::string context = "satsystem::acs::buildIdleChargeSequence"; auto ctxc = context.c_str(); // Insert Helper Table auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, @@ -327,7 +331,7 @@ void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& eh) { } void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) { - std::string context = "satsystem::buildTargetPtSequence"; + std::string context = "satsystem::acs::buildTargetPtSequence"; auto ctxc = context.c_str(); // Insert Helper Table auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, @@ -383,6 +387,8 @@ void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) { void checkInsert(ReturnValue_t result, const char* ctx) { if (result != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "satsystem::checkInsert: Insertion failed at " << ctx << std::endl; + sif::warning << "Insertion failed at " << ctx << std::endl; } } + +} // namespace diff --git a/mission/system/tree/acsModeTree.h b/mission/system/tree/acsModeTree.h index 5ad5d7c9..3492ee9e 100644 --- a/mission/system/tree/acsModeTree.h +++ b/mission/system/tree/acsModeTree.h @@ -3,7 +3,9 @@ class Subsystem; namespace satsystem { +namespace acs { -void initAcsSubsystem(); +void init(); +} } // namespace satsystem diff --git a/mission/system/tree/payloadModeTree.cpp b/mission/system/tree/payloadModeTree.cpp new file mode 100644 index 00000000..8d5ff876 --- /dev/null +++ b/mission/system/tree/payloadModeTree.cpp @@ -0,0 +1,116 @@ +#include "payloadModeTree.h" + +#include +#include +#include +#include +#include + +#include "mission/system/objects/PayloadSubsystem.h" + +namespace { +void checkInsert(ReturnValue_t result, const char* ctx); +void initOffSequence(Subsystem* ss, ModeListEntry& eh); +void initPlDacSequence(Subsystem* ss, ModeListEntry& eh); +void initPlCamSequence(Subsystem* ss, ModeListEntry& eh); +void initPlDataSequence(Subsystem* ss, ModeListEntry& eh); +void initEarthObsvSequence(Subsystem* ss, ModeListEntry& eh); +void initScexSequence(Subsystem* ss, ModeListEntry& eh); +} // namespace + +const auto CHK = checkInsert; +static const auto OFF = HasModesIF::MODE_OFF; +// static const auto NML = DeviceHandlerIF::MODE_NORMAL; + +auto PL_SEQUENCE_OFF = std::make_pair(OFF << 24, FixedArrayList()); +auto PL_TABLE_OFF_TGT = std::make_pair((OFF << 24) | 1, FixedArrayList()); +auto PL_TABLE_OFF_TRANS = std::make_pair((OFF << 24) | 2, FixedArrayList()); + +void satsystem::pl::init() { + ModeListEntry entry; + Subsystem* plSubsystem = new Subsystem(objects::PL_SUBSYSTEM, objects::EIVE_SYSTEM, 12, 24); + initOffSequence(plSubsystem, entry); + initPlDacSequence(plSubsystem, entry); + initPlCamSequence(plSubsystem, entry); + initPlDataSequence(plSubsystem, entry); + initEarthObsvSequence(plSubsystem, entry); + initScexSequence(plSubsystem, entry); + plSubsystem->setInitialMode(OFF); +} + +namespace { + +void initOffSequence(Subsystem* ss, ModeListEntry& eh) { + std::string context = "satsystem::payload::buildOffSequence"; + auto ctxc = context.c_str(); + // Insert Helper Table + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, + ArrayList& sequence) { + eh.setObject(obj); + eh.setMode(mode); + eh.setSubmode(submode); + CHK(sequence.insert(eh), ctxc); + }; + // Insert Helper Sequence + auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { + eh.setTableId(tableId); + eh.setWaitSeconds(waitSeconds); + eh.setCheckSuccess(checkSuccess); + CHK(sequence.insert(eh), ctxc); + }; + + // Build OFF target. Is empty + ss->addTable(&PL_TABLE_OFF_TGT.second, PL_TABLE_OFF_TGT.first, false, true); + + // Build OFF transition 0 + iht(objects::PLOC_SWITCHER, OFF, 0, PL_TABLE_OFF_TRANS.second); + iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_OFF_TRANS.second); + iht(objects::SCEX_HANDLER, OFF, 0, PL_TABLE_OFF_TRANS.second); + iht(objects::PLPCDU_HANDLER, OFF, 0, PL_TABLE_OFF_TRANS.second); + iht(objects::PLOC_SUBSYSTEM, OFF, 0, PL_TABLE_OFF_TRANS.second); + ss->addTable(&PL_TABLE_OFF_TRANS.second, PL_TABLE_OFF_TRANS.first, false, true); + + // Build OFF sequence + ihs(PL_SEQUENCE_OFF.second, PL_TABLE_OFF_TGT.first, 0, false); + ihs(PL_SEQUENCE_OFF.second, PL_TABLE_OFF_TRANS.first, 0, false); + ss->addSequence(&PL_SEQUENCE_OFF.second, PL_SEQUENCE_OFF.first, PL_SEQUENCE_OFF.first, false, + true); +} + +void initPlDacSequence(Subsystem* ss, ModeListEntry& eh) { + std::string context = "satsystem::payload::initPlDacSequence"; + auto ctxc = context.c_str(); + // Insert Helper Table + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, + ArrayList& sequence) { + eh.setObject(obj); + eh.setMode(mode); + eh.setSubmode(submode); + CHK(sequence.insert(eh), ctxc); + }; + // Insert Helper Sequence + auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { + eh.setTableId(tableId); + eh.setWaitSeconds(waitSeconds); + eh.setCheckSuccess(checkSuccess); + CHK(sequence.insert(eh), ctxc); + }; +} + +void initPlCamSequence(Subsystem* ss, ModeListEntry& eh) {} + +void initPlDataSequence(Subsystem* ss, ModeListEntry& eh) {} + +void initEarthObsvSequence(Subsystem* ss, ModeListEntry& eh) {} + +void initScexSequence(Subsystem* ss, ModeListEntry& eh) {} + +void checkInsert(ReturnValue_t result, const char* ctx) { + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "satsystem::checkInsert: PL | Insertion failed at " << ctx << std::endl; + } +} + +} // namespace diff --git a/mission/system/tree/payloadModeTree.h b/mission/system/tree/payloadModeTree.h new file mode 100644 index 00000000..738eb01c --- /dev/null +++ b/mission/system/tree/payloadModeTree.h @@ -0,0 +1,12 @@ +#ifndef MISSION_SYSTEM_TREE_PAYLOADMODETREE_H_ +#define MISSION_SYSTEM_TREE_PAYLOADMODETREE_H_ + +namespace satsystem { + +namespace pl { +void init(); +} + +} // namespace satsystem + +#endif /* MISSION_SYSTEM_TREE_PAYLOADMODETREE_H_ */ diff --git a/mission/system/tree/system.cpp b/mission/system/tree/system.cpp new file mode 100644 index 00000000..4455588f --- /dev/null +++ b/mission/system/tree/system.cpp @@ -0,0 +1,9 @@ +#include "system.h" + +#include "acsModeTree.h" +#include "payloadModeTree.h" + +void satsystem::init() { + acs::init(); + pl::init(); +} diff --git a/mission/system/tree/system.h b/mission/system/tree/system.h new file mode 100644 index 00000000..a8599121 --- /dev/null +++ b/mission/system/tree/system.h @@ -0,0 +1,10 @@ +#ifndef MISSION_SYSTEM_TREE_SYSTEM_H_ +#define MISSION_SYSTEM_TREE_SYSTEM_H_ + +namespace satsystem { + +void init(); + +} + +#endif /* MISSION_SYSTEM_TREE_SYSTEM_H_ */ -- 2.43.0 From f5723dc1816263d2a28cf8257afeb670c63ffd49 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 25 Apr 2022 18:44:38 +0200 Subject: [PATCH 02/17] continued pl ss --- .../payloadPcduDefinitions.h | 3 + mission/system/objects/definitions.h | 8 +- mission/system/tree/payloadModeTree.cpp | 157 ++++++++++++++++-- 3 files changed, 156 insertions(+), 12 deletions(-) diff --git a/mission/devices/devicedefinitions/payloadPcduDefinitions.h b/mission/devices/devicedefinitions/payloadPcduDefinitions.h index ab387fc7..6ad31d3f 100644 --- a/mission/devices/devicedefinitions/payloadPcduDefinitions.h +++ b/mission/devices/devicedefinitions/payloadPcduDefinitions.h @@ -101,6 +101,9 @@ enum NormalSubmodeBits { }; static constexpr Submode_t ALL_OFF_SUBMODE = 0; +static constexpr Submode_t ALL_ON_SUBMODE = (1 << HPA_ON) | (1 << MPA_ON) | (1 << TX_ON) | + (1 << X8_ON) | (1 << DRO_ON) | + (1 << SOLID_STATE_RELAYS_ADC_ON); // 12 ADC values * 2 + trailing zero static constexpr size_t ADC_REPLY_SIZE = 25; diff --git a/mission/system/objects/definitions.h b/mission/system/objects/definitions.h index 99868659..99fc5eb6 100644 --- a/mission/system/objects/definitions.h +++ b/mission/system/objects/definitions.h @@ -18,8 +18,14 @@ enum Submodes : Submode_t { A_SIDE = 0, B_SIDE = 1, DUAL_MODE = 2 }; namespace payload { -enum Modes { NONE = 0, DAC = 1, CAM = 2, PL_DATA = 3, EARTH_OBSV = 4, SCEX = 5 }; +enum Modes { NONE = 0, SUPV_ONLY = 1, MPSOC_STREAM = 2, CAM_STREAM = 3, EARTH_OBSV = 4, SCEX = 5 }; + +namespace ploc { + +enum Modes { OFF = 0, SUPV_ONLY = 1, MPSOC_ON = 2 }; } +} // namespace payload + #endif /* MISSION_SYSTEM_DEFINITIONS_H_ */ diff --git a/mission/system/tree/payloadModeTree.cpp b/mission/system/tree/payloadModeTree.cpp index 8d5ff876..2ce4678a 100644 --- a/mission/system/tree/payloadModeTree.cpp +++ b/mission/system/tree/payloadModeTree.cpp @@ -6,33 +6,63 @@ #include #include +#include "mission/devices/devicedefinitions/payloadPcduDefinitions.h" #include "mission/system/objects/PayloadSubsystem.h" +#include "mission/system/objects/definitions.h" namespace { void checkInsert(ReturnValue_t result, const char* ctx); void initOffSequence(Subsystem* ss, ModeListEntry& eh); -void initPlDacSequence(Subsystem* ss, ModeListEntry& eh); -void initPlCamSequence(Subsystem* ss, ModeListEntry& eh); -void initPlDataSequence(Subsystem* ss, ModeListEntry& eh); +void initPlMpsocStreamSequence(Subsystem* ss, ModeListEntry& eh); +void initPlCamStreamSequence(Subsystem* ss, ModeListEntry& eh); +void initPlSpvSequence(Subsystem* ss, ModeListEntry& eh); void initEarthObsvSequence(Subsystem* ss, ModeListEntry& eh); void initScexSequence(Subsystem* ss, ModeListEntry& eh); } // namespace const auto CHK = checkInsert; static const auto OFF = HasModesIF::MODE_OFF; -// static const auto NML = DeviceHandlerIF::MODE_NORMAL; +static const auto ON = HasModesIF::MODE_ON; +static const auto NML = DeviceHandlerIF::MODE_NORMAL; auto PL_SEQUENCE_OFF = std::make_pair(OFF << 24, FixedArrayList()); auto PL_TABLE_OFF_TGT = std::make_pair((OFF << 24) | 1, FixedArrayList()); auto PL_TABLE_OFF_TRANS = std::make_pair((OFF << 24) | 2, FixedArrayList()); +auto PL_SEQUENCE_MPSOC_STREAM = + std::make_pair(payload::Modes::MPSOC_STREAM << 24, FixedArrayList()); +auto PL_TABLE_MPSOC_STREAM_TGT = + std::make_pair((payload::Modes::MPSOC_STREAM << 24) | 1, FixedArrayList()); +auto PL_TABLE_MPSOC_STREAM_TRANS_0 = + std::make_pair((payload::Modes::MPSOC_STREAM << 24) | 2, FixedArrayList()); +auto PL_TABLE_MPSOC_STREAM_TRANS_1 = + std::make_pair((payload::Modes::MPSOC_STREAM << 24) | 2, FixedArrayList()); + +auto PL_SEQUENCE_CAM_STREAM = + std::make_pair(payload::Modes::CAM_STREAM << 24, FixedArrayList()); +auto PL_TABLE_CAM_STREAM_TGT = + std::make_pair((payload::Modes::CAM_STREAM << 24) | 1, FixedArrayList()); +auto PL_TABLE_CAM_STREAM_TRANS_0 = + std::make_pair((payload::Modes::CAM_STREAM << 24) | 2, FixedArrayList()); +auto PL_TABLE_CAM_STREAM_TRANS_1 = + std::make_pair((payload::Modes::CAM_STREAM << 24) | 2, FixedArrayList()); + +auto PL_SEQUENCE_SUPV_ONLY = + std::make_pair(payload::Modes::CAM_STREAM << 24, FixedArrayList()); +auto PL_TABLE_SUPV_ONLY_TGT = + std::make_pair((payload::Modes::CAM_STREAM << 24) | 1, FixedArrayList()); +auto PL_TABLE_SUPV_ONLY_TRANS_0 = + std::make_pair((payload::Modes::CAM_STREAM << 24) | 2, FixedArrayList()); +auto PL_TABLE_SUPV_ONLY_TRANS_1 = + std::make_pair((payload::Modes::CAM_STREAM << 24) | 2, FixedArrayList()); + void satsystem::pl::init() { ModeListEntry entry; Subsystem* plSubsystem = new Subsystem(objects::PL_SUBSYSTEM, objects::EIVE_SYSTEM, 12, 24); initOffSequence(plSubsystem, entry); - initPlDacSequence(plSubsystem, entry); - initPlCamSequence(plSubsystem, entry); - initPlDataSequence(plSubsystem, entry); + initPlMpsocStreamSequence(plSubsystem, entry); + initPlCamStreamSequence(plSubsystem, entry); + initPlSpvSequence(plSubsystem, entry); initEarthObsvSequence(plSubsystem, entry); initScexSequence(plSubsystem, entry); plSubsystem->setInitialMode(OFF); @@ -78,8 +108,8 @@ void initOffSequence(Subsystem* ss, ModeListEntry& eh) { true); } -void initPlDacSequence(Subsystem* ss, ModeListEntry& eh) { - std::string context = "satsystem::payload::initPlDacSequence"; +void initPlMpsocStreamSequence(Subsystem* ss, ModeListEntry& eh) { + std::string context = "satsystem::payload::initPlMpsocStreamSequence"; auto ctxc = context.c_str(); // Insert Helper Table auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, @@ -97,11 +127,116 @@ void initPlDacSequence(Subsystem* ss, ModeListEntry& eh) { eh.setCheckSuccess(checkSuccess); CHK(sequence.insert(eh), ctxc); }; + + // Build MPSoC stream target + // Camera should always be off to prevent a conflict with the MPSoC streaming + iht(objects::PLPCDU_HANDLER, NML, plpcdu::ALL_ON_SUBMODE, PL_TABLE_MPSOC_STREAM_TGT.second); + iht(objects::PLOC_SWITCHER, ON, 0, PL_TABLE_MPSOC_STREAM_TGT.second); + iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_MPSOC_STREAM_TGT.second); + iht(objects::PLOC_SUBSYSTEM, NML, payload::ploc::MPSOC_ON, PL_TABLE_MPSOC_STREAM_TGT.second); + ss->addTable(&PL_TABLE_MPSOC_STREAM_TGT.second, PL_TABLE_MPSOC_STREAM_TGT.first, false, true); + + // Build MPSoC stream transition 0 + iht(objects::PLOC_SWITCHER, ON, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); + iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); + iht(objects::SCEX_HANDLER, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); + ss->addTable(&PL_TABLE_MPSOC_STREAM_TRANS_0.second, PL_TABLE_MPSOC_STREAM_TRANS_0.first, false, + true); + + // Build MPSoC stream transition 1 + iht(objects::PLOC_SUBSYSTEM, NML, payload::ploc::MPSOC_ON, PL_TABLE_MPSOC_STREAM_TRANS_1.second); + ss->addTable(&PL_TABLE_MPSOC_STREAM_TRANS_1.second, PL_TABLE_MPSOC_STREAM_TRANS_1.first, false, + true); + + // Build MPSoC stream sequence + ihs(PL_SEQUENCE_MPSOC_STREAM.second, PL_TABLE_MPSOC_STREAM_TGT.first, 0, true); + ihs(PL_SEQUENCE_MPSOC_STREAM.second, PL_TABLE_MPSOC_STREAM_TRANS_0.first, 0, true); + ihs(PL_SEQUENCE_MPSOC_STREAM.second, PL_TABLE_MPSOC_STREAM_TRANS_1.first, 0, false); + ss->addSequence(&PL_SEQUENCE_MPSOC_STREAM.second, PL_SEQUENCE_MPSOC_STREAM.first, + PL_SEQUENCE_OFF.first, false, true); } -void initPlCamSequence(Subsystem* ss, ModeListEntry& eh) {} +void initPlCamStreamSequence(Subsystem* ss, ModeListEntry& eh) { + std::string context = "satsystem::payload::initPlCamSequence"; + auto ctxc = context.c_str(); + // Insert Helper Table + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, + ArrayList& sequence) { + eh.setObject(obj); + eh.setMode(mode); + eh.setSubmode(submode); + CHK(sequence.insert(eh), ctxc); + }; + // Insert Helper Sequence + auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { + eh.setTableId(tableId); + eh.setWaitSeconds(waitSeconds); + eh.setCheckSuccess(checkSuccess); + CHK(sequence.insert(eh), ctxc); + }; -void initPlDataSequence(Subsystem* ss, ModeListEntry& eh) {} + // Build CAM target + // Only check that the PL PCDU is on for now. It might later become necessary to switch on + // the PLOC, so we ignore its state. + iht(objects::PLPCDU_HANDLER, NML, plpcdu::ALL_ON_SUBMODE, PL_TABLE_CAM_STREAM_TGT.second); + ss->addTable(&PL_TABLE_CAM_STREAM_TGT.second, PL_TABLE_CAM_STREAM_TGT.first, false, true); + + // Build CAM transition 0 + // PLOC is actively commanded off here + iht(objects::PLOC_SUBSYSTEM, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); + iht(objects::CAM_SWITCHER, ON, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); + iht(objects::SCEX_HANDLER, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); + ss->addTable(&PL_TABLE_MPSOC_STREAM_TRANS_0.second, PL_TABLE_MPSOC_STREAM_TRANS_0.first, false, + true); + + // Build CAM transition 1 + iht(objects::PLOC_SWITCHER, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_1.second); + ss->addTable(&PL_TABLE_MPSOC_STREAM_TRANS_1.second, PL_TABLE_MPSOC_STREAM_TRANS_1.first, false, + true); + + // Build CAM stream sequence + ihs(PL_SEQUENCE_CAM_STREAM.second, PL_TABLE_CAM_STREAM_TGT.first, 0, true); + ihs(PL_SEQUENCE_CAM_STREAM.second, PL_TABLE_CAM_STREAM_TRANS_0.first, 0, true); + ihs(PL_SEQUENCE_CAM_STREAM.second, PL_TABLE_CAM_STREAM_TRANS_1.first, 0, false); + ss->addSequence(&PL_SEQUENCE_CAM_STREAM.second, PL_SEQUENCE_CAM_STREAM.first, + PL_SEQUENCE_OFF.first, false, true); +} + +void initPlSpvSequence(Subsystem* ss, ModeListEntry& eh) { + std::string context = "satsystem::payload::initPlSupvSequence"; + auto ctxc = context.c_str(); + // Insert Helper Table + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, + ArrayList& sequence) { + eh.setObject(obj); + eh.setMode(mode); + eh.setSubmode(submode); + CHK(sequence.insert(eh), ctxc); + }; + // Insert Helper Sequence + auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { + eh.setTableId(tableId); + eh.setWaitSeconds(waitSeconds); + eh.setCheckSuccess(checkSuccess); + CHK(sequence.insert(eh), ctxc); + }; + + // Build Payload Supervisor Only target + iht(objects::PLOC_SWITCHER, ON, 0, PL_TABLE_SUPV_ONLY_TGT.second); + iht(objects::PLOC_SUBSYSTEM, NML, payload::ploc::SUPV_ONLY, PL_TABLE_SUPV_ONLY_TGT.second); + ss->addTable(&PL_TABLE_SUPV_ONLY_TGT.second, PL_TABLE_SUPV_ONLY_TGT.first, false, true); + + // Build Payload Supervisor Only transition 0 + iht(objects::PLOC_SWITCHER, ON, 0, PL_TABLE_SUPV_ONLY_TRANS_0.second); + ss->addTable(&PL_TABLE_SUPV_ONLY_TRANS_0.second, PL_TABLE_SUPV_ONLY_TRANS_0.first, inStore, + preInit) + + // Build Payload Supervisor Only transition 1 + iht(objects::PLOC_SUBSYSTEM, NML, payload::ploc::SUPV_ONLY, + PL_TABLE_SUPV_ONLY_TRANS_1.second); +} void initEarthObsvSequence(Subsystem* ss, ModeListEntry& eh) {} -- 2.43.0 From c1fe7563d2b50945831be6827a4eb7dbead614d6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 28 Apr 2022 15:05:38 +0200 Subject: [PATCH 03/17] finished first rudimentary pl ss --- fsfw | 2 +- mission/system/tree/payloadModeTree.cpp | 129 +++++++++++++++++++++--- 2 files changed, 114 insertions(+), 17 deletions(-) diff --git a/fsfw b/fsfw index d61fe7db..1c4ea6dd 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit d61fe7db93b37dd6652dbfee5b7c93f400ac5a11 +Subproject commit 1c4ea6dd0dbc6e93086c28d8e0ce3bed5be0c73c diff --git a/mission/system/tree/payloadModeTree.cpp b/mission/system/tree/payloadModeTree.cpp index 2ce4678a..ad65230f 100644 --- a/mission/system/tree/payloadModeTree.cpp +++ b/mission/system/tree/payloadModeTree.cpp @@ -36,25 +36,41 @@ auto PL_TABLE_MPSOC_STREAM_TGT = auto PL_TABLE_MPSOC_STREAM_TRANS_0 = std::make_pair((payload::Modes::MPSOC_STREAM << 24) | 2, FixedArrayList()); auto PL_TABLE_MPSOC_STREAM_TRANS_1 = - std::make_pair((payload::Modes::MPSOC_STREAM << 24) | 2, FixedArrayList()); + std::make_pair((payload::Modes::MPSOC_STREAM << 24) | 3, FixedArrayList()); auto PL_SEQUENCE_CAM_STREAM = std::make_pair(payload::Modes::CAM_STREAM << 24, FixedArrayList()); auto PL_TABLE_CAM_STREAM_TGT = - std::make_pair((payload::Modes::CAM_STREAM << 24) | 1, FixedArrayList()); + std::make_pair((payload::Modes::CAM_STREAM << 24) | 1, FixedArrayList()); auto PL_TABLE_CAM_STREAM_TRANS_0 = - std::make_pair((payload::Modes::CAM_STREAM << 24) | 2, FixedArrayList()); -auto PL_TABLE_CAM_STREAM_TRANS_1 = std::make_pair((payload::Modes::CAM_STREAM << 24) | 2, FixedArrayList()); +auto PL_TABLE_CAM_STREAM_TRANS_1 = + std::make_pair((payload::Modes::CAM_STREAM << 24) | 3, FixedArrayList()); auto PL_SEQUENCE_SUPV_ONLY = - std::make_pair(payload::Modes::CAM_STREAM << 24, FixedArrayList()); + std::make_pair(payload::Modes::SUPV_ONLY << 24, FixedArrayList()); auto PL_TABLE_SUPV_ONLY_TGT = - std::make_pair((payload::Modes::CAM_STREAM << 24) | 1, FixedArrayList()); + std::make_pair((payload::Modes::SUPV_ONLY << 24) | 1, FixedArrayList()); auto PL_TABLE_SUPV_ONLY_TRANS_0 = - std::make_pair((payload::Modes::CAM_STREAM << 24) | 2, FixedArrayList()); + std::make_pair((payload::Modes::SUPV_ONLY << 24) | 2, FixedArrayList()); auto PL_TABLE_SUPV_ONLY_TRANS_1 = - std::make_pair((payload::Modes::CAM_STREAM << 24) | 2, FixedArrayList()); + std::make_pair((payload::Modes::SUPV_ONLY << 24) | 3, FixedArrayList()); + +auto PL_SEQUENCE_EARTH_OBSV = + std::make_pair(payload::Modes::EARTH_OBSV << 24, FixedArrayList()); +auto PL_TABLE_EARTH_OBSV_TGT = + std::make_pair((payload::Modes::EARTH_OBSV << 24) | 1, FixedArrayList()); +auto PL_TABLE_EARTH_OBSV_TRANS_0 = + std::make_pair((payload::Modes::EARTH_OBSV << 24) | 2, FixedArrayList()); +auto PL_TABLE_EARTH_OBSV_TRANS_1 = + std::make_pair((payload::Modes::EARTH_OBSV << 24) | 3, FixedArrayList()); + +auto PL_SEQUENCE_SCEX = + std::make_pair(payload::Modes::SCEX << 24, FixedArrayList()); +auto PL_TABLE_SCEX_TGT = + std::make_pair((payload::Modes::SCEX << 24) | 1, FixedArrayList()); +auto PL_TABLE_SCEX_TRANS_0 = + std::make_pair((payload::Modes::SCEX << 24) | 2, FixedArrayList()); void satsystem::pl::init() { ModeListEntry entry; @@ -226,21 +242,102 @@ void initPlSpvSequence(Subsystem* ss, ModeListEntry& eh) { // Build Payload Supervisor Only target iht(objects::PLOC_SWITCHER, ON, 0, PL_TABLE_SUPV_ONLY_TGT.second); iht(objects::PLOC_SUBSYSTEM, NML, payload::ploc::SUPV_ONLY, PL_TABLE_SUPV_ONLY_TGT.second); - ss->addTable(&PL_TABLE_SUPV_ONLY_TGT.second, PL_TABLE_SUPV_ONLY_TGT.first, false, true); + ss->addTable(TableEntry(PL_TABLE_SUPV_ONLY_TGT.first, &PL_TABLE_SUPV_ONLY_TGT.second)); // Build Payload Supervisor Only transition 0 iht(objects::PLOC_SWITCHER, ON, 0, PL_TABLE_SUPV_ONLY_TRANS_0.second); - ss->addTable(&PL_TABLE_SUPV_ONLY_TRANS_0.second, PL_TABLE_SUPV_ONLY_TRANS_0.first, inStore, - preInit) + iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_SUPV_ONLY_TRANS_0.second); + ss->addTable(TableEntry(PL_TABLE_SUPV_ONLY_TRANS_0.first, &PL_TABLE_SUPV_ONLY_TRANS_0.second)); - // Build Payload Supervisor Only transition 1 - iht(objects::PLOC_SUBSYSTEM, NML, payload::ploc::SUPV_ONLY, - PL_TABLE_SUPV_ONLY_TRANS_1.second); + // Build Payload Supervisor Only transition 1 + iht(objects::PLOC_SUBSYSTEM, NML, payload::ploc::SUPV_ONLY, PL_TABLE_SUPV_ONLY_TRANS_1.second); + + // Build Payload Supervisor Only Sequence + ihs(PL_SEQUENCE_SUPV_ONLY.second, PL_TABLE_SUPV_ONLY_TGT.first, 0, true); + ihs(PL_SEQUENCE_SUPV_ONLY.second, PL_TABLE_SUPV_ONLY_TRANS_0.first, 0, true); + ihs(PL_SEQUENCE_SUPV_ONLY.second, PL_TABLE_SUPV_ONLY_TRANS_1.first, 0, false); + ss->addSequence(SequenceEntry(PL_SEQUENCE_SUPV_ONLY.first, &PL_SEQUENCE_SUPV_ONLY.second, + PL_SEQUENCE_OFF.first)); } -void initEarthObsvSequence(Subsystem* ss, ModeListEntry& eh) {} +void initEarthObsvSequence(Subsystem* ss, ModeListEntry& eh) { + std::string context = "satsystem::payload::initEarthObsvSequence"; + auto ctxc = context.c_str(); + // Insert Helper Table + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, + ArrayList& sequence) { + eh.setObject(obj); + eh.setMode(mode); + eh.setSubmode(submode); + CHK(sequence.insert(eh), ctxc); + }; + // Insert Helper Sequence + auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { + eh.setTableId(tableId); + eh.setWaitSeconds(waitSeconds); + eh.setCheckSuccess(checkSuccess); + CHK(sequence.insert(eh), ctxc); + }; -void initScexSequence(Subsystem* ss, ModeListEntry& eh) {} + // Build Earth Observation target + iht(objects::PLOC_SWITCHER, ON, 0, PL_TABLE_EARTH_OBSV_TGT.second); + iht(objects::CAM_SWITCHER, ON, 0, PL_TABLE_EARTH_OBSV_TGT.second); + iht(objects::PLPCDU_HANDLER, OFF, 0, PL_TABLE_EARTH_OBSV_TGT.second); + iht(objects::PLOC_SUBSYSTEM, NML, payload::ploc::MPSOC_ON, PL_TABLE_EARTH_OBSV_TGT.second); + ss->addTable(TableEntry(PL_TABLE_EARTH_OBSV_TGT.first, &PL_TABLE_EARTH_OBSV_TGT.second)); + + // Build Earth Observation transition 0 + iht(objects::PLOC_SWITCHER, ON, 0, PL_TABLE_EARTH_OBSV_TRANS_0.second); + iht(objects::CAM_SWITCHER, ON, 0, PL_TABLE_EARTH_OBSV_TRANS_0.second); + iht(objects::PLPCDU_HANDLER, OFF, 0, PL_TABLE_EARTH_OBSV_TRANS_0.second); + ss->addTable(TableEntry(PL_TABLE_EARTH_OBSV_TRANS_0.first, &PL_TABLE_EARTH_OBSV_TRANS_0.second)); + + // Build Earth Observation transition 1 + iht(objects::PLOC_SUBSYSTEM, NML, payload::ploc::MPSOC_ON, PL_TABLE_EARTH_OBSV_TRANS_1.second); + ss->addTable(TableEntry(PL_TABLE_EARTH_OBSV_TRANS_1.first, &PL_TABLE_EARTH_OBSV_TRANS_1.second)); + + ihs(PL_SEQUENCE_EARTH_OBSV.second, PL_TABLE_EARTH_OBSV_TGT.first, 0, true); + ihs(PL_SEQUENCE_EARTH_OBSV.second, PL_TABLE_EARTH_OBSV_TRANS_0.first, 0, true); + ihs(PL_SEQUENCE_EARTH_OBSV.second, PL_TABLE_EARTH_OBSV_TRANS_1.first, 0, false); + ss->addSequence(SequenceEntry(PL_SEQUENCE_EARTH_OBSV.first, &PL_SEQUENCE_EARTH_OBSV.second, + PL_SEQUENCE_OFF.first)); +} + +void initScexSequence(Subsystem* ss, ModeListEntry& eh) { + std::string context = "satsystem::payload::initScexSequence"; + auto ctxc = context.c_str(); + // Insert Helper Table + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, + ArrayList& sequence) { + eh.setObject(obj); + eh.setMode(mode); + eh.setSubmode(submode); + CHK(sequence.insert(eh), ctxc); + }; + // Insert Helper Sequence + auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { + eh.setTableId(tableId); + eh.setWaitSeconds(waitSeconds); + eh.setCheckSuccess(checkSuccess); + CHK(sequence.insert(eh), ctxc); + }; + + // Build SCEX target + iht(objects::SCEX_HANDLER, NML, 0, PL_TABLE_SCEX_TGT.second); + ss->addTable(TableEntry(PL_TABLE_EARTH_OBSV_TGT.first, &PL_TABLE_EARTH_OBSV_TGT.second)); + + // Build SCEX transition 0 + iht(objects::SCEX_HANDLER, NML, 0, PL_TABLE_SCEX_TGT.second); + ss->addTable(TableEntry(PL_TABLE_SCEX_TRANS_0.first, &PL_TABLE_SCEX_TRANS_0.second)); + + // Build SCEX sequence + ihs(PL_SEQUENCE_SCEX.second, PL_TABLE_SCEX_TGT.first, 0, true); + ihs(PL_SEQUENCE_SCEX.second, PL_TABLE_SCEX_TRANS_0.first, 0, false); + ss->addSequence( + SequenceEntry(PL_SEQUENCE_SCEX.first, &PL_SEQUENCE_SCEX.second, PL_SEQUENCE_OFF.first)); +} void checkInsert(ReturnValue_t result, const char* ctx) { if (result != HasReturnvaluesIF::RETURN_OK) { -- 2.43.0 From 9c0a89bbdcd2bddfee2f18b4ea7fa2a3ca6b87ff Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 28 Apr 2022 16:20:41 +0200 Subject: [PATCH 04/17] added all checks, made checker func generic --- mission/system/tree/CMakeLists.txt | 1 + mission/system/tree/acsModeTree.cpp | 126 +++++++++++------------- mission/system/tree/payloadModeTree.cpp | 118 ++++++++++++---------- mission/system/tree/util.cpp | 9 ++ mission/system/tree/util.h | 12 +++ 5 files changed, 149 insertions(+), 117 deletions(-) create mode 100644 mission/system/tree/util.cpp create mode 100644 mission/system/tree/util.h diff --git a/mission/system/tree/CMakeLists.txt b/mission/system/tree/CMakeLists.txt index c5bddc3f..908f4b3d 100644 --- a/mission/system/tree/CMakeLists.txt +++ b/mission/system/tree/CMakeLists.txt @@ -2,4 +2,5 @@ target_sources(${LIB_EIVE_MISSION} PRIVATE acsModeTree.cpp payloadModeTree.cpp system.cpp + util.cpp ) diff --git a/mission/system/tree/acsModeTree.cpp b/mission/system/tree/acsModeTree.cpp index 3fca1ce0..43ede7ae 100644 --- a/mission/system/tree/acsModeTree.cpp +++ b/mission/system/tree/acsModeTree.cpp @@ -7,10 +7,10 @@ #include #include "mission/controller/controllerdefinitions/AcsControllerDefinitions.h" +#include "util.h" // Alias for checker function namespace { -void checkInsert(ReturnValue_t result, const char* ctx); void buildOffSequence(Subsystem* ss, ModeListEntry& eh); void buildDetumbleSequence(Subsystem* ss, ModeListEntry& entryHelper); void buildSafeSequence(Subsystem* ss, ModeListEntry& entryHelper); @@ -19,7 +19,7 @@ void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& entryHelper); void buildTargetPtSequence(Subsystem* ss, ModeListEntry& entryHelper); } // namespace -const auto CHK = checkInsert; +const auto check = subsystem::checkInsert; static const auto OFF = HasModesIF::MODE_OFF; static const auto NML = DeviceHandlerIF::MODE_NORMAL; @@ -97,7 +97,7 @@ void buildOffSequence(Subsystem* ss, ModeListEntry& eh) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); - CHK(table.insert(eh), ctxc); + check(table.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, @@ -105,11 +105,11 @@ void buildOffSequence(Subsystem* ss, ModeListEntry& eh) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // OFF Target table is empty - CHK(ss->addTable(&ACS_TABLE_OFF_TGT.second, ACS_TABLE_OFF_TGT.first, false, true), ctxc); + check(ss->addTable(&ACS_TABLE_OFF_TGT.second, ACS_TABLE_OFF_TGT.first, false, true), ctxc); // Build OFF transition iht(objects::ACS_CONTROLLER, OFF, 0, ACS_TABLE_OFF_TRANS.second); @@ -118,14 +118,14 @@ void buildOffSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::ACS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second); iht(objects::SUS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second); iht(objects::RW_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second); - CHK(ss->addTable(&ACS_TABLE_OFF_TRANS.second, ACS_TABLE_OFF_TRANS.first, false, true), ctxc); + check(ss->addTable(&ACS_TABLE_OFF_TRANS.second, ACS_TABLE_OFF_TRANS.first, false, true), ctxc); // Build OFF sequence ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TGT.first, 0, false); ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TRANS.first, 0, false); - CHK(ss->addSequence(&ACS_SEQUENCE_OFF.second, ACS_SEQUENCE_OFF.first, ACS_SEQUENCE_OFF.first, - false, true), - ctxc); + check(ss->addSequence(&ACS_SEQUENCE_OFF.second, ACS_SEQUENCE_OFF.first, ACS_SEQUENCE_OFF.first, + false, true), + ctxc); } void buildSafeSequence(Subsystem* ss, ModeListEntry& eh) { @@ -137,7 +137,7 @@ void buildSafeSequence(Subsystem* ss, ModeListEntry& eh) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, @@ -145,14 +145,14 @@ void buildSafeSequence(Subsystem* ss, ModeListEntry& eh) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Build SAFE target iht(objects::ACS_CONTROLLER, acs::CtrlModes::SAFE, 0, ACS_TABLE_SAFE_TGT.second); iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_SAFE_TGT.second); iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TGT.second); iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TGT.second); - CHK(ss->addTable(&ACS_TABLE_SAFE_TGT.second, ACS_TABLE_OFF_TGT.first, false, true), ctxc); + check(ss->addTable(&ACS_TABLE_SAFE_TGT.second, ACS_TABLE_OFF_TGT.first, false, true), ctxc); // Build SAFE transition 0 iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_SAFE_TRANS_0.second); @@ -160,21 +160,21 @@ void buildSafeSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TRANS_0.second); iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_SAFE_TRANS_0.second); iht(objects::RW_ASS, OFF, 0, ACS_TABLE_SAFE_TRANS_0.second); - CHK(ss->addTable(&ACS_TABLE_SAFE_TRANS_0.second, ACS_TABLE_SAFE_TRANS_0.first, false, true), - ctxc); + check(ss->addTable(&ACS_TABLE_SAFE_TRANS_0.second, ACS_TABLE_SAFE_TRANS_0.first, false, true), + ctxc); // Build SAFE transition 1 iht(objects::ACS_CONTROLLER, acs::CtrlModes::SAFE, 0, ACS_TABLE_SAFE_TRANS_1.second); - CHK(ss->addTable(&ACS_TABLE_SAFE_TRANS_1.second, ACS_TABLE_SAFE_TRANS_1.first, false, true), - ctxc); + check(ss->addTable(&ACS_TABLE_SAFE_TRANS_1.second, ACS_TABLE_SAFE_TRANS_1.first, false, true), + ctxc); // Build SAFE sequence ihs(ACS_SEQUENCE_SAFE.second, ACS_TABLE_SAFE_TGT.first, 0, true); ihs(ACS_SEQUENCE_SAFE.second, ACS_TABLE_SAFE_TRANS_0.first, 0, false); ihs(ACS_SEQUENCE_SAFE.second, ACS_TABLE_SAFE_TRANS_1.first, 0, false); - CHK(ss->addSequence(&ACS_SEQUENCE_SAFE.second, ACS_SEQUENCE_SAFE.first, ACS_SEQUENCE_OFF.first, - false, true), - ctxc); + check(ss->addSequence(&ACS_SEQUENCE_SAFE.second, ACS_SEQUENCE_SAFE.first, ACS_SEQUENCE_OFF.first, + false, true), + ctxc); } void buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) { @@ -186,7 +186,7 @@ void buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, @@ -194,15 +194,15 @@ void buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Build DETUMBLE target iht(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TGT.second); iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); - CHK(ss->addTable(&ACS_TABLE_DETUMBLE_TGT.second, ACS_TABLE_DETUMBLE_TGT.first, false, true), - ctxc); + check(ss->addTable(&ACS_TABLE_DETUMBLE_TGT.second, ACS_TABLE_DETUMBLE_TGT.first, false, true), + ctxc); // Build DETUMBLE transition 0 iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); @@ -210,23 +210,23 @@ void buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); iht(objects::RW_ASS, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); - CHK(ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_0.second, ACS_TABLE_DETUMBLE_TRANS_0.first, false, - true), - ctxc); + check(ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_0.second, ACS_TABLE_DETUMBLE_TRANS_0.first, false, + true), + ctxc); // Build DETUMBLE transition 1 iht(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TRANS_1.second); - CHK(ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_1.second, ACS_TABLE_DETUMBLE_TRANS_1.first, false, - true), - ctxc); + check(ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_1.second, ACS_TABLE_DETUMBLE_TRANS_1.first, false, + true), + ctxc); // Build DETUMBLE sequence ihs(ACS_SEQUENCE_DETUMBLE.second, ACS_TABLE_DETUMBLE_TGT.first, 0, true); ihs(ACS_SEQUENCE_DETUMBLE.second, ACS_TABLE_DETUMBLE_TRANS_0.first, 0, false); ihs(ACS_SEQUENCE_DETUMBLE.second, ACS_TABLE_DETUMBLE_TRANS_1.first, 0, false); - CHK(ss->addSequence(&ACS_SEQUENCE_DETUMBLE.second, ACS_SEQUENCE_DETUMBLE.first, - ACS_SEQUENCE_SAFE.first, false, true), - ctxc); + check(ss->addSequence(&ACS_SEQUENCE_DETUMBLE.second, ACS_SEQUENCE_DETUMBLE.first, + ACS_SEQUENCE_SAFE.first, false, true), + ctxc); } void buildIdleSequence(Subsystem* ss, ModeListEntry& eh) { @@ -238,7 +238,7 @@ void buildIdleSequence(Subsystem* ss, ModeListEntry& eh) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, @@ -246,7 +246,7 @@ void buildIdleSequence(Subsystem* ss, ModeListEntry& eh) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Build IDLE target iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, 0, ACS_TABLE_IDLE_TGT.second); @@ -285,7 +285,7 @@ void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& eh) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, @@ -293,7 +293,7 @@ void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& eh) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Build IDLE target iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, acs::IDLE_CHARGE, @@ -301,8 +301,8 @@ void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_IDLE_CHRG_TGT.second); iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_CHRG_TGT.second); iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_CHRG_TGT.second); - CHK(ss->addTable(&ACS_TABLE_IDLE_CHRG_TGT.second, ACS_TABLE_IDLE_CHRG_TGT.first, false, true), - ctxc); + check(ss->addTable(&ACS_TABLE_IDLE_CHRG_TGT.second, ACS_TABLE_IDLE_CHRG_TGT.first, false, true), + ctxc); // Build IDLE transition 0 iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_IDLE_CHRG_TRANS_0.second); @@ -310,24 +310,24 @@ void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_CHRG_TRANS_0.second); iht(objects::RW_ASS, OFF, 0, ACS_TABLE_IDLE_CHRG_TRANS_0.second); iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_IDLE_CHRG_TRANS_0.second); - CHK(ss->addTable(&ACS_TABLE_IDLE_CHRG_TRANS_0.second, ACS_TABLE_IDLE_CHRG_TRANS_0.first, false, - true), - ctxc); + check(ss->addTable(&ACS_TABLE_IDLE_CHRG_TRANS_0.second, ACS_TABLE_IDLE_CHRG_TRANS_0.first, false, + true), + ctxc); // Build IDLE transition 1 iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, acs::IDLE_CHARGE, ACS_TABLE_IDLE_CHRG_TRANS_1.second); - CHK(ss->addTable(&ACS_TABLE_IDLE_CHRG_TRANS_1.second, ACS_TABLE_IDLE_CHRG_TRANS_1.first, false, - true), - ctxc); + check(ss->addTable(&ACS_TABLE_IDLE_CHRG_TRANS_1.second, ACS_TABLE_IDLE_CHRG_TRANS_1.first, false, + true), + ctxc); // Build IDLE sequence ihs(ACS_SEQUENCE_IDLE_CHRG.second, ACS_TABLE_IDLE_CHRG_TGT.first, 0, true); ihs(ACS_SEQUENCE_IDLE_CHRG.second, ACS_TABLE_IDLE_CHRG_TRANS_0.first, 0, true); ihs(ACS_SEQUENCE_IDLE_CHRG.second, ACS_TABLE_IDLE_CHRG_TRANS_1.first, 0, false); - CHK(ss->addSequence(&ACS_SEQUENCE_IDLE_CHRG.second, ACS_SEQUENCE_IDLE_CHRG.first, - ACS_SEQUENCE_SAFE.first, false, true), - ctxc); + check(ss->addSequence(&ACS_SEQUENCE_IDLE_CHRG.second, ACS_SEQUENCE_IDLE_CHRG.first, + ACS_SEQUENCE_SAFE.first, false, true), + ctxc); } void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) { @@ -339,7 +339,7 @@ void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, @@ -347,7 +347,7 @@ void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Build TARGET PT table @@ -357,8 +357,8 @@ void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_TARGET_PT_TGT.second); iht(objects::RW_ASS, NML, 0, ACS_TABLE_TARGET_PT_TGT.second); iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_TARGET_PT_TGT.second); - CHK(ss->addTable(&ACS_TABLE_TARGET_PT_TGT.second, ACS_TABLE_TARGET_PT_TGT.first, false, true), - ctxc); + check(ss->addTable(&ACS_TABLE_TARGET_PT_TGT.second, ACS_TABLE_TARGET_PT_TGT.first, false, true), + ctxc); // Build TARGET PT transition 0 iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second); @@ -366,29 +366,23 @@ void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second); iht(objects::RW_ASS, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second); iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second); - CHK(ss->addTable(&ACS_TABLE_TARGET_PT_TRANS_0.second, ACS_TABLE_TARGET_PT_TRANS_0.first, false, - true), - ctxc); + check(ss->addTable(&ACS_TABLE_TARGET_PT_TRANS_0.second, ACS_TABLE_TARGET_PT_TRANS_0.first, false, + true), + ctxc); // Build TARGET PT transition 1 iht(objects::ACS_CONTROLLER, acs::CtrlModes::TARGET_PT, 0, ACS_TABLE_TARGET_PT_TRANS_1.second); - CHK(ss->addTable(&ACS_TABLE_TARGET_PT_TRANS_1.second, ACS_TABLE_TARGET_PT_TRANS_1.first, false, - true), - ctxc); + check(ss->addTable(&ACS_TABLE_TARGET_PT_TRANS_1.second, ACS_TABLE_TARGET_PT_TRANS_1.first, false, + true), + ctxc); // Build IDLE sequence ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TGT.first, 0, true); ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TRANS_0.first, 0, true); ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TRANS_1.first, 0, false); - CHK(ss->addSequence(&ACS_SEQUENCE_TARGET_PT.second, ACS_SEQUENCE_TARGET_PT.first, - ACS_SEQUENCE_IDLE.first, false, true), - ctxc); -} - -void checkInsert(ReturnValue_t result, const char* ctx) { - if (result != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "Insertion failed at " << ctx << std::endl; - } + check(ss->addSequence(&ACS_SEQUENCE_TARGET_PT.second, ACS_SEQUENCE_TARGET_PT.first, + ACS_SEQUENCE_IDLE.first, false, true), + ctxc); } } // namespace diff --git a/mission/system/tree/payloadModeTree.cpp b/mission/system/tree/payloadModeTree.cpp index ad65230f..d5779120 100644 --- a/mission/system/tree/payloadModeTree.cpp +++ b/mission/system/tree/payloadModeTree.cpp @@ -9,9 +9,9 @@ #include "mission/devices/devicedefinitions/payloadPcduDefinitions.h" #include "mission/system/objects/PayloadSubsystem.h" #include "mission/system/objects/definitions.h" +#include "util.h" namespace { -void checkInsert(ReturnValue_t result, const char* ctx); void initOffSequence(Subsystem* ss, ModeListEntry& eh); void initPlMpsocStreamSequence(Subsystem* ss, ModeListEntry& eh); void initPlCamStreamSequence(Subsystem* ss, ModeListEntry& eh); @@ -20,7 +20,7 @@ void initEarthObsvSequence(Subsystem* ss, ModeListEntry& eh); void initScexSequence(Subsystem* ss, ModeListEntry& eh); } // namespace -const auto CHK = checkInsert; +const auto check = subsystem::checkInsert; static const auto OFF = HasModesIF::MODE_OFF; static const auto ON = HasModesIF::MODE_ON; static const auto NML = DeviceHandlerIF::MODE_NORMAL; @@ -95,7 +95,7 @@ void initOffSequence(Subsystem* ss, ModeListEntry& eh) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, @@ -103,11 +103,11 @@ void initOffSequence(Subsystem* ss, ModeListEntry& eh) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Build OFF target. Is empty - ss->addTable(&PL_TABLE_OFF_TGT.second, PL_TABLE_OFF_TGT.first, false, true); + check(ss->addTable(TableEntry(PL_TABLE_OFF_TGT.first, &PL_TABLE_OFF_TGT.second)), ctxc); // Build OFF transition 0 iht(objects::PLOC_SWITCHER, OFF, 0, PL_TABLE_OFF_TRANS.second); @@ -115,13 +115,14 @@ void initOffSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::SCEX_HANDLER, OFF, 0, PL_TABLE_OFF_TRANS.second); iht(objects::PLPCDU_HANDLER, OFF, 0, PL_TABLE_OFF_TRANS.second); iht(objects::PLOC_SUBSYSTEM, OFF, 0, PL_TABLE_OFF_TRANS.second); - ss->addTable(&PL_TABLE_OFF_TRANS.second, PL_TABLE_OFF_TRANS.first, false, true); + check(ss->addTable(TableEntry(PL_TABLE_OFF_TRANS.first, &PL_TABLE_OFF_TRANS.second)), ctxc); // Build OFF sequence ihs(PL_SEQUENCE_OFF.second, PL_TABLE_OFF_TGT.first, 0, false); ihs(PL_SEQUENCE_OFF.second, PL_TABLE_OFF_TRANS.first, 0, false); - ss->addSequence(&PL_SEQUENCE_OFF.second, PL_SEQUENCE_OFF.first, PL_SEQUENCE_OFF.first, false, - true); + check(ss->addSequence( + SequenceEntry(PL_SEQUENCE_OFF.first, &PL_SEQUENCE_OFF.second, PL_SEQUENCE_OFF.first)), + ctxc); } void initPlMpsocStreamSequence(Subsystem* ss, ModeListEntry& eh) { @@ -133,7 +134,7 @@ void initPlMpsocStreamSequence(Subsystem* ss, ModeListEntry& eh) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, @@ -141,7 +142,7 @@ void initPlMpsocStreamSequence(Subsystem* ss, ModeListEntry& eh) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Build MPSoC stream target @@ -150,26 +151,31 @@ void initPlMpsocStreamSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::PLOC_SWITCHER, ON, 0, PL_TABLE_MPSOC_STREAM_TGT.second); iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_MPSOC_STREAM_TGT.second); iht(objects::PLOC_SUBSYSTEM, NML, payload::ploc::MPSOC_ON, PL_TABLE_MPSOC_STREAM_TGT.second); - ss->addTable(&PL_TABLE_MPSOC_STREAM_TGT.second, PL_TABLE_MPSOC_STREAM_TGT.first, false, true); + check( + ss->addTable(TableEntry(PL_TABLE_MPSOC_STREAM_TGT.first, &PL_TABLE_MPSOC_STREAM_TGT.second)), + ctxc); // Build MPSoC stream transition 0 iht(objects::PLOC_SWITCHER, ON, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); iht(objects::SCEX_HANDLER, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); - ss->addTable(&PL_TABLE_MPSOC_STREAM_TRANS_0.second, PL_TABLE_MPSOC_STREAM_TRANS_0.first, false, - true); + check(ss->addTable( + TableEntry(PL_TABLE_MPSOC_STREAM_TRANS_0.first, &PL_TABLE_MPSOC_STREAM_TRANS_0.second)), + ctxc); // Build MPSoC stream transition 1 iht(objects::PLOC_SUBSYSTEM, NML, payload::ploc::MPSOC_ON, PL_TABLE_MPSOC_STREAM_TRANS_1.second); - ss->addTable(&PL_TABLE_MPSOC_STREAM_TRANS_1.second, PL_TABLE_MPSOC_STREAM_TRANS_1.first, false, - true); + check(ss->addTable( + TableEntry(PL_TABLE_MPSOC_STREAM_TRANS_1.first, &PL_TABLE_MPSOC_STREAM_TRANS_1.second)), + ctxc); // Build MPSoC stream sequence ihs(PL_SEQUENCE_MPSOC_STREAM.second, PL_TABLE_MPSOC_STREAM_TGT.first, 0, true); ihs(PL_SEQUENCE_MPSOC_STREAM.second, PL_TABLE_MPSOC_STREAM_TRANS_0.first, 0, true); ihs(PL_SEQUENCE_MPSOC_STREAM.second, PL_TABLE_MPSOC_STREAM_TRANS_1.first, 0, false); - ss->addSequence(&PL_SEQUENCE_MPSOC_STREAM.second, PL_SEQUENCE_MPSOC_STREAM.first, - PL_SEQUENCE_OFF.first, false, true); + check(ss->addSequence(SequenceEntry(PL_SEQUENCE_MPSOC_STREAM.first, + &PL_SEQUENCE_MPSOC_STREAM.second, PL_SEQUENCE_OFF.first)), + ctxc); } void initPlCamStreamSequence(Subsystem* ss, ModeListEntry& eh) { @@ -181,7 +187,7 @@ void initPlCamStreamSequence(Subsystem* ss, ModeListEntry& eh) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, @@ -189,34 +195,38 @@ void initPlCamStreamSequence(Subsystem* ss, ModeListEntry& eh) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Build CAM target // Only check that the PL PCDU is on for now. It might later become necessary to switch on // the PLOC, so we ignore its state. iht(objects::PLPCDU_HANDLER, NML, plpcdu::ALL_ON_SUBMODE, PL_TABLE_CAM_STREAM_TGT.second); - ss->addTable(&PL_TABLE_CAM_STREAM_TGT.second, PL_TABLE_CAM_STREAM_TGT.first, false, true); + check(ss->addTable(TableEntry(PL_TABLE_CAM_STREAM_TGT.first, &PL_TABLE_CAM_STREAM_TGT.second)), + ctxc); // Build CAM transition 0 // PLOC is actively commanded off here iht(objects::PLOC_SUBSYSTEM, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); iht(objects::CAM_SWITCHER, ON, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); iht(objects::SCEX_HANDLER, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); - ss->addTable(&PL_TABLE_MPSOC_STREAM_TRANS_0.second, PL_TABLE_MPSOC_STREAM_TRANS_0.first, false, - true); + check(ss->addTable( + TableEntry(PL_TABLE_MPSOC_STREAM_TRANS_0.first, &PL_TABLE_MPSOC_STREAM_TRANS_0.second)), + ctxc); // Build CAM transition 1 iht(objects::PLOC_SWITCHER, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_1.second); - ss->addTable(&PL_TABLE_MPSOC_STREAM_TRANS_1.second, PL_TABLE_MPSOC_STREAM_TRANS_1.first, false, - true); + check(ss->addTable( + TableEntry(PL_TABLE_MPSOC_STREAM_TRANS_1.first, &PL_TABLE_MPSOC_STREAM_TRANS_1.second)), + ctxc); // Build CAM stream sequence ihs(PL_SEQUENCE_CAM_STREAM.second, PL_TABLE_CAM_STREAM_TGT.first, 0, true); ihs(PL_SEQUENCE_CAM_STREAM.second, PL_TABLE_CAM_STREAM_TRANS_0.first, 0, true); ihs(PL_SEQUENCE_CAM_STREAM.second, PL_TABLE_CAM_STREAM_TRANS_1.first, 0, false); - ss->addSequence(&PL_SEQUENCE_CAM_STREAM.second, PL_SEQUENCE_CAM_STREAM.first, - PL_SEQUENCE_OFF.first, false, true); + check(ss->addSequence(SequenceEntry(PL_SEQUENCE_CAM_STREAM.first, &PL_SEQUENCE_CAM_STREAM.second, + PL_SEQUENCE_OFF.first)), + ctxc); } void initPlSpvSequence(Subsystem* ss, ModeListEntry& eh) { @@ -228,7 +238,7 @@ void initPlSpvSequence(Subsystem* ss, ModeListEntry& eh) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, @@ -236,18 +246,21 @@ void initPlSpvSequence(Subsystem* ss, ModeListEntry& eh) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Build Payload Supervisor Only target iht(objects::PLOC_SWITCHER, ON, 0, PL_TABLE_SUPV_ONLY_TGT.second); iht(objects::PLOC_SUBSYSTEM, NML, payload::ploc::SUPV_ONLY, PL_TABLE_SUPV_ONLY_TGT.second); - ss->addTable(TableEntry(PL_TABLE_SUPV_ONLY_TGT.first, &PL_TABLE_SUPV_ONLY_TGT.second)); + check(ss->addTable(TableEntry(PL_TABLE_SUPV_ONLY_TGT.first, &PL_TABLE_SUPV_ONLY_TGT.second)), + ctxc); // Build Payload Supervisor Only transition 0 iht(objects::PLOC_SWITCHER, ON, 0, PL_TABLE_SUPV_ONLY_TRANS_0.second); iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_SUPV_ONLY_TRANS_0.second); - ss->addTable(TableEntry(PL_TABLE_SUPV_ONLY_TRANS_0.first, &PL_TABLE_SUPV_ONLY_TRANS_0.second)); + check(ss->addTable( + TableEntry(PL_TABLE_SUPV_ONLY_TRANS_0.first, &PL_TABLE_SUPV_ONLY_TRANS_0.second)), + ctxc); // Build Payload Supervisor Only transition 1 iht(objects::PLOC_SUBSYSTEM, NML, payload::ploc::SUPV_ONLY, PL_TABLE_SUPV_ONLY_TRANS_1.second); @@ -256,8 +269,9 @@ void initPlSpvSequence(Subsystem* ss, ModeListEntry& eh) { ihs(PL_SEQUENCE_SUPV_ONLY.second, PL_TABLE_SUPV_ONLY_TGT.first, 0, true); ihs(PL_SEQUENCE_SUPV_ONLY.second, PL_TABLE_SUPV_ONLY_TRANS_0.first, 0, true); ihs(PL_SEQUENCE_SUPV_ONLY.second, PL_TABLE_SUPV_ONLY_TRANS_1.first, 0, false); - ss->addSequence(SequenceEntry(PL_SEQUENCE_SUPV_ONLY.first, &PL_SEQUENCE_SUPV_ONLY.second, - PL_SEQUENCE_OFF.first)); + check(ss->addSequence(SequenceEntry(PL_SEQUENCE_SUPV_ONLY.first, &PL_SEQUENCE_SUPV_ONLY.second, + PL_SEQUENCE_OFF.first)), + ctxc); } void initEarthObsvSequence(Subsystem* ss, ModeListEntry& eh) { @@ -269,7 +283,7 @@ void initEarthObsvSequence(Subsystem* ss, ModeListEntry& eh) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, @@ -277,7 +291,7 @@ void initEarthObsvSequence(Subsystem* ss, ModeListEntry& eh) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Build Earth Observation target @@ -285,23 +299,29 @@ void initEarthObsvSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::CAM_SWITCHER, ON, 0, PL_TABLE_EARTH_OBSV_TGT.second); iht(objects::PLPCDU_HANDLER, OFF, 0, PL_TABLE_EARTH_OBSV_TGT.second); iht(objects::PLOC_SUBSYSTEM, NML, payload::ploc::MPSOC_ON, PL_TABLE_EARTH_OBSV_TGT.second); - ss->addTable(TableEntry(PL_TABLE_EARTH_OBSV_TGT.first, &PL_TABLE_EARTH_OBSV_TGT.second)); + check(ss->addTable(TableEntry(PL_TABLE_EARTH_OBSV_TGT.first, &PL_TABLE_EARTH_OBSV_TGT.second)), + ctxc); // Build Earth Observation transition 0 iht(objects::PLOC_SWITCHER, ON, 0, PL_TABLE_EARTH_OBSV_TRANS_0.second); iht(objects::CAM_SWITCHER, ON, 0, PL_TABLE_EARTH_OBSV_TRANS_0.second); iht(objects::PLPCDU_HANDLER, OFF, 0, PL_TABLE_EARTH_OBSV_TRANS_0.second); - ss->addTable(TableEntry(PL_TABLE_EARTH_OBSV_TRANS_0.first, &PL_TABLE_EARTH_OBSV_TRANS_0.second)); + check(ss->addTable( + TableEntry(PL_TABLE_EARTH_OBSV_TRANS_0.first, &PL_TABLE_EARTH_OBSV_TRANS_0.second)), + ctxc); // Build Earth Observation transition 1 iht(objects::PLOC_SUBSYSTEM, NML, payload::ploc::MPSOC_ON, PL_TABLE_EARTH_OBSV_TRANS_1.second); - ss->addTable(TableEntry(PL_TABLE_EARTH_OBSV_TRANS_1.first, &PL_TABLE_EARTH_OBSV_TRANS_1.second)); + check(ss->addTable( + TableEntry(PL_TABLE_EARTH_OBSV_TRANS_1.first, &PL_TABLE_EARTH_OBSV_TRANS_1.second)), + ctxc); ihs(PL_SEQUENCE_EARTH_OBSV.second, PL_TABLE_EARTH_OBSV_TGT.first, 0, true); ihs(PL_SEQUENCE_EARTH_OBSV.second, PL_TABLE_EARTH_OBSV_TRANS_0.first, 0, true); ihs(PL_SEQUENCE_EARTH_OBSV.second, PL_TABLE_EARTH_OBSV_TRANS_1.first, 0, false); - ss->addSequence(SequenceEntry(PL_SEQUENCE_EARTH_OBSV.first, &PL_SEQUENCE_EARTH_OBSV.second, - PL_SEQUENCE_OFF.first)); + check(ss->addSequence(SequenceEntry(PL_SEQUENCE_EARTH_OBSV.first, &PL_SEQUENCE_EARTH_OBSV.second, + PL_SEQUENCE_OFF.first)), + ctxc); } void initScexSequence(Subsystem* ss, ModeListEntry& eh) { @@ -313,7 +333,7 @@ void initScexSequence(Subsystem* ss, ModeListEntry& eh) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, @@ -321,28 +341,24 @@ void initScexSequence(Subsystem* ss, ModeListEntry& eh) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Build SCEX target iht(objects::SCEX_HANDLER, NML, 0, PL_TABLE_SCEX_TGT.second); - ss->addTable(TableEntry(PL_TABLE_EARTH_OBSV_TGT.first, &PL_TABLE_EARTH_OBSV_TGT.second)); + check(ss->addTable(TableEntry(PL_TABLE_EARTH_OBSV_TGT.first, &PL_TABLE_EARTH_OBSV_TGT.second)), + ctxc); // Build SCEX transition 0 iht(objects::SCEX_HANDLER, NML, 0, PL_TABLE_SCEX_TGT.second); - ss->addTable(TableEntry(PL_TABLE_SCEX_TRANS_0.first, &PL_TABLE_SCEX_TRANS_0.second)); + check(ss->addTable(TableEntry(PL_TABLE_SCEX_TRANS_0.first, &PL_TABLE_SCEX_TRANS_0.second)), ctxc); // Build SCEX sequence ihs(PL_SEQUENCE_SCEX.second, PL_TABLE_SCEX_TGT.first, 0, true); ihs(PL_SEQUENCE_SCEX.second, PL_TABLE_SCEX_TRANS_0.first, 0, false); - ss->addSequence( - SequenceEntry(PL_SEQUENCE_SCEX.first, &PL_SEQUENCE_SCEX.second, PL_SEQUENCE_OFF.first)); -} - -void checkInsert(ReturnValue_t result, const char* ctx) { - if (result != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "satsystem::checkInsert: PL | Insertion failed at " << ctx << std::endl; - } + check(ss->addSequence( + SequenceEntry(PL_SEQUENCE_SCEX.first, &PL_SEQUENCE_SCEX.second, PL_SEQUENCE_OFF.first)), + ctxc); } } // namespace diff --git a/mission/system/tree/util.cpp b/mission/system/tree/util.cpp new file mode 100644 index 00000000..2a93efd8 --- /dev/null +++ b/mission/system/tree/util.cpp @@ -0,0 +1,9 @@ +#include "util.h" + +#include "fsfw/serviceinterface.h" + +void subsystem::checkInsert(ReturnValue_t result, const char* ctx) { + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "satsystem::checkInsert: Insertion failed at " << ctx << std::endl; + } +} diff --git a/mission/system/tree/util.h b/mission/system/tree/util.h new file mode 100644 index 00000000..5caf8e6d --- /dev/null +++ b/mission/system/tree/util.h @@ -0,0 +1,12 @@ +#ifndef MISSION_SYSTEM_TREE_UTIL_H_ +#define MISSION_SYSTEM_TREE_UTIL_H_ + +#include + +namespace subsystem { + +void checkInsert(ReturnValue_t result, const char* ctx); + +} + +#endif /* MISSION_SYSTEM_TREE_UTIL_H_ */ -- 2.43.0 From b49ed2bacf0501998cfa40069ad45a8ff16f7178 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 3 May 2022 16:03:57 +0200 Subject: [PATCH 05/17] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 7760b306..7f6c8b8b 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 7760b3063ee9249316edd1772384474676b062b2 +Subproject commit 7f6c8b8b123a63546de0d73f0de35900d6c806bf -- 2.43.0 From c86e000f09a6bc0e4a947b02d37c42a408863046 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 25 May 2022 10:25:40 +0200 Subject: [PATCH 06/17] Update PL SS --- bsp_q7s/core/ObjectFactory.cpp | 110 ++++----------------------------- bsp_q7s/fmObjectFactory.cpp | 4 +- common/config/commonObjects.h | 1 + 3 files changed, 14 insertions(+), 101 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 1bf763d2..81a28291 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -36,15 +36,12 @@ #include "linux/obc/PdecHandler.h" #include "linux/obc/Ptme.h" #include "linux/obc/PtmeConfig.h" +#include "mission/system/objects/RwAssembly.h" #include "mission/system/fdir/AcsBoardFdir.h" #include "mission/system/fdir/GomspacePowerFdir.h" #include "mission/system/fdir/RtdFdir.h" #include "mission/system/fdir/SusFdir.h" #include "mission/system/fdir/SyrlinksFdir.h" -#include "mission/system/objects/RwAssembly.h" -#include "mission/system/objects/SusAssembly.h" -#include "mission/system/objects/TcsBoardAssembly.h" -#include "mission/system/tree/system.h" #include "tmtc/apid.h" #include "tmtc/pusIds.h" #if OBSW_TEST_LIBGPIOD == 1 @@ -96,10 +93,8 @@ #include "mission/tmtc/VirtualChannel.h" #include "mission/utility/TmFunnel.h" -ResetArgs RESET_ARGS_GNSS_0; -ResetArgs RESET_ARGS_GNSS_1; - -void ObjectFactory::setStatics() { Factory::setStaticFrameworkObjectIds(); } +ResetArgs resetArgsGnss0; +ResetArgs resetArgsGnss1; void Factory::setStaticFrameworkObjectIds() { PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR; @@ -124,90 +119,7 @@ void Factory::setStaticFrameworkObjectIds() { TmPacketBase::timeStamperId = objects::TIME_STAMPER; } -void ObjectFactory::produce(void* args) { - ObjectFactory::setStatics(); - ObjectFactory::produceGenericObjects(); - - LinuxLibgpioIF* gpioComIF = nullptr; - UartComIF* uartComIF = nullptr; - SpiComIF* spiComIF = nullptr; - I2cComIF* i2cComIF = nullptr; - PowerSwitchIF* pwrSwitcher = nullptr; - - createCommunicationInterfaces(&gpioComIF, &uartComIF, &spiComIF, &i2cComIF); - createTmpComponents(); - new CoreController(objects::CORE_CONTROLLER); - - gpioCallbacks::disableAllDecoder(gpioComIF); - createPcduComponents(gpioComIF, &pwrSwitcher); - createRadSensorComponent(gpioComIF); - createSunSensorComponents(gpioComIF, spiComIF, pwrSwitcher, q7s::SPI_DEFAULT_DEV); - -#if OBSW_ADD_ACS_BOARD == 1 - createAcsBoardComponents(gpioComIF, uartComIF, pwrSwitcher); -#endif - createHeaterComponents(); - createSolarArrayDeploymentComponents(); - createPlPcduComponents(gpioComIF, spiComIF, pwrSwitcher); -#if OBSW_ADD_SYRLINKS == 1 - createSyrlinksComponents(pwrSwitcher); -#endif /* OBSW_ADD_SYRLINKS == 1 */ - createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher); - createPayloadComponents(gpioComIF); - -#if OBSW_ADD_MGT == 1 - I2cCookie* imtqI2cCookie = - new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE, q7s::I2C_DEFAULT_DEV); - auto imtqHandler = new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie, - pcdu::Switches::PDU1_CH3_MGT_5V); - imtqHandler->setPowerSwitcher(pwrSwitcher); - static_cast(imtqHandler); -#if OBSW_TEST_IMTQ == 1 - imtqHandler->setStartUpImmediately(); - imtqHandler->setToGoToNormal(true); -#endif -#if OBSW_DEBUG_IMTQ == 1 - imtqHandler->setDebugMode(true); -#endif -#endif - createReactionWheelComponents(gpioComIF); - -#if OBSW_ADD_BPX_BATTERY_HANDLER == 1 - I2cCookie* bpxI2cCookie = new I2cCookie(addresses::BPX_BATTERY, 100, q7s::I2C_DEFAULT_DEV); - BpxBatteryHandler* bpxHandler = - new BpxBatteryHandler(objects::BPX_BATT_HANDLER, objects::I2C_COM_IF, bpxI2cCookie); - bpxHandler->setStartUpImmediately(); - bpxHandler->setToGoToNormalMode(true); -#if OBSW_DEBUG_BPX_BATT == 1 - bpxHandler->setDebugMode(true); -#endif -#endif - new FileSystemHandler(objects::FILE_SYSTEM_HANDLER); - -#if OBSW_ADD_STAR_TRACKER == 1 - UartCookie* starTrackerCookie = - new UartCookie(objects::STAR_TRACKER, q7s::UART_STAR_TRACKER_DEV, uart::STAR_TRACKER_BAUD, - startracker::MAX_FRAME_SIZE * 2 + 2, UartModes::NON_CANONICAL); - starTrackerCookie->setNoFixedSizeReply(); - StrHelper* strHelper = new StrHelper(objects::STR_HELPER); - auto starTracker = - new StarTrackerHandler(objects::STAR_TRACKER, objects::UART_COM_IF, starTrackerCookie, - strHelper, pcdu::PDU1_CH2_STAR_TRACKER_5V); - starTracker->setPowerSwitcher(pwrSwitcher); - -#endif /* OBSW_ADD_STAR_TRACKER == 1 */ -#if OBSW_USE_CCSDS_IP_CORE == 1 - createCcsdsComponents(gpioComIF); -#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */ - /* Test Task */ -#if OBSW_ADD_TEST_CODE == 1 - createTestComponents(gpioComIF); -#endif /* OBSW_ADD_TEST_CODE == 1 */ - new PlocUpdater(objects::PLOC_UPDATER); - new PlocMemoryDumper(objects::PLOC_MEMORY_DUMPER); - - satsystem::init(); -} +void ObjectFactory::setStatics() { Factory::setStaticFrameworkObjectIds(); } void ObjectFactory::createTmpComponents() { I2cCookie* i2cCookieTmp1075tcs1 = @@ -550,15 +462,15 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI #if OBSW_DEBUG_GPS == 1 debugGps = true; #endif - RESET_ARGS_GNSS_1.gnss1 = true; - RESET_ARGS_GNSS_1.gpioComIF = gpioComIF; - RESET_ARGS_GNSS_1.waitPeriodMs = 100; - RESET_ARGS_GNSS_0.gnss1 = false; - RESET_ARGS_GNSS_0.gpioComIF = gpioComIF; - RESET_ARGS_GNSS_0.waitPeriodMs = 100; + resetArgsGnss1.gnss1 = true; + resetArgsGnss1.gpioComIF = gpioComIF; + resetArgsGnss1.waitPeriodMs = 100; + resetArgsGnss0.gnss1 = false; + resetArgsGnss0.gpioComIF = gpioComIF; + resetArgsGnss0.waitPeriodMs = 100; auto gpsHandler0 = new GPSHyperionLinuxController(objects::GPS_CONTROLLER, objects::NO_OBJECT, debugGps); - gpsHandler0->setResetPinTriggerFunction(gps::triggerGpioResetPin, &RESET_ARGS_GNSS_0); + gpsHandler0->setResetPinTriggerFunction(gps::triggerGpioResetPin, &resetArgsGnss0); AcsBoardHelper acsBoardHelper = AcsBoardHelper( objects::MGM_0_LIS3_HANDLER, objects::MGM_1_RM3100_HANDLER, objects::MGM_2_LIS3_HANDLER, diff --git a/bsp_q7s/fmObjectFactory.cpp b/bsp_q7s/fmObjectFactory.cpp index d81d6fe9..747d3871 100644 --- a/bsp_q7s/fmObjectFactory.cpp +++ b/bsp_q7s/fmObjectFactory.cpp @@ -8,7 +8,7 @@ #include "linux/ObjectFactory.h" #include "linux/callbacks/gpioCallbacks.h" #include "mission/core/GenericFactory.h" -#include "mission/system/tree/acsModeTree.h" +#include "mission/system/tree/system.h" void ObjectFactory::produce(void* args) { ObjectFactory::setStatics(); @@ -63,5 +63,5 @@ void ObjectFactory::produce(void* args) { #endif /* OBSW_ADD_TEST_CODE == 1 */ createMiscComponents(); - satsystem::initAcsSubsystem(); + satsystem::init(); } diff --git a/common/config/commonObjects.h b/common/config/commonObjects.h index 4dac8cec..25b83e80 100644 --- a/common/config/commonObjects.h +++ b/common/config/commonObjects.h @@ -57,6 +57,7 @@ enum commonObjects : uint32_t { PLOC_MPSOC_HANDLER = 0x44330015, PLOC_SUPERVISOR_HANDLER = 0x44330016, PLOC_SUPERVISOR_HELPER = 0x44330017, + SCEX_HANDLER = 0x44400000, SOLAR_ARRAY_DEPL_HANDLER = 0x444100A2, HEATER_HANDLER = 0x444100A4, -- 2.43.0 From aa86bc722f0aecc8deee2fbafa2b713d20a64f73 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 29 Aug 2022 15:56:18 +0200 Subject: [PATCH 07/17] retval corrections --- bsp_q7s/core/InitMission.cpp | 2 +- mission/system/tree/payloadModeTree.cpp | 2 +- mission/system/tree/util.cpp | 2 +- mission/system/tree/util.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index 3aed9bd8..01662b59 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -160,7 +160,7 @@ void initmission::initTasks() { } #endif result = sysTask->addComponent(objects::ACS_SUBSYSTEM); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { initmission::printAddObjectError("ACS_SUBSYSTEM", objects::ACS_SUBSYSTEM); } diff --git a/mission/system/tree/payloadModeTree.cpp b/mission/system/tree/payloadModeTree.cpp index d5779120..cafcd6e3 100644 --- a/mission/system/tree/payloadModeTree.cpp +++ b/mission/system/tree/payloadModeTree.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include "mission/devices/devicedefinitions/payloadPcduDefinitions.h" diff --git a/mission/system/tree/util.cpp b/mission/system/tree/util.cpp index 2a93efd8..176728eb 100644 --- a/mission/system/tree/util.cpp +++ b/mission/system/tree/util.cpp @@ -3,7 +3,7 @@ #include "fsfw/serviceinterface.h" void subsystem::checkInsert(ReturnValue_t result, const char* ctx) { - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "satsystem::checkInsert: Insertion failed at " << ctx << std::endl; } } diff --git a/mission/system/tree/util.h b/mission/system/tree/util.h index 5caf8e6d..da73e3bf 100644 --- a/mission/system/tree/util.h +++ b/mission/system/tree/util.h @@ -1,7 +1,7 @@ #ifndef MISSION_SYSTEM_TREE_UTIL_H_ #define MISSION_SYSTEM_TREE_UTIL_H_ -#include +#include namespace subsystem { -- 2.43.0 From ba70bde3e96945f8260280bde823b95deff98b21 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 3 Nov 2022 20:57:55 +0100 Subject: [PATCH 08/17] small fix --- mission/system/tree/acsModeTree.cpp | 15 --------------- mission/system/tree/payloadModeTree.cpp | 2 +- mission/system/tree/util.cpp | 10 +++++++++- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/mission/system/tree/acsModeTree.cpp b/mission/system/tree/acsModeTree.cpp index 32ced828..4e390985 100644 --- a/mission/system/tree/acsModeTree.cpp +++ b/mission/system/tree/acsModeTree.cpp @@ -16,7 +16,6 @@ namespace { // Alias for checker function const auto check = subsystem::checkInsert; -void checkInsert(ReturnValue_t result, const char* ctx); void buildOffSequence(Subsystem* ss, ModeListEntry& eh); void buildDetumbleSequence(Subsystem* ss, ModeListEntry& entryHelper); void buildSafeSequence(Subsystem* ss, ModeListEntry& entryHelper); @@ -25,7 +24,6 @@ void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& entryHelper); void buildTargetPtSequence(Subsystem* ss, ModeListEntry& entryHelper); } // namespace - static const auto OFF = HasModesIF::MODE_OFF; static const auto NML = DeviceHandlerIF::MODE_NORMAL; @@ -390,17 +388,4 @@ void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) { ctxc); } -void checkInsert(ReturnValue_t result, const char* ctx) { - if (result != returnvalue::OK) { - sif::warning << "satsystem::checkInsert: Insertion failed at " << ctx; - if (result == mapdefs::KEY_ALREADY_EXISTS) { - sif::warning << ": Key already exists" << std::endl; - } else if (result == mapdefs::MAP_FULL) { - sif::warning << ": Map full" << std::endl; - } else { - sif::warning << std::endl; - } - } -} - } // namespace diff --git a/mission/system/tree/payloadModeTree.cpp b/mission/system/tree/payloadModeTree.cpp index 95368822..f89bd41d 100644 --- a/mission/system/tree/payloadModeTree.cpp +++ b/mission/system/tree/payloadModeTree.cpp @@ -1,11 +1,11 @@ #include "payloadModeTree.h" -#include "eive/objects.h" #include #include #include #include +#include "eive/objects.h" #include "mission/devices/devicedefinitions/payloadPcduDefinitions.h" #include "mission/system/objects/PayloadSubsystem.h" #include "mission/system/objects/definitions.h" diff --git a/mission/system/tree/util.cpp b/mission/system/tree/util.cpp index 176728eb..92a752e7 100644 --- a/mission/system/tree/util.cpp +++ b/mission/system/tree/util.cpp @@ -1,9 +1,17 @@ #include "util.h" +#include "fsfw/container/FixedMap.h" #include "fsfw/serviceinterface.h" void subsystem::checkInsert(ReturnValue_t result, const char* ctx) { if (result != returnvalue::OK) { - sif::warning << "satsystem::checkInsert: Insertion failed at " << ctx << std::endl; + sif::warning << "satsystem::checkInsert: Insertion failed at " << ctx; + if (result == mapdefs::KEY_ALREADY_EXISTS) { + sif::warning << ": Key already exists" << std::endl; + } else if (result == mapdefs::MAP_FULL) { + sif::warning << ": Map full" << std::endl; + } else { + sif::warning << std::endl; + } } } -- 2.43.0 From fe6b13bb8136599005fa02cd2fd3967dc8246e0f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 3 Nov 2022 22:59:51 +0100 Subject: [PATCH 09/17] start fixing this crap --- bsp_q7s/core/InitMission.cpp | 23 ++++++++++-------- common/config/eive/objects.h | 2 -- mission/system/objects/CMakeLists.txt | 1 + mission/system/objects/CamSwitcher.cpp | 5 ++++ mission/system/objects/CamSwitcher.h | 13 ++++++++++ mission/system/tree/payloadModeTree.cpp | 32 +++++++++++++++---------- tmtc | 2 +- 7 files changed, 53 insertions(+), 25 deletions(-) create mode 100644 mission/system/objects/CamSwitcher.cpp create mode 100644 mission/system/objects/CamSwitcher.h diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index 4423a8fe..4a0dbeff 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -67,12 +67,6 @@ void initmission::initTasks() { void (*missedDeadlineFunc)(void) = nullptr; #endif - PeriodicTaskIF* sysCtrlTask = factory->createPeriodicTask( - "CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc); - result = sysCtrlTask->addComponent(objects::CORE_CONTROLLER); - if (result != returnvalue::OK) { - initmission::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER); - } #if OBSW_ADD_SA_DEPL == 1 // Could add this to the core controller but the core controller does so many thing that I would // prefer to have the solar array deployment in a seprate task. @@ -84,6 +78,17 @@ void initmission::initTasks() { } #endif + PeriodicTaskIF* sysTask = factory->createPeriodicTask( + "CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc); + result = sysTask->addComponent(objects::CORE_CONTROLLER); + if (result != returnvalue::OK) { + initmission::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER); + } + result = sysTask->addComponent(objects::PL_SUBSYSTEM); + if (result != returnvalue::OK) { + initmission::printAddObjectError("PL_SUBSYSTEM", objects::PL_SUBSYSTEM); + } + /* TMTC Distribution */ PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask( "DIST", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); @@ -127,9 +132,7 @@ void initmission::initTasks() { initmission::printAddObjectError("CCSDS Handler", objects::CCSDS_HANDLER); } - // Minimal distance between two received TCs amounts to 0.6 seconds - // If a command has not been read before the next one arrives, the old command will be - // overwritten by the PDEC. + // Runs in IRQ mode, frequency does not really matter PeriodicTaskIF* pdecHandlerTask = factory->createPeriodicTask( "PDEC_HANDLER", 75, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc); result = pdecHandlerTask->addComponent(objects::PDEC_HANDLER); @@ -321,7 +324,7 @@ void initmission::initTasks() { pdecHandlerTask->startTask(); #endif /* OBSW_ADD_CCSDS_IP_CORES == 1 */ - sysCtrlTask->startTask(); + sysTask->startTask(); #if OBSW_ADD_SA_DEPL == 1 solarArrayDeplTask->startTask(); #endif diff --git a/common/config/eive/objects.h b/common/config/eive/objects.h index 4aa03c7a..f0c06916 100644 --- a/common/config/eive/objects.h +++ b/common/config/eive/objects.h @@ -127,11 +127,9 @@ enum commonObjects : uint32_t { SUS_BOARD_ASS = 0x73000002, TCS_BOARD_ASS = 0x73000003, RW_ASS = 0x73000004, - PLOC_SWITCHER = 0x73000005, CAM_SWITCHER = 0x73000006, ACS_SUBSYSTEM = 0x73010001, PL_SUBSYSTEM = 0x73010002, - PLOC_SUBSYSTEM = 0x73010003, EIVE_SYSTEM = 0x73010000, CFDP_HANDLER = 0x73000005, CFDP_DISTRIBUTOR = 0x73000006, diff --git a/mission/system/objects/CMakeLists.txt b/mission/system/objects/CMakeLists.txt index 39d7c800..23e97047 100644 --- a/mission/system/objects/CMakeLists.txt +++ b/mission/system/objects/CMakeLists.txt @@ -1,6 +1,7 @@ target_sources( ${LIB_EIVE_MISSION} PRIVATE EiveSystem.cpp + CamSwitcher.cpp AcsSubsystem.cpp ComSubsystem.cpp PayloadSubsystem.cpp diff --git a/mission/system/objects/CamSwitcher.cpp b/mission/system/objects/CamSwitcher.cpp new file mode 100644 index 00000000..459065ce --- /dev/null +++ b/mission/system/objects/CamSwitcher.cpp @@ -0,0 +1,5 @@ +#include "CamSwitcher.h" + +CamSwitcher::CamSwitcher(object_id_t objectId, PowerSwitchIF *pwrSwitcher, + power::Switch_t pwrSwitch) + : PowerSwitcherComponent(objectId, pwrSwitcher, pwrSwitch) {} diff --git a/mission/system/objects/CamSwitcher.h b/mission/system/objects/CamSwitcher.h new file mode 100644 index 00000000..c762d5da --- /dev/null +++ b/mission/system/objects/CamSwitcher.h @@ -0,0 +1,13 @@ +#ifndef MISSION_SYSTEM_OBJECTS_CAMSWITCHER_H_ +#define MISSION_SYSTEM_OBJECTS_CAMSWITCHER_H_ + +#include + +class CamSwitcher : public PowerSwitcherComponent { + public: + CamSwitcher(object_id_t objectId, PowerSwitchIF *pwrSwitcher, power::Switch_t pwrSwitch); + + private: +}; + +#endif /* MISSION_SYSTEM_OBJECTS_CAMSWITCHER_H_ */ diff --git a/mission/system/tree/payloadModeTree.cpp b/mission/system/tree/payloadModeTree.cpp index f89bd41d..0d4e4257 100644 --- a/mission/system/tree/payloadModeTree.cpp +++ b/mission/system/tree/payloadModeTree.cpp @@ -27,7 +27,8 @@ static const auto NML = DeviceHandlerIF::MODE_NORMAL; auto PL_SEQUENCE_OFF = std::make_pair(OFF << 24, FixedArrayList()); auto PL_TABLE_OFF_TGT = std::make_pair((OFF << 24) | 1, FixedArrayList()); -auto PL_TABLE_OFF_TRANS = std::make_pair((OFF << 24) | 2, FixedArrayList()); +auto PL_TABLE_OFF_TRANS_0 = std::make_pair((OFF << 24) | 2, FixedArrayList()); +auto PL_TABLE_OFF_TRANS_1 = std::make_pair((OFF << 24) | 3, FixedArrayList()); auto PL_SEQUENCE_MPSOC_STREAM = std::make_pair(payload::Modes::MPSOC_STREAM << 24, FixedArrayList()); @@ -110,16 +111,21 @@ void initOffSequence(Subsystem* ss, ModeListEntry& eh) { check(ss->addTable(TableEntry(PL_TABLE_OFF_TGT.first, &PL_TABLE_OFF_TGT.second)), ctxc); // Build OFF transition 0 - iht(objects::PLOC_SWITCHER, OFF, 0, PL_TABLE_OFF_TRANS.second); - iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_OFF_TRANS.second); - iht(objects::SCEX, OFF, 0, PL_TABLE_OFF_TRANS.second); - iht(objects::PLPCDU_HANDLER, OFF, 0, PL_TABLE_OFF_TRANS.second); - iht(objects::PLOC_SUBSYSTEM, OFF, 0, PL_TABLE_OFF_TRANS.second); - check(ss->addTable(TableEntry(PL_TABLE_OFF_TRANS.first, &PL_TABLE_OFF_TRANS.second)), ctxc); + iht(objects::PLOC_SWITCHER, OFF, 0, PL_TABLE_OFF_TRANS_0.second); + iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_OFF_TRANS_0.second); + iht(objects::SCEX, OFF, 0, PL_TABLE_OFF_TRANS_0.second); + iht(objects::PLPCDU_HANDLER, OFF, 0, PL_TABLE_OFF_TRANS_0.second); + iht(objects::PLOC_MPSOC_HANDLER, OFF, 0, PL_TABLE_OFF_TRANS_0.second); + check(ss->addTable(TableEntry(PL_TABLE_OFF_TRANS_0.first, &PL_TABLE_OFF_TRANS_0.second)), ctxc); + + // Build OFF transition 1 + iht(objects::PLOC_SUPERVISOR_HANDLER, OFF, 0, PL_TABLE_OFF_TRANS_1.second); + check(ss->addTable(TableEntry(PL_TABLE_OFF_TRANS_1.first, &PL_TABLE_OFF_TRANS_1.second)), ctxc); // Build OFF sequence ihs(PL_SEQUENCE_OFF.second, PL_TABLE_OFF_TGT.first, 0, false); - ihs(PL_SEQUENCE_OFF.second, PL_TABLE_OFF_TRANS.first, 0, false); + ihs(PL_SEQUENCE_OFF.second, PL_TABLE_OFF_TRANS_0.first, 0, false); + ihs(PL_SEQUENCE_OFF.second, PL_TABLE_OFF_TRANS_1.first, 0, false); check(ss->addSequence( SequenceEntry(PL_SEQUENCE_OFF.first, &PL_SEQUENCE_OFF.second, PL_SEQUENCE_OFF.first)), ctxc); @@ -147,24 +153,26 @@ void initPlMpsocStreamSequence(Subsystem* ss, ModeListEntry& eh) { // Build MPSoC stream target // Camera should always be off to prevent a conflict with the MPSoC streaming + // PL PCDU must be on and in normal mode, but this is commanded separately because of the + // number of commands invovled iht(objects::PLPCDU_HANDLER, NML, plpcdu::ALL_ON_SUBMODE, PL_TABLE_MPSOC_STREAM_TGT.second); - iht(objects::PLOC_SWITCHER, ON, 0, PL_TABLE_MPSOC_STREAM_TGT.second); iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_MPSOC_STREAM_TGT.second); - iht(objects::PLOC_SUBSYSTEM, NML, payload::ploc::MPSOC_ON, PL_TABLE_MPSOC_STREAM_TGT.second); + iht(objects::PLOC_MPSOC_HANDLER, NML, 0, PL_TABLE_MPSOC_STREAM_TGT.second); + iht(objects::PLOC_SUPERVISOR_HANDLER, NML, 0, PL_TABLE_MPSOC_STREAM_TGT.second); check( ss->addTable(TableEntry(PL_TABLE_MPSOC_STREAM_TGT.first, &PL_TABLE_MPSOC_STREAM_TGT.second)), ctxc); // Build MPSoC stream transition 0 - iht(objects::PLOC_SWITCHER, ON, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); iht(objects::SCEX, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); + iht(objects::PLOC_SUPERVISOR_HANDLER, NML, 0, PL_TABLE_MPSOC_STREAM_TGT.second); check(ss->addTable( TableEntry(PL_TABLE_MPSOC_STREAM_TRANS_0.first, &PL_TABLE_MPSOC_STREAM_TRANS_0.second)), ctxc); // Build MPSoC stream transition 1 - iht(objects::PLOC_SUBSYSTEM, NML, payload::ploc::MPSOC_ON, PL_TABLE_MPSOC_STREAM_TRANS_1.second); + iht(objects::PLOC_MPSOC_HANDLER, NML, 0, PL_TABLE_MPSOC_STREAM_TGT.second); check(ss->addTable( TableEntry(PL_TABLE_MPSOC_STREAM_TRANS_1.first, &PL_TABLE_MPSOC_STREAM_TRANS_1.second)), ctxc); diff --git a/tmtc b/tmtc index f62c67a1..f6fab2d4 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit f62c67a11e54b99fdb60dab13e55456f16450951 +Subproject commit f6fab2d44aff98174835c8446fd69c1ff589521b -- 2.43.0 From c8ddf7472c923512f5a7537412504d626ca40382 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 4 Nov 2022 08:30:47 +0100 Subject: [PATCH 10/17] remove PLOC_SWITCHER and PLOC_SUBSYSTEM usage --- mission/system/tree/payloadModeTree.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/mission/system/tree/payloadModeTree.cpp b/mission/system/tree/payloadModeTree.cpp index 0d4e4257..89286947 100644 --- a/mission/system/tree/payloadModeTree.cpp +++ b/mission/system/tree/payloadModeTree.cpp @@ -58,9 +58,9 @@ auto PL_TABLE_SUPV_ONLY_TRANS_1 = std::make_pair((payload::Modes::SUPV_ONLY << 24) | 3, FixedArrayList()); auto PL_SEQUENCE_EARTH_OBSV = - std::make_pair(payload::Modes::EARTH_OBSV << 24, FixedArrayList()); + std::make_pair(payload::Modes::EARTH_OBSV << 24, FixedArrayList()); auto PL_TABLE_EARTH_OBSV_TGT = - std::make_pair((payload::Modes::EARTH_OBSV << 24) | 1, FixedArrayList()); + std::make_pair((payload::Modes::EARTH_OBSV << 24) | 1, FixedArrayList()); auto PL_TABLE_EARTH_OBSV_TRANS_0 = std::make_pair((payload::Modes::EARTH_OBSV << 24) | 2, FixedArrayList()); auto PL_TABLE_EARTH_OBSV_TRANS_1 = @@ -111,7 +111,6 @@ void initOffSequence(Subsystem* ss, ModeListEntry& eh) { check(ss->addTable(TableEntry(PL_TABLE_OFF_TGT.first, &PL_TABLE_OFF_TGT.second)), ctxc); // Build OFF transition 0 - iht(objects::PLOC_SWITCHER, OFF, 0, PL_TABLE_OFF_TRANS_0.second); iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_OFF_TRANS_0.second); iht(objects::SCEX, OFF, 0, PL_TABLE_OFF_TRANS_0.second); iht(objects::PLPCDU_HANDLER, OFF, 0, PL_TABLE_OFF_TRANS_0.second); @@ -215,7 +214,7 @@ void initPlCamStreamSequence(Subsystem* ss, ModeListEntry& eh) { // Build CAM transition 0 // PLOC is actively commanded off here - iht(objects::PLOC_SUBSYSTEM, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); + iht(objects::PLOC_MPSOC_HANDLER, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); iht(objects::CAM_SWITCHER, ON, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); iht(objects::SCEX, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); check(ss->addTable( @@ -223,7 +222,7 @@ void initPlCamStreamSequence(Subsystem* ss, ModeListEntry& eh) { ctxc); // Build CAM transition 1 - iht(objects::PLOC_SWITCHER, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_1.second); + iht(objects::PLOC_SUPERVISOR_HANDLER, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_1.second); check(ss->addTable( TableEntry(PL_TABLE_MPSOC_STREAM_TRANS_1.first, &PL_TABLE_MPSOC_STREAM_TRANS_1.second)), ctxc); @@ -258,20 +257,19 @@ void initPlSpvSequence(Subsystem* ss, ModeListEntry& eh) { }; // Build Payload Supervisor Only target - iht(objects::PLOC_SWITCHER, ON, 0, PL_TABLE_SUPV_ONLY_TGT.second); - iht(objects::PLOC_SUBSYSTEM, NML, payload::ploc::SUPV_ONLY, PL_TABLE_SUPV_ONLY_TGT.second); + iht(objects::PLOC_SUPERVISOR_HANDLER, NML, 0, PL_TABLE_SUPV_ONLY_TGT.second); check(ss->addTable(TableEntry(PL_TABLE_SUPV_ONLY_TGT.first, &PL_TABLE_SUPV_ONLY_TGT.second)), ctxc); // Build Payload Supervisor Only transition 0 - iht(objects::PLOC_SWITCHER, ON, 0, PL_TABLE_SUPV_ONLY_TRANS_0.second); + iht(objects::PLOC_SUPERVISOR_HANDLER, NML, 0, PL_TABLE_SUPV_ONLY_TRANS_0.second); iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_SUPV_ONLY_TRANS_0.second); check(ss->addTable( TableEntry(PL_TABLE_SUPV_ONLY_TRANS_0.first, &PL_TABLE_SUPV_ONLY_TRANS_0.second)), ctxc); // Build Payload Supervisor Only transition 1 - iht(objects::PLOC_SUBSYSTEM, NML, payload::ploc::SUPV_ONLY, PL_TABLE_SUPV_ONLY_TRANS_1.second); + iht(objects::PLOC_MPSOC_HANDLER, OFF, 0, PL_TABLE_SUPV_ONLY_TRANS_1.second); // Build Payload Supervisor Only Sequence ihs(PL_SEQUENCE_SUPV_ONLY.second, PL_TABLE_SUPV_ONLY_TGT.first, 0, true); @@ -303,15 +301,15 @@ void initEarthObsvSequence(Subsystem* ss, ModeListEntry& eh) { }; // Build Earth Observation target - iht(objects::PLOC_SWITCHER, ON, 0, PL_TABLE_EARTH_OBSV_TGT.second); + iht(objects::PLOC_MPSOC_HANDLER, NML, 0, PL_TABLE_EARTH_OBSV_TGT.second); + iht(objects::PLOC_SUPERVISOR_HANDLER, NML, 0, PL_TABLE_EARTH_OBSV_TGT.second); iht(objects::CAM_SWITCHER, ON, 0, PL_TABLE_EARTH_OBSV_TGT.second); iht(objects::PLPCDU_HANDLER, OFF, 0, PL_TABLE_EARTH_OBSV_TGT.second); - iht(objects::PLOC_SUBSYSTEM, NML, payload::ploc::MPSOC_ON, PL_TABLE_EARTH_OBSV_TGT.second); check(ss->addTable(TableEntry(PL_TABLE_EARTH_OBSV_TGT.first, &PL_TABLE_EARTH_OBSV_TGT.second)), ctxc); // Build Earth Observation transition 0 - iht(objects::PLOC_SWITCHER, ON, 0, PL_TABLE_EARTH_OBSV_TRANS_0.second); + iht(objects::PLOC_SUPERVISOR_HANDLER, NML, 0, PL_TABLE_EARTH_OBSV_TRANS_0.second); iht(objects::CAM_SWITCHER, ON, 0, PL_TABLE_EARTH_OBSV_TRANS_0.second); iht(objects::PLPCDU_HANDLER, OFF, 0, PL_TABLE_EARTH_OBSV_TRANS_0.second); check(ss->addTable( @@ -319,7 +317,7 @@ void initEarthObsvSequence(Subsystem* ss, ModeListEntry& eh) { ctxc); // Build Earth Observation transition 1 - iht(objects::PLOC_SUBSYSTEM, NML, payload::ploc::MPSOC_ON, PL_TABLE_EARTH_OBSV_TRANS_1.second); + iht(objects::PLOC_MPSOC_HANDLER, NML, 0, PL_TABLE_CAM_STREAM_TRANS_1.second); check(ss->addTable( TableEntry(PL_TABLE_EARTH_OBSV_TRANS_1.first, &PL_TABLE_EARTH_OBSV_TRANS_1.second)), ctxc); -- 2.43.0 From e3c245b99fa8d7aecb4bc04649733ff8446dd282 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 4 Nov 2022 08:37:59 +0100 Subject: [PATCH 11/17] update changelog --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91fbd0b5..348e7023 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,8 +10,9 @@ list yields a list of all related PRs for each release. # [unreleased] -- Add IRQ mode for PDEC handler - PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/310 +- ACS Subsystem. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/231 +- Payload Subsystem. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/231 +- Add IRQ mode for PDEC handler. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/310 - Extended TM funnels to allow multiple TM recipients. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/312 - DHB: Transitions to normal mode now possible directly, which simplifies subsystem implementations @@ -77,7 +78,6 @@ list yields a list of all related PRs for each release. ## Added -- ACS Subsystem. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/231 - Dummy components to run OBSW without relying on external hardware PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/266 - Basic Thermal Controller -- 2.43.0 From 47b65a1fa3c8d1207860cd1381e8c7f379f0f9b6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 10 Nov 2022 13:09:31 +0100 Subject: [PATCH 12/17] create cam switcher, create new PL task --- bsp_q7s/core/InitMission.cpp | 7 +++++++ bsp_q7s/core/ObjectFactory.cpp | 5 ++++- bsp_q7s/core/ObjectFactory.h | 2 +- bsp_q7s/fmObjectFactory.cpp | 4 ++-- mission/system/objects/CamSwitcher.cpp | 4 ++-- mission/system/objects/CamSwitcher.h | 2 +- 6 files changed, 17 insertions(+), 7 deletions(-) diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index 4a0dbeff..9740912a 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -278,6 +278,13 @@ void initmission::initTasks() { } #endif /* OBSW_ADD_PLOC_SUPERVISOR */ + PeriodicTaskIF* plTask = factory->createPeriodicTask( + "PL_TASK", 25, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc); + result = supvHelperTask->addComponent(objects::PLOC_SUPERVISOR_HELPER); + if (result != returnvalue::OK) { + initmission::printAddObjectError("PLOC_SUPV_HELPER", objects::PLOC_SUPERVISOR_HELPER); + } + #if OBSW_TEST_CCSDS_BRIDGE == 1 PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask( "PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 3f6b2ac6..13998027 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -1,5 +1,7 @@ #include "ObjectFactory.h" +#include + #include "OBSWConfig.h" #include "bsp_q7s/boardtest/Q7STestTask.h" #include "bsp_q7s/callbacks/gnssCallback.h" @@ -583,9 +585,10 @@ void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) { #endif } -void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) { +void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF& pwrSwitch) { using namespace gpio; std::stringstream consumer; + new CamSwitcher(objects::CAM_SWITCHER, pwrSwitch, pcdu::PDU2_CH8_PAYLOAD_CAMERA); #if OBSW_ADD_PLOC_MPSOC == 1 consumer << "0x" << std::hex << objects::PLOC_MPSOC_HANDLER; auto gpioConfigMPSoC = new GpiodRegularByLineName(q7s::gpioNames::ENABLE_MPSOC_UART, diff --git a/bsp_q7s/core/ObjectFactory.h b/bsp_q7s/core/ObjectFactory.h index 3737db92..40a4e2ed 100644 --- a/bsp_q7s/core/ObjectFactory.h +++ b/bsp_q7s/core/ObjectFactory.h @@ -38,7 +38,7 @@ void createBpxBatteryComponent(); void createStrComponents(PowerSwitchIF* pwrSwitcher); void createSolarArrayDeploymentComponents(PowerSwitchIF& pwrSwitcher, GpioIF& gpioIF); void createSyrlinksComponents(PowerSwitchIF* pwrSwitcher); -void createPayloadComponents(LinuxLibgpioIF* gpioComIF); +void createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF& pwrSwitcher); void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher); ReturnValue_t createCcsdsComponents(LinuxLibgpioIF* gpioComIF, CcsdsIpCoreHandler** ipCoreHandler); void createMiscComponents(); diff --git a/bsp_q7s/fmObjectFactory.cpp b/bsp_q7s/fmObjectFactory.cpp index ac5037ec..6ac2498a 100644 --- a/bsp_q7s/fmObjectFactory.cpp +++ b/bsp_q7s/fmObjectFactory.cpp @@ -49,7 +49,7 @@ void ObjectFactory::produce(void* args) { createSyrlinksComponents(pwrSwitcher); #endif /* OBSW_ADD_SYRLINKS == 1 */ createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher, spiMainComIF); - createPayloadComponents(gpioComIF); + createPayloadComponents(gpioComIF, *pwrSwitcher); #if OBSW_ADD_MGT == 1 createImtqComponents(pwrSwitcher); @@ -67,7 +67,7 @@ void ObjectFactory::produce(void* args) { CcsdsIpCoreHandler* ipCoreHandler = nullptr; createCcsdsComponents(gpioComIF, &ipCoreHandler); #if OBSW_TM_TO_PTME == 1 - ObjectFactory::addTmtcIpCoresToFunnels(*ipCoreHandler, *pusFunnel, *cfdpFunnel); + addTmtcIpCoresToFunnels(*ipCoreHandler, *pusFunnel, *cfdpFunnel); #endif #endif /* OBSW_ADD_CCSDS_IP_CORES == 1 */ diff --git a/mission/system/objects/CamSwitcher.cpp b/mission/system/objects/CamSwitcher.cpp index 459065ce..b995e211 100644 --- a/mission/system/objects/CamSwitcher.cpp +++ b/mission/system/objects/CamSwitcher.cpp @@ -1,5 +1,5 @@ #include "CamSwitcher.h" -CamSwitcher::CamSwitcher(object_id_t objectId, PowerSwitchIF *pwrSwitcher, +CamSwitcher::CamSwitcher(object_id_t objectId, PowerSwitchIF &pwrSwitcher, power::Switch_t pwrSwitch) - : PowerSwitcherComponent(objectId, pwrSwitcher, pwrSwitch) {} + : PowerSwitcherComponent(objectId, &pwrSwitcher, pwrSwitch) {} diff --git a/mission/system/objects/CamSwitcher.h b/mission/system/objects/CamSwitcher.h index c762d5da..672b884b 100644 --- a/mission/system/objects/CamSwitcher.h +++ b/mission/system/objects/CamSwitcher.h @@ -5,7 +5,7 @@ class CamSwitcher : public PowerSwitcherComponent { public: - CamSwitcher(object_id_t objectId, PowerSwitchIF *pwrSwitcher, power::Switch_t pwrSwitch); + CamSwitcher(object_id_t objectId, PowerSwitchIF &pwrSwitcher, power::Switch_t pwrSwitch); private: }; -- 2.43.0 From 07d93b6b671f97bf189719abe619c0af75dded83 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 10 Nov 2022 14:08:44 +0100 Subject: [PATCH 13/17] schedule PL components differently --- bsp_q7s/core/InitMission.cpp | 22 +++++++++---------- linux/InitMission.cpp | 13 +++++++++++ linux/InitMission.h | 4 +++- .../pollingSequenceFactory.cpp | 20 ----------------- 4 files changed, 26 insertions(+), 33 deletions(-) diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index 9740912a..bbeaded8 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -280,19 +280,9 @@ void initmission::initTasks() { PeriodicTaskIF* plTask = factory->createPeriodicTask( "PL_TASK", 25, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc); - result = supvHelperTask->addComponent(objects::PLOC_SUPERVISOR_HELPER); - if (result != returnvalue::OK) { - initmission::printAddObjectError("PLOC_SUPV_HELPER", objects::PLOC_SUPERVISOR_HELPER); - } + scheduling::addMpsocSupvHandlers(plTask); + plTask->addComponent(objects::CAM_SWITCHER); -#if OBSW_TEST_CCSDS_BRIDGE == 1 - PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask( - "PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); - result = ptmeTestTask->addComponent(objects::CCSDS_IP_CORE_BRIDGE); - if (result != returnvalue::OK) { - initmission::printAddObjectError("PTME_TEST", objects::CCSDS_IP_CORE_BRIDGE); - } -#endif #if OBSW_ADD_SCEX_DEVICE == 1 PeriodicTaskIF* scexDevHandler; PeriodicTaskIF* scexReaderTask; @@ -305,6 +295,14 @@ void initmission::initTasks() { createPstTasks(*factory, missedDeadlineFunc, pstTasks); #if OBSW_ADD_TEST_CODE == 1 +#if OBSW_TEST_CCSDS_BRIDGE == 1 + PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask( + "PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); + result = ptmeTestTask->addComponent(objects::CCSDS_IP_CORE_BRIDGE); + if (result != returnvalue::OK) { + initmission::printAddObjectError("PTME_TEST", objects::CCSDS_IP_CORE_BRIDGE); + } +#endif std::vector testTasks; createTestTasks(*factory, missedDeadlineFunc, testTasks); #endif diff --git a/linux/InitMission.cpp b/linux/InitMission.cpp index eb8f677a..b433e4aa 100644 --- a/linux/InitMission.cpp +++ b/linux/InitMission.cpp @@ -45,3 +45,16 @@ void scheduling::schedulingScex(TaskFactory& factory, PeriodicTaskIF*& scexDevHa printAddObjectError("SCEX_UART_READER", objects::SCEX_UART_READER); } } + +void scheduling::addMpsocSupvHandlers(PeriodicTaskIF* plTask) { + plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::PERFORM_OPERATION); + plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::SEND_READ); + plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::GET_READ); + plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::SEND_WRITE); + plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::GET_WRITE); + plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::PERFORM_OPERATION); + plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::SEND_READ); + plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::GET_READ); + plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::SEND_WRITE); + plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::GET_WRITE); +} diff --git a/linux/InitMission.h b/linux/InitMission.h index e5a3afff..dd809ff7 100644 --- a/linux/InitMission.h +++ b/linux/InitMission.h @@ -4,4 +4,6 @@ namespace scheduling { void schedulingScex(TaskFactory& factory, PeriodicTaskIF*& scexDevHandler, PeriodicTaskIF*& scexReaderTask); -} +void addMpsocSupvHandlers(PeriodicTaskIF* task); + +} // namespace scheduling diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index f0a1c2fb..e7f753bd 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -461,26 +461,6 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) { // Length of a communication cycle uint32_t length = thisSequence->getPeriodMs(); static_cast(length); -#if OBSW_ADD_PLOC_MPSOC == 1 - thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::PLOC_MEMORY_DUMPER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); -#endif - -#if OBSW_ADD_PLOC_SUPERVISOR == 1 - thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); -#endif #if OBSW_ADD_SYRLINKS == 1 thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0, -- 2.43.0 From 76ca81b99747d840c45bbe1cb18f2b13e13bfc31 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 10 Nov 2022 14:12:09 +0100 Subject: [PATCH 14/17] wrap in preproc defines --- linux/InitMission.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/linux/InitMission.cpp b/linux/InitMission.cpp index b433e4aa..5bc8698c 100644 --- a/linux/InitMission.cpp +++ b/linux/InitMission.cpp @@ -47,14 +47,19 @@ void scheduling::schedulingScex(TaskFactory& factory, PeriodicTaskIF*& scexDevHa } void scheduling::addMpsocSupvHandlers(PeriodicTaskIF* plTask) { +#if OBSW_ADD_PLOC_SUPERVISOR == 1 plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::PERFORM_OPERATION); plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::SEND_READ); plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::GET_READ); plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::SEND_WRITE); plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::GET_WRITE); +#endif + +#if OBSW_ADD_PLOC_MPSOC == 1 plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::PERFORM_OPERATION); plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::SEND_READ); plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::GET_READ); plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::SEND_WRITE); plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::GET_WRITE); +#endif } -- 2.43.0 From 4c0bf18268ed9e5b6b871ebc47773b5d522df7ab Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 10 Nov 2022 14:18:58 +0100 Subject: [PATCH 15/17] fix for object IDs --- common/config/eive/objects.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/config/eive/objects.h b/common/config/eive/objects.h index f0c06916..5b9ec8a0 100644 --- a/common/config/eive/objects.h +++ b/common/config/eive/objects.h @@ -131,11 +131,11 @@ enum commonObjects : uint32_t { ACS_SUBSYSTEM = 0x73010001, PL_SUBSYSTEM = 0x73010002, EIVE_SYSTEM = 0x73010000, - CFDP_HANDLER = 0x73000005, - CFDP_DISTRIBUTOR = 0x73000006, TM_FUNNEL = 0x73000100, PUS_TM_FUNNEL = 0x73000101, CFDP_TM_FUNNEL = 0x73000102, + CFDP_HANDLER = 0x73000205, + CFDP_DISTRIBUTOR = 0x73000206, }; } -- 2.43.0 From f90120191f6544d2e58a01588fe9468e7c41f414 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 10 Nov 2022 15:12:50 +0100 Subject: [PATCH 16/17] pl ss fixes --- fsfw | 2 +- mission/system/tree/payloadModeTree.cpp | 41 +++++++++++++------------ mission/system/tree/util.cpp | 6 ++-- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/fsfw b/fsfw index 0e8f5ddd..530a261e 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 0e8f5ddd26d586dd40e69f52aef1a63c0d5a9da6 +Subproject commit 530a261e142ae4ab2c7726303e4d571d03200e47 diff --git a/mission/system/tree/payloadModeTree.cpp b/mission/system/tree/payloadModeTree.cpp index 89286947..ea339b74 100644 --- a/mission/system/tree/payloadModeTree.cpp +++ b/mission/system/tree/payloadModeTree.cpp @@ -25,31 +25,31 @@ static const auto OFF = HasModesIF::MODE_OFF; static const auto ON = HasModesIF::MODE_ON; static const auto NML = DeviceHandlerIF::MODE_NORMAL; -auto PL_SEQUENCE_OFF = std::make_pair(OFF << 24, FixedArrayList()); +auto PL_SEQUENCE_OFF = std::make_pair(OFF << 24, FixedArrayList()); auto PL_TABLE_OFF_TGT = std::make_pair((OFF << 24) | 1, FixedArrayList()); auto PL_TABLE_OFF_TRANS_0 = std::make_pair((OFF << 24) | 2, FixedArrayList()); auto PL_TABLE_OFF_TRANS_1 = std::make_pair((OFF << 24) | 3, FixedArrayList()); auto PL_SEQUENCE_MPSOC_STREAM = - std::make_pair(payload::Modes::MPSOC_STREAM << 24, FixedArrayList()); + std::make_pair(payload::Modes::MPSOC_STREAM << 24, FixedArrayList()); auto PL_TABLE_MPSOC_STREAM_TGT = - std::make_pair((payload::Modes::MPSOC_STREAM << 24) | 1, FixedArrayList()); + std::make_pair((payload::Modes::MPSOC_STREAM << 24) | 1, FixedArrayList()); auto PL_TABLE_MPSOC_STREAM_TRANS_0 = - std::make_pair((payload::Modes::MPSOC_STREAM << 24) | 2, FixedArrayList()); + std::make_pair((payload::Modes::MPSOC_STREAM << 24) | 2, FixedArrayList()); auto PL_TABLE_MPSOC_STREAM_TRANS_1 = - std::make_pair((payload::Modes::MPSOC_STREAM << 24) | 3, FixedArrayList()); + std::make_pair((payload::Modes::MPSOC_STREAM << 24) | 3, FixedArrayList()); auto PL_SEQUENCE_CAM_STREAM = - std::make_pair(payload::Modes::CAM_STREAM << 24, FixedArrayList()); + std::make_pair(payload::Modes::CAM_STREAM << 24, FixedArrayList()); auto PL_TABLE_CAM_STREAM_TGT = std::make_pair((payload::Modes::CAM_STREAM << 24) | 1, FixedArrayList()); auto PL_TABLE_CAM_STREAM_TRANS_0 = - std::make_pair((payload::Modes::CAM_STREAM << 24) | 2, FixedArrayList()); + std::make_pair((payload::Modes::CAM_STREAM << 24) | 2, FixedArrayList()); auto PL_TABLE_CAM_STREAM_TRANS_1 = - std::make_pair((payload::Modes::CAM_STREAM << 24) | 3, FixedArrayList()); + std::make_pair((payload::Modes::CAM_STREAM << 24) | 3, FixedArrayList()); auto PL_SEQUENCE_SUPV_ONLY = - std::make_pair(payload::Modes::SUPV_ONLY << 24, FixedArrayList()); + std::make_pair(payload::Modes::SUPV_ONLY << 24, FixedArrayList()); auto PL_TABLE_SUPV_ONLY_TGT = std::make_pair((payload::Modes::SUPV_ONLY << 24) | 1, FixedArrayList()); auto PL_TABLE_SUPV_ONLY_TRANS_0 = @@ -67,7 +67,7 @@ auto PL_TABLE_EARTH_OBSV_TRANS_1 = std::make_pair((payload::Modes::EARTH_OBSV << 24) | 3, FixedArrayList()); auto PL_SEQUENCE_SCEX = - std::make_pair(payload::Modes::SCEX << 24, FixedArrayList()); + std::make_pair(payload::Modes::SCEX << 24, FixedArrayList()); auto PL_TABLE_SCEX_TGT = std::make_pair((payload::Modes::SCEX << 24) | 1, FixedArrayList()); auto PL_TABLE_SCEX_TRANS_0 = @@ -165,13 +165,13 @@ void initPlMpsocStreamSequence(Subsystem* ss, ModeListEntry& eh) { // Build MPSoC stream transition 0 iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); iht(objects::SCEX, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); - iht(objects::PLOC_SUPERVISOR_HANDLER, NML, 0, PL_TABLE_MPSOC_STREAM_TGT.second); + iht(objects::PLOC_SUPERVISOR_HANDLER, NML, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); check(ss->addTable( TableEntry(PL_TABLE_MPSOC_STREAM_TRANS_0.first, &PL_TABLE_MPSOC_STREAM_TRANS_0.second)), ctxc); // Build MPSoC stream transition 1 - iht(objects::PLOC_MPSOC_HANDLER, NML, 0, PL_TABLE_MPSOC_STREAM_TGT.second); + iht(objects::PLOC_MPSOC_HANDLER, NML, 0, PL_TABLE_MPSOC_STREAM_TRANS_1.second); check(ss->addTable( TableEntry(PL_TABLE_MPSOC_STREAM_TRANS_1.first, &PL_TABLE_MPSOC_STREAM_TRANS_1.second)), ctxc); @@ -186,7 +186,7 @@ void initPlMpsocStreamSequence(Subsystem* ss, ModeListEntry& eh) { } void initPlCamStreamSequence(Subsystem* ss, ModeListEntry& eh) { - std::string context = "satsystem::payload::initPlCamSequence"; + std::string context = "satsystem::payload::initPlCamStreamSequence"; auto ctxc = context.c_str(); // Insert Helper Table auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, @@ -214,17 +214,17 @@ void initPlCamStreamSequence(Subsystem* ss, ModeListEntry& eh) { // Build CAM transition 0 // PLOC is actively commanded off here - iht(objects::PLOC_MPSOC_HANDLER, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); - iht(objects::CAM_SWITCHER, ON, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); - iht(objects::SCEX, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); + iht(objects::PLOC_MPSOC_HANDLER, OFF, 0, PL_TABLE_CAM_STREAM_TRANS_0.second); + iht(objects::CAM_SWITCHER, ON, 0, PL_TABLE_CAM_STREAM_TRANS_0.second); + iht(objects::SCEX, OFF, 0, PL_TABLE_CAM_STREAM_TRANS_0.second); check(ss->addTable( - TableEntry(PL_TABLE_MPSOC_STREAM_TRANS_0.first, &PL_TABLE_MPSOC_STREAM_TRANS_0.second)), + TableEntry(PL_TABLE_CAM_STREAM_TRANS_0.first, &PL_TABLE_CAM_STREAM_TRANS_0.second)), ctxc); // Build CAM transition 1 - iht(objects::PLOC_SUPERVISOR_HANDLER, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_1.second); + iht(objects::PLOC_SUPERVISOR_HANDLER, OFF, 0, PL_TABLE_CAM_STREAM_TRANS_1.second); check(ss->addTable( - TableEntry(PL_TABLE_MPSOC_STREAM_TRANS_1.first, &PL_TABLE_MPSOC_STREAM_TRANS_1.second)), + TableEntry(PL_TABLE_CAM_STREAM_TRANS_1.first, &PL_TABLE_CAM_STREAM_TRANS_1.second)), ctxc); // Build CAM stream sequence @@ -270,6 +270,9 @@ void initPlSpvSequence(Subsystem* ss, ModeListEntry& eh) { // Build Payload Supervisor Only transition 1 iht(objects::PLOC_MPSOC_HANDLER, OFF, 0, PL_TABLE_SUPV_ONLY_TRANS_1.second); + check(ss->addTable( + TableEntry(PL_TABLE_SUPV_ONLY_TRANS_1.first, &PL_TABLE_SUPV_ONLY_TRANS_1.second)), + ctxc); // Build Payload Supervisor Only Sequence ihs(PL_SEQUENCE_SUPV_ONLY.second, PL_TABLE_SUPV_ONLY_TGT.first, 0, true); diff --git a/mission/system/tree/util.cpp b/mission/system/tree/util.cpp index 92a752e7..935e9d79 100644 --- a/mission/system/tree/util.cpp +++ b/mission/system/tree/util.cpp @@ -6,10 +6,12 @@ void subsystem::checkInsert(ReturnValue_t result, const char* ctx) { if (result != returnvalue::OK) { sif::warning << "satsystem::checkInsert: Insertion failed at " << ctx; - if (result == mapdefs::KEY_ALREADY_EXISTS) { + if (result == containers::KEY_ALREADY_EXISTS) { sif::warning << ": Key already exists" << std::endl; - } else if (result == mapdefs::MAP_FULL) { + } else if (result == containers::MAP_FULL) { sif::warning << ": Map full" << std::endl; + } else if (result == containers::LIST_FULL) { + sif::warning << ": List full" << std::endl; } else { sif::warning << std::endl; } -- 2.43.0 From d690a54005d5bf93c14e330eeba28f5d68667899 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 10 Nov 2022 15:39:08 +0100 Subject: [PATCH 17/17] connect payload children to subsystem --- bsp_q7s/core/ObjectFactory.cpp | 22 +++-- fsfw | 2 +- linux/ObjectFactory.cpp | 2 + mission/system/tree/payloadModeTree.cpp | 109 ++++++++++++------------ mission/system/tree/payloadModeTree.h | 7 +- 5 files changed, 78 insertions(+), 64 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 13998027..bc46efb5 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -1,5 +1,6 @@ #include "ObjectFactory.h" +#include #include #include "OBSWConfig.h" @@ -47,6 +48,7 @@ #include "mission/system/objects/RwAssembly.h" #include "mission/system/objects/TcsBoardAssembly.h" #include "mission/system/tree/acsModeTree.h" +#include "mission/system/tree/payloadModeTree.h" #include "tmtc/pusIds.h" #if OBSW_TEST_LIBGPIOD == 1 #include "linux/boardtest/LibgpiodTest.h" @@ -588,7 +590,10 @@ void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) { void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF& pwrSwitch) { using namespace gpio; std::stringstream consumer; - new CamSwitcher(objects::CAM_SWITCHER, pwrSwitch, pcdu::PDU2_CH8_PAYLOAD_CAMERA); + auto* camSwitcher = + new CamSwitcher(objects::CAM_SWITCHER, pwrSwitch, pcdu::PDU2_CH8_PAYLOAD_CAMERA); + camSwitcher->connectModeTreeParent(satsystem::pl::SUBSYSTEM); + // camSwitcher-> #if OBSW_ADD_PLOC_MPSOC == 1 consumer << "0x" << std::hex << objects::PLOC_MPSOC_HANDLER; auto gpioConfigMPSoC = new GpiodRegularByLineName(q7s::gpioNames::ENABLE_MPSOC_UART, @@ -601,9 +606,10 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwit mpsoc::MAX_REPLY_SIZE, UartModes::NON_CANONICAL); mpsocCookie->setNoFixedSizeReply(); auto plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER); - new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocCookie, - plocMpsocHelper, Gpio(gpioIds::ENABLE_MPSOC_UART, gpioComIF), - objects::PLOC_SUPERVISOR_HANDLER); + auto* mpsocHandler = new PlocMPSoCHandler( + objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocCookie, plocMpsocHelper, + Gpio(gpioIds::ENABLE_MPSOC_UART, gpioComIF), objects::PLOC_SUPERVISOR_HANDLER); + mpsocHandler->connectModeTreeParent(satsystem::pl::SUBSYSTEM); #endif /* OBSW_ADD_PLOC_MPSOC == 1 */ #if OBSW_ADD_PLOC_SUPERVISOR == 1 consumer << "0x" << std::hex << objects::PLOC_SUPERVISOR_HANDLER; @@ -617,9 +623,10 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwit uart::PLOC_SUPV_BAUD, supv::MAX_PACKET_SIZE * 20, UartModes::NON_CANONICAL); supervisorCookie->setNoFixedSizeReply(); auto supvHelper = new PlocSupvHelper(objects::PLOC_SUPERVISOR_HELPER); - new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF, - supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF), - pcdu::PDU1_CH6_PLOC_12V, supvHelper); + auto* supvHandler = new PlocSupervisorHandler( + objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF, supervisorCookie, + Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF), pcdu::PDU1_CH6_PLOC_12V, supvHelper); + supvHandler->connectModeTreeParent(satsystem::pl::SUBSYSTEM); #endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */ static_cast(consumer); } @@ -880,6 +887,7 @@ void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* plPcduHandler->setToGoToNormalModeImmediately(true); plPcduHandler->enablePeriodicPrintout(true, 10); #endif + plPcduHandler->connectModeTreeParent(satsystem::pl::SUBSYSTEM); } void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) { diff --git a/fsfw b/fsfw index 530a261e..177c39dd 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 530a261e142ae4ab2c7726303e4d571d03200e47 +Subproject commit 177c39dd53198a1b05e2f40fc3c5e88e7f7c2e0b diff --git a/linux/ObjectFactory.cpp b/linux/ObjectFactory.cpp index 24bb6254..2fe31372 100644 --- a/linux/ObjectFactory.cpp +++ b/linux/ObjectFactory.cpp @@ -27,6 +27,7 @@ #include "mission/system/objects/SusAssembly.h" #include "mission/system/objects/TcsBoardAssembly.h" #include "mission/system/tree/acsModeTree.h" +#include "mission/system/tree/payloadModeTree.h" void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiComIF, PowerSwitchIF* pwrSwitcher, std::string spiDev) { @@ -336,6 +337,7 @@ void ObjectFactory::createScexComponents(std::string uartDev, PowerSwitchIF* pwr if (switchId) { scexHandler->setPowerSwitcher(*pwrSwitcher, switchId.value()); } + scexHandler->connectModeTreeParent(satsystem::pl::SUBSYSTEM); } void ObjectFactory::createThermalController() { diff --git a/mission/system/tree/payloadModeTree.cpp b/mission/system/tree/payloadModeTree.cpp index ea339b74..6cbc4004 100644 --- a/mission/system/tree/payloadModeTree.cpp +++ b/mission/system/tree/payloadModeTree.cpp @@ -12,14 +12,16 @@ #include "util.h" namespace { -void initOffSequence(Subsystem* ss, ModeListEntry& eh); -void initPlMpsocStreamSequence(Subsystem* ss, ModeListEntry& eh); -void initPlCamStreamSequence(Subsystem* ss, ModeListEntry& eh); -void initPlSpvSequence(Subsystem* ss, ModeListEntry& eh); -void initEarthObsvSequence(Subsystem* ss, ModeListEntry& eh); -void initScexSequence(Subsystem* ss, ModeListEntry& eh); +void initOffSequence(Subsystem& ss, ModeListEntry& eh); +void initPlMpsocStreamSequence(Subsystem& ss, ModeListEntry& eh); +void initPlCamStreamSequence(Subsystem& ss, ModeListEntry& eh); +void initPlSpvSequence(Subsystem& ss, ModeListEntry& eh); +void initEarthObsvSequence(Subsystem& ss, ModeListEntry& eh); +void initScexSequence(Subsystem& ss, ModeListEntry& eh); } // namespace +Subsystem satsystem::pl::SUBSYSTEM = Subsystem(objects::PL_SUBSYSTEM, 12, 24); + const auto check = subsystem::checkInsert; static const auto OFF = HasModesIF::MODE_OFF; static const auto ON = HasModesIF::MODE_ON; @@ -75,19 +77,18 @@ auto PL_TABLE_SCEX_TRANS_0 = void satsystem::pl::init() { ModeListEntry entry; - Subsystem* plSubsystem = new Subsystem(objects::PL_SUBSYSTEM, 12, 24); - initOffSequence(plSubsystem, entry); - initPlMpsocStreamSequence(plSubsystem, entry); - initPlCamStreamSequence(plSubsystem, entry); - initPlSpvSequence(plSubsystem, entry); - initEarthObsvSequence(plSubsystem, entry); - initScexSequence(plSubsystem, entry); - plSubsystem->setInitialMode(OFF); + initOffSequence(SUBSYSTEM, entry); + initPlMpsocStreamSequence(SUBSYSTEM, entry); + initPlCamStreamSequence(SUBSYSTEM, entry); + initPlSpvSequence(SUBSYSTEM, entry); + initEarthObsvSequence(SUBSYSTEM, entry); + initScexSequence(SUBSYSTEM, entry); + SUBSYSTEM.setInitialMode(OFF); } namespace { -void initOffSequence(Subsystem* ss, ModeListEntry& eh) { +void initOffSequence(Subsystem& ss, ModeListEntry& eh) { std::string context = "satsystem::payload::buildOffSequence"; auto ctxc = context.c_str(); // Insert Helper Table @@ -108,29 +109,29 @@ void initOffSequence(Subsystem* ss, ModeListEntry& eh) { }; // Build OFF target. Is empty - check(ss->addTable(TableEntry(PL_TABLE_OFF_TGT.first, &PL_TABLE_OFF_TGT.second)), ctxc); + check(ss.addTable(TableEntry(PL_TABLE_OFF_TGT.first, &PL_TABLE_OFF_TGT.second)), ctxc); // Build OFF transition 0 iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_OFF_TRANS_0.second); iht(objects::SCEX, OFF, 0, PL_TABLE_OFF_TRANS_0.second); iht(objects::PLPCDU_HANDLER, OFF, 0, PL_TABLE_OFF_TRANS_0.second); iht(objects::PLOC_MPSOC_HANDLER, OFF, 0, PL_TABLE_OFF_TRANS_0.second); - check(ss->addTable(TableEntry(PL_TABLE_OFF_TRANS_0.first, &PL_TABLE_OFF_TRANS_0.second)), ctxc); + check(ss.addTable(TableEntry(PL_TABLE_OFF_TRANS_0.first, &PL_TABLE_OFF_TRANS_0.second)), ctxc); // Build OFF transition 1 iht(objects::PLOC_SUPERVISOR_HANDLER, OFF, 0, PL_TABLE_OFF_TRANS_1.second); - check(ss->addTable(TableEntry(PL_TABLE_OFF_TRANS_1.first, &PL_TABLE_OFF_TRANS_1.second)), ctxc); + check(ss.addTable(TableEntry(PL_TABLE_OFF_TRANS_1.first, &PL_TABLE_OFF_TRANS_1.second)), ctxc); // Build OFF sequence ihs(PL_SEQUENCE_OFF.second, PL_TABLE_OFF_TGT.first, 0, false); ihs(PL_SEQUENCE_OFF.second, PL_TABLE_OFF_TRANS_0.first, 0, false); ihs(PL_SEQUENCE_OFF.second, PL_TABLE_OFF_TRANS_1.first, 0, false); - check(ss->addSequence( + check(ss.addSequence( SequenceEntry(PL_SEQUENCE_OFF.first, &PL_SEQUENCE_OFF.second, PL_SEQUENCE_OFF.first)), ctxc); } -void initPlMpsocStreamSequence(Subsystem* ss, ModeListEntry& eh) { +void initPlMpsocStreamSequence(Subsystem& ss, ModeListEntry& eh) { std::string context = "satsystem::payload::initPlMpsocStreamSequence"; auto ctxc = context.c_str(); // Insert Helper Table @@ -158,21 +159,20 @@ void initPlMpsocStreamSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_MPSOC_STREAM_TGT.second); iht(objects::PLOC_MPSOC_HANDLER, NML, 0, PL_TABLE_MPSOC_STREAM_TGT.second); iht(objects::PLOC_SUPERVISOR_HANDLER, NML, 0, PL_TABLE_MPSOC_STREAM_TGT.second); - check( - ss->addTable(TableEntry(PL_TABLE_MPSOC_STREAM_TGT.first, &PL_TABLE_MPSOC_STREAM_TGT.second)), - ctxc); + check(ss.addTable(TableEntry(PL_TABLE_MPSOC_STREAM_TGT.first, &PL_TABLE_MPSOC_STREAM_TGT.second)), + ctxc); // Build MPSoC stream transition 0 iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); iht(objects::SCEX, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); iht(objects::PLOC_SUPERVISOR_HANDLER, NML, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); - check(ss->addTable( + check(ss.addTable( TableEntry(PL_TABLE_MPSOC_STREAM_TRANS_0.first, &PL_TABLE_MPSOC_STREAM_TRANS_0.second)), ctxc); // Build MPSoC stream transition 1 iht(objects::PLOC_MPSOC_HANDLER, NML, 0, PL_TABLE_MPSOC_STREAM_TRANS_1.second); - check(ss->addTable( + check(ss.addTable( TableEntry(PL_TABLE_MPSOC_STREAM_TRANS_1.first, &PL_TABLE_MPSOC_STREAM_TRANS_1.second)), ctxc); @@ -180,12 +180,12 @@ void initPlMpsocStreamSequence(Subsystem* ss, ModeListEntry& eh) { ihs(PL_SEQUENCE_MPSOC_STREAM.second, PL_TABLE_MPSOC_STREAM_TGT.first, 0, true); ihs(PL_SEQUENCE_MPSOC_STREAM.second, PL_TABLE_MPSOC_STREAM_TRANS_0.first, 0, true); ihs(PL_SEQUENCE_MPSOC_STREAM.second, PL_TABLE_MPSOC_STREAM_TRANS_1.first, 0, false); - check(ss->addSequence(SequenceEntry(PL_SEQUENCE_MPSOC_STREAM.first, - &PL_SEQUENCE_MPSOC_STREAM.second, PL_SEQUENCE_OFF.first)), + check(ss.addSequence(SequenceEntry(PL_SEQUENCE_MPSOC_STREAM.first, + &PL_SEQUENCE_MPSOC_STREAM.second, PL_SEQUENCE_OFF.first)), ctxc); } -void initPlCamStreamSequence(Subsystem* ss, ModeListEntry& eh) { +void initPlCamStreamSequence(Subsystem& ss, ModeListEntry& eh) { std::string context = "satsystem::payload::initPlCamStreamSequence"; auto ctxc = context.c_str(); // Insert Helper Table @@ -209,7 +209,7 @@ void initPlCamStreamSequence(Subsystem* ss, ModeListEntry& eh) { // Only check that the PL PCDU is on for now. It might later become necessary to switch on // the PLOC, so we ignore its state. iht(objects::PLPCDU_HANDLER, NML, plpcdu::ALL_ON_SUBMODE, PL_TABLE_CAM_STREAM_TGT.second); - check(ss->addTable(TableEntry(PL_TABLE_CAM_STREAM_TGT.first, &PL_TABLE_CAM_STREAM_TGT.second)), + check(ss.addTable(TableEntry(PL_TABLE_CAM_STREAM_TGT.first, &PL_TABLE_CAM_STREAM_TGT.second)), ctxc); // Build CAM transition 0 @@ -217,13 +217,13 @@ void initPlCamStreamSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::PLOC_MPSOC_HANDLER, OFF, 0, PL_TABLE_CAM_STREAM_TRANS_0.second); iht(objects::CAM_SWITCHER, ON, 0, PL_TABLE_CAM_STREAM_TRANS_0.second); iht(objects::SCEX, OFF, 0, PL_TABLE_CAM_STREAM_TRANS_0.second); - check(ss->addTable( + check(ss.addTable( TableEntry(PL_TABLE_CAM_STREAM_TRANS_0.first, &PL_TABLE_CAM_STREAM_TRANS_0.second)), ctxc); // Build CAM transition 1 iht(objects::PLOC_SUPERVISOR_HANDLER, OFF, 0, PL_TABLE_CAM_STREAM_TRANS_1.second); - check(ss->addTable( + check(ss.addTable( TableEntry(PL_TABLE_CAM_STREAM_TRANS_1.first, &PL_TABLE_CAM_STREAM_TRANS_1.second)), ctxc); @@ -231,12 +231,12 @@ void initPlCamStreamSequence(Subsystem* ss, ModeListEntry& eh) { ihs(PL_SEQUENCE_CAM_STREAM.second, PL_TABLE_CAM_STREAM_TGT.first, 0, true); ihs(PL_SEQUENCE_CAM_STREAM.second, PL_TABLE_CAM_STREAM_TRANS_0.first, 0, true); ihs(PL_SEQUENCE_CAM_STREAM.second, PL_TABLE_CAM_STREAM_TRANS_1.first, 0, false); - check(ss->addSequence(SequenceEntry(PL_SEQUENCE_CAM_STREAM.first, &PL_SEQUENCE_CAM_STREAM.second, - PL_SEQUENCE_OFF.first)), + check(ss.addSequence(SequenceEntry(PL_SEQUENCE_CAM_STREAM.first, &PL_SEQUENCE_CAM_STREAM.second, + PL_SEQUENCE_OFF.first)), ctxc); } -void initPlSpvSequence(Subsystem* ss, ModeListEntry& eh) { +void initPlSpvSequence(Subsystem& ss, ModeListEntry& eh) { std::string context = "satsystem::payload::initPlSupvSequence"; auto ctxc = context.c_str(); // Insert Helper Table @@ -258,32 +258,32 @@ void initPlSpvSequence(Subsystem* ss, ModeListEntry& eh) { // Build Payload Supervisor Only target iht(objects::PLOC_SUPERVISOR_HANDLER, NML, 0, PL_TABLE_SUPV_ONLY_TGT.second); - check(ss->addTable(TableEntry(PL_TABLE_SUPV_ONLY_TGT.first, &PL_TABLE_SUPV_ONLY_TGT.second)), + check(ss.addTable(TableEntry(PL_TABLE_SUPV_ONLY_TGT.first, &PL_TABLE_SUPV_ONLY_TGT.second)), ctxc); // Build Payload Supervisor Only transition 0 iht(objects::PLOC_SUPERVISOR_HANDLER, NML, 0, PL_TABLE_SUPV_ONLY_TRANS_0.second); iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_SUPV_ONLY_TRANS_0.second); - check(ss->addTable( - TableEntry(PL_TABLE_SUPV_ONLY_TRANS_0.first, &PL_TABLE_SUPV_ONLY_TRANS_0.second)), - ctxc); + check( + ss.addTable(TableEntry(PL_TABLE_SUPV_ONLY_TRANS_0.first, &PL_TABLE_SUPV_ONLY_TRANS_0.second)), + ctxc); // Build Payload Supervisor Only transition 1 iht(objects::PLOC_MPSOC_HANDLER, OFF, 0, PL_TABLE_SUPV_ONLY_TRANS_1.second); - check(ss->addTable( - TableEntry(PL_TABLE_SUPV_ONLY_TRANS_1.first, &PL_TABLE_SUPV_ONLY_TRANS_1.second)), - ctxc); + check( + ss.addTable(TableEntry(PL_TABLE_SUPV_ONLY_TRANS_1.first, &PL_TABLE_SUPV_ONLY_TRANS_1.second)), + ctxc); // Build Payload Supervisor Only Sequence ihs(PL_SEQUENCE_SUPV_ONLY.second, PL_TABLE_SUPV_ONLY_TGT.first, 0, true); ihs(PL_SEQUENCE_SUPV_ONLY.second, PL_TABLE_SUPV_ONLY_TRANS_0.first, 0, true); ihs(PL_SEQUENCE_SUPV_ONLY.second, PL_TABLE_SUPV_ONLY_TRANS_1.first, 0, false); - check(ss->addSequence(SequenceEntry(PL_SEQUENCE_SUPV_ONLY.first, &PL_SEQUENCE_SUPV_ONLY.second, - PL_SEQUENCE_OFF.first)), + check(ss.addSequence(SequenceEntry(PL_SEQUENCE_SUPV_ONLY.first, &PL_SEQUENCE_SUPV_ONLY.second, + PL_SEQUENCE_OFF.first)), ctxc); } -void initEarthObsvSequence(Subsystem* ss, ModeListEntry& eh) { +void initEarthObsvSequence(Subsystem& ss, ModeListEntry& eh) { std::string context = "satsystem::payload::initEarthObsvSequence"; auto ctxc = context.c_str(); // Insert Helper Table @@ -308,32 +308,32 @@ void initEarthObsvSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::PLOC_SUPERVISOR_HANDLER, NML, 0, PL_TABLE_EARTH_OBSV_TGT.second); iht(objects::CAM_SWITCHER, ON, 0, PL_TABLE_EARTH_OBSV_TGT.second); iht(objects::PLPCDU_HANDLER, OFF, 0, PL_TABLE_EARTH_OBSV_TGT.second); - check(ss->addTable(TableEntry(PL_TABLE_EARTH_OBSV_TGT.first, &PL_TABLE_EARTH_OBSV_TGT.second)), + check(ss.addTable(TableEntry(PL_TABLE_EARTH_OBSV_TGT.first, &PL_TABLE_EARTH_OBSV_TGT.second)), ctxc); // Build Earth Observation transition 0 iht(objects::PLOC_SUPERVISOR_HANDLER, NML, 0, PL_TABLE_EARTH_OBSV_TRANS_0.second); iht(objects::CAM_SWITCHER, ON, 0, PL_TABLE_EARTH_OBSV_TRANS_0.second); iht(objects::PLPCDU_HANDLER, OFF, 0, PL_TABLE_EARTH_OBSV_TRANS_0.second); - check(ss->addTable( + check(ss.addTable( TableEntry(PL_TABLE_EARTH_OBSV_TRANS_0.first, &PL_TABLE_EARTH_OBSV_TRANS_0.second)), ctxc); // Build Earth Observation transition 1 iht(objects::PLOC_MPSOC_HANDLER, NML, 0, PL_TABLE_CAM_STREAM_TRANS_1.second); - check(ss->addTable( + check(ss.addTable( TableEntry(PL_TABLE_EARTH_OBSV_TRANS_1.first, &PL_TABLE_EARTH_OBSV_TRANS_1.second)), ctxc); ihs(PL_SEQUENCE_EARTH_OBSV.second, PL_TABLE_EARTH_OBSV_TGT.first, 0, true); ihs(PL_SEQUENCE_EARTH_OBSV.second, PL_TABLE_EARTH_OBSV_TRANS_0.first, 0, true); ihs(PL_SEQUENCE_EARTH_OBSV.second, PL_TABLE_EARTH_OBSV_TRANS_1.first, 0, false); - check(ss->addSequence(SequenceEntry(PL_SEQUENCE_EARTH_OBSV.first, &PL_SEQUENCE_EARTH_OBSV.second, - PL_SEQUENCE_OFF.first)), + check(ss.addSequence(SequenceEntry(PL_SEQUENCE_EARTH_OBSV.first, &PL_SEQUENCE_EARTH_OBSV.second, + PL_SEQUENCE_OFF.first)), ctxc); } -void initScexSequence(Subsystem* ss, ModeListEntry& eh) { +void initScexSequence(Subsystem& ss, ModeListEntry& eh) { std::string context = "satsystem::payload::initScexSequence"; auto ctxc = context.c_str(); // Insert Helper Table @@ -355,17 +355,16 @@ void initScexSequence(Subsystem* ss, ModeListEntry& eh) { // Build SCEX target iht(objects::SCEX, NML, 0, PL_TABLE_SCEX_TGT.second); - check(ss->addTable(TableEntry(PL_TABLE_EARTH_OBSV_TGT.first, &PL_TABLE_EARTH_OBSV_TGT.second)), - ctxc); + check(ss.addTable(TableEntry(PL_TABLE_SCEX_TGT.first, &PL_TABLE_SCEX_TGT.second)), ctxc); // Build SCEX transition 0 - iht(objects::SCEX, NML, 0, PL_TABLE_SCEX_TGT.second); - check(ss->addTable(TableEntry(PL_TABLE_SCEX_TRANS_0.first, &PL_TABLE_SCEX_TRANS_0.second)), ctxc); + iht(objects::SCEX, NML, 0, PL_TABLE_SCEX_TRANS_0.second); + check(ss.addTable(TableEntry(PL_TABLE_SCEX_TRANS_0.first, &PL_TABLE_SCEX_TRANS_0.second)), ctxc); // Build SCEX sequence ihs(PL_SEQUENCE_SCEX.second, PL_TABLE_SCEX_TGT.first, 0, true); ihs(PL_SEQUENCE_SCEX.second, PL_TABLE_SCEX_TRANS_0.first, 0, false); - check(ss->addSequence( + check(ss.addSequence( SequenceEntry(PL_SEQUENCE_SCEX.first, &PL_SEQUENCE_SCEX.second, PL_SEQUENCE_OFF.first)), ctxc); } diff --git a/mission/system/tree/payloadModeTree.h b/mission/system/tree/payloadModeTree.h index 738eb01c..d1eae4d7 100644 --- a/mission/system/tree/payloadModeTree.h +++ b/mission/system/tree/payloadModeTree.h @@ -1,11 +1,16 @@ #ifndef MISSION_SYSTEM_TREE_PAYLOADMODETREE_H_ #define MISSION_SYSTEM_TREE_PAYLOADMODETREE_H_ +#include + namespace satsystem { namespace pl { + +extern Subsystem SUBSYSTEM; + void init(); -} +} // namespace pl } // namespace satsystem -- 2.43.0