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) {