Payload Subsystem #231

Merged
muellerr merged 39 commits from mueller/pl-ss into develop 2022-11-10 15:42:54 +01:00
5 changed files with 149 additions and 117 deletions
Showing only changes of commit 9c0a89bbdc - Show all commits

View File

@ -2,4 +2,5 @@ target_sources(${LIB_EIVE_MISSION} PRIVATE
acsModeTree.cpp acsModeTree.cpp
payloadModeTree.cpp payloadModeTree.cpp
system.cpp system.cpp
util.cpp
) )

View File

@ -7,10 +7,10 @@
#include <fsfw/subsystem/modes/ModeDefinitions.h> #include <fsfw/subsystem/modes/ModeDefinitions.h>
#include "mission/controller/controllerdefinitions/AcsControllerDefinitions.h" #include "mission/controller/controllerdefinitions/AcsControllerDefinitions.h"
#include "util.h"
// Alias for checker function // Alias for checker function
namespace { namespace {
void checkInsert(ReturnValue_t result, const char* ctx);
void buildOffSequence(Subsystem* ss, ModeListEntry& eh); void buildOffSequence(Subsystem* ss, ModeListEntry& eh);
void buildDetumbleSequence(Subsystem* ss, ModeListEntry& entryHelper); void buildDetumbleSequence(Subsystem* ss, ModeListEntry& entryHelper);
void buildSafeSequence(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); void buildTargetPtSequence(Subsystem* ss, ModeListEntry& entryHelper);
} // namespace } // namespace
const auto CHK = checkInsert; const auto check = subsystem::checkInsert;
static const auto OFF = HasModesIF::MODE_OFF; static const auto OFF = HasModesIF::MODE_OFF;
static const auto NML = DeviceHandlerIF::MODE_NORMAL; static const auto NML = DeviceHandlerIF::MODE_NORMAL;
@ -97,7 +97,7 @@ void buildOffSequence(Subsystem* ss, ModeListEntry& eh) {
eh.setObject(obj); eh.setObject(obj);
eh.setMode(mode); eh.setMode(mode);
eh.setSubmode(submode); eh.setSubmode(submode);
CHK(table.insert(eh), ctxc); check(table.insert(eh), ctxc);
}; };
// Insert Helper Sequence // Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds, auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
@ -105,11 +105,11 @@ void buildOffSequence(Subsystem* ss, ModeListEntry& eh) {
eh.setTableId(tableId); eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds); eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess); eh.setCheckSuccess(checkSuccess);
CHK(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// OFF Target table is empty // 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 // Build OFF transition
iht(objects::ACS_CONTROLLER, OFF, 0, ACS_TABLE_OFF_TRANS.second); iht(objects::ACS_CONTROLLER, OFF, 0, ACS_TABLE_OFF_TRANS.second);
@ -118,12 +118,12 @@ void buildOffSequence(Subsystem* ss, ModeListEntry& eh) {
iht(objects::ACS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second); 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::SUS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second);
iht(objects::RW_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 // Build OFF sequence
ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TGT.first, 0, false); ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TGT.first, 0, false);
ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TRANS.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, check(ss->addSequence(&ACS_SEQUENCE_OFF.second, ACS_SEQUENCE_OFF.first, ACS_SEQUENCE_OFF.first,
false, true), false, true),
ctxc); ctxc);
} }
@ -137,7 +137,7 @@ void buildSafeSequence(Subsystem* ss, ModeListEntry& eh) {
eh.setObject(obj); eh.setObject(obj);
eh.setMode(mode); eh.setMode(mode);
eh.setSubmode(submode); eh.setSubmode(submode);
CHK(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Insert Helper Sequence // Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds, auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
@ -145,14 +145,14 @@ void buildSafeSequence(Subsystem* ss, ModeListEntry& eh) {
eh.setTableId(tableId); eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds); eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess); eh.setCheckSuccess(checkSuccess);
CHK(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Build SAFE target // Build SAFE target
iht(objects::ACS_CONTROLLER, acs::CtrlModes::SAFE, 0, ACS_TABLE_SAFE_TGT.second); 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::IMTQ_HANDLER, NML, 0, ACS_TABLE_SAFE_TGT.second);
iht(objects::SUS_BOARD_ASS, 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); 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 // Build SAFE transition 0
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_SAFE_TRANS_0.second); iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_SAFE_TRANS_0.second);
@ -160,19 +160,19 @@ void buildSafeSequence(Subsystem* ss, ModeListEntry& eh) {
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TRANS_0.second); 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::STAR_TRACKER, OFF, 0, ACS_TABLE_SAFE_TRANS_0.second);
iht(objects::RW_ASS, 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), check(ss->addTable(&ACS_TABLE_SAFE_TRANS_0.second, ACS_TABLE_SAFE_TRANS_0.first, false, true),
ctxc); ctxc);
// Build SAFE transition 1 // Build SAFE transition 1
iht(objects::ACS_CONTROLLER, acs::CtrlModes::SAFE, 0, ACS_TABLE_SAFE_TRANS_1.second); 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), check(ss->addTable(&ACS_TABLE_SAFE_TRANS_1.second, ACS_TABLE_SAFE_TRANS_1.first, false, true),
ctxc); ctxc);
// Build SAFE sequence // Build SAFE sequence
ihs(ACS_SEQUENCE_SAFE.second, ACS_TABLE_SAFE_TGT.first, 0, true); 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_0.first, 0, false);
ihs(ACS_SEQUENCE_SAFE.second, ACS_TABLE_SAFE_TRANS_1.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, check(ss->addSequence(&ACS_SEQUENCE_SAFE.second, ACS_SEQUENCE_SAFE.first, ACS_SEQUENCE_OFF.first,
false, true), false, true),
ctxc); ctxc);
} }
@ -186,7 +186,7 @@ void buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) {
eh.setObject(obj); eh.setObject(obj);
eh.setMode(mode); eh.setMode(mode);
eh.setSubmode(submode); eh.setSubmode(submode);
CHK(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Insert Helper Sequence // Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds, auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
@ -194,14 +194,14 @@ void buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) {
eh.setTableId(tableId); eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds); eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess); eh.setCheckSuccess(checkSuccess);
CHK(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Build DETUMBLE target // Build DETUMBLE target
iht(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TGT.second); 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::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TGT.second);
iht(objects::SUS_BOARD_ASS, 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); 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), check(ss->addTable(&ACS_TABLE_DETUMBLE_TGT.second, ACS_TABLE_DETUMBLE_TGT.first, false, true),
ctxc); ctxc);
// Build DETUMBLE transition 0 // Build DETUMBLE transition 0
@ -210,13 +210,13 @@ void buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) {
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); 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::STAR_TRACKER, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
iht(objects::RW_ASS, 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, check(ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_0.second, ACS_TABLE_DETUMBLE_TRANS_0.first, false,
true), true),
ctxc); ctxc);
// Build DETUMBLE transition 1 // Build DETUMBLE transition 1
iht(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TRANS_1.second); 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, check(ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_1.second, ACS_TABLE_DETUMBLE_TRANS_1.first, false,
true), true),
ctxc); ctxc);
@ -224,7 +224,7 @@ void buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) {
ihs(ACS_SEQUENCE_DETUMBLE.second, ACS_TABLE_DETUMBLE_TGT.first, 0, true); 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_0.first, 0, false);
ihs(ACS_SEQUENCE_DETUMBLE.second, ACS_TABLE_DETUMBLE_TRANS_1.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, check(ss->addSequence(&ACS_SEQUENCE_DETUMBLE.second, ACS_SEQUENCE_DETUMBLE.first,
ACS_SEQUENCE_SAFE.first, false, true), ACS_SEQUENCE_SAFE.first, false, true),
ctxc); ctxc);
} }
@ -238,7 +238,7 @@ void buildIdleSequence(Subsystem* ss, ModeListEntry& eh) {
eh.setObject(obj); eh.setObject(obj);
eh.setMode(mode); eh.setMode(mode);
eh.setSubmode(submode); eh.setSubmode(submode);
CHK(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Insert Helper Sequence // Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds, auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
@ -246,7 +246,7 @@ void buildIdleSequence(Subsystem* ss, ModeListEntry& eh) {
eh.setTableId(tableId); eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds); eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess); eh.setCheckSuccess(checkSuccess);
CHK(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Build IDLE target // Build IDLE target
iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, 0, ACS_TABLE_IDLE_TGT.second); 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.setObject(obj);
eh.setMode(mode); eh.setMode(mode);
eh.setSubmode(submode); eh.setSubmode(submode);
CHK(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Insert Helper Sequence // Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds, auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
@ -293,7 +293,7 @@ void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& eh) {
eh.setTableId(tableId); eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds); eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess); eh.setCheckSuccess(checkSuccess);
CHK(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Build IDLE target // Build IDLE target
iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, acs::IDLE_CHARGE, iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, acs::IDLE_CHARGE,
@ -301,7 +301,7 @@ void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& eh) {
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_IDLE_CHRG_TGT.second); 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::SUS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_CHRG_TGT.second);
iht(objects::ACS_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), check(ss->addTable(&ACS_TABLE_IDLE_CHRG_TGT.second, ACS_TABLE_IDLE_CHRG_TGT.first, false, true),
ctxc); ctxc);
// Build IDLE transition 0 // Build IDLE transition 0
@ -310,14 +310,14 @@ void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& eh) {
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_CHRG_TRANS_0.second); 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::RW_ASS, OFF, 0, ACS_TABLE_IDLE_CHRG_TRANS_0.second);
iht(objects::STAR_TRACKER, 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, check(ss->addTable(&ACS_TABLE_IDLE_CHRG_TRANS_0.second, ACS_TABLE_IDLE_CHRG_TRANS_0.first, false,
true), true),
ctxc); ctxc);
// Build IDLE transition 1 // Build IDLE transition 1
iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, acs::IDLE_CHARGE, iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, acs::IDLE_CHARGE,
ACS_TABLE_IDLE_CHRG_TRANS_1.second); 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, check(ss->addTable(&ACS_TABLE_IDLE_CHRG_TRANS_1.second, ACS_TABLE_IDLE_CHRG_TRANS_1.first, false,
true), true),
ctxc); ctxc);
@ -325,7 +325,7 @@ void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& eh) {
ihs(ACS_SEQUENCE_IDLE_CHRG.second, ACS_TABLE_IDLE_CHRG_TGT.first, 0, true); 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_0.first, 0, true);
ihs(ACS_SEQUENCE_IDLE_CHRG.second, ACS_TABLE_IDLE_CHRG_TRANS_1.first, 0, false); 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, check(ss->addSequence(&ACS_SEQUENCE_IDLE_CHRG.second, ACS_SEQUENCE_IDLE_CHRG.first,
ACS_SEQUENCE_SAFE.first, false, true), ACS_SEQUENCE_SAFE.first, false, true),
ctxc); ctxc);
} }
@ -339,7 +339,7 @@ void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) {
eh.setObject(obj); eh.setObject(obj);
eh.setMode(mode); eh.setMode(mode);
eh.setSubmode(submode); eh.setSubmode(submode);
CHK(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Insert Helper Sequence // Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds, auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
@ -347,7 +347,7 @@ void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) {
eh.setTableId(tableId); eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds); eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess); eh.setCheckSuccess(checkSuccess);
CHK(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Build TARGET PT table // Build TARGET PT table
@ -357,7 +357,7 @@ void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) {
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_TARGET_PT_TGT.second); 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::RW_ASS, NML, 0, ACS_TABLE_TARGET_PT_TGT.second);
iht(objects::STAR_TRACKER, 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), check(ss->addTable(&ACS_TABLE_TARGET_PT_TGT.second, ACS_TABLE_TARGET_PT_TGT.first, false, true),
ctxc); ctxc);
// Build TARGET PT transition 0 // Build TARGET PT transition 0
@ -366,13 +366,13 @@ void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) {
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second); 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::RW_ASS, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second);
iht(objects::STAR_TRACKER, 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, check(ss->addTable(&ACS_TABLE_TARGET_PT_TRANS_0.second, ACS_TABLE_TARGET_PT_TRANS_0.first, false,
true), true),
ctxc); ctxc);
// Build TARGET PT transition 1 // Build TARGET PT transition 1
iht(objects::ACS_CONTROLLER, acs::CtrlModes::TARGET_PT, 0, ACS_TABLE_TARGET_PT_TRANS_1.second); 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, check(ss->addTable(&ACS_TABLE_TARGET_PT_TRANS_1.second, ACS_TABLE_TARGET_PT_TRANS_1.first, false,
true), true),
ctxc); ctxc);
@ -380,15 +380,9 @@ void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) {
ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TGT.first, 0, true); 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_0.first, 0, true);
ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TRANS_1.first, 0, false); 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, check(ss->addSequence(&ACS_SEQUENCE_TARGET_PT.second, ACS_SEQUENCE_TARGET_PT.first,
ACS_SEQUENCE_IDLE.first, false, true), ACS_SEQUENCE_IDLE.first, false, true),
ctxc); ctxc);
} }
void checkInsert(ReturnValue_t result, const char* ctx) {
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Insertion failed at " << ctx << std::endl;
}
}
} // namespace } // namespace

View File

@ -9,9 +9,9 @@
#include "mission/devices/devicedefinitions/payloadPcduDefinitions.h" #include "mission/devices/devicedefinitions/payloadPcduDefinitions.h"
#include "mission/system/objects/PayloadSubsystem.h" #include "mission/system/objects/PayloadSubsystem.h"
#include "mission/system/objects/definitions.h" #include "mission/system/objects/definitions.h"
#include "util.h"
namespace { namespace {
void checkInsert(ReturnValue_t result, const char* ctx);
void initOffSequence(Subsystem* ss, ModeListEntry& eh); void initOffSequence(Subsystem* ss, ModeListEntry& eh);
void initPlMpsocStreamSequence(Subsystem* ss, ModeListEntry& eh); void initPlMpsocStreamSequence(Subsystem* ss, ModeListEntry& eh);
void initPlCamStreamSequence(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); void initScexSequence(Subsystem* ss, ModeListEntry& eh);
} // namespace } // namespace
const auto CHK = checkInsert; const auto check = subsystem::checkInsert;
static const auto OFF = HasModesIF::MODE_OFF; static const auto OFF = HasModesIF::MODE_OFF;
static const auto ON = HasModesIF::MODE_ON; static const auto ON = HasModesIF::MODE_ON;
static const auto NML = DeviceHandlerIF::MODE_NORMAL; static const auto NML = DeviceHandlerIF::MODE_NORMAL;
@ -95,7 +95,7 @@ void initOffSequence(Subsystem* ss, ModeListEntry& eh) {
eh.setObject(obj); eh.setObject(obj);
eh.setMode(mode); eh.setMode(mode);
eh.setSubmode(submode); eh.setSubmode(submode);
CHK(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Insert Helper Sequence // Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds, auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
@ -103,11 +103,11 @@ void initOffSequence(Subsystem* ss, ModeListEntry& eh) {
eh.setTableId(tableId); eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds); eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess); eh.setCheckSuccess(checkSuccess);
CHK(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Build OFF target. Is empty // 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 // Build OFF transition 0
iht(objects::PLOC_SWITCHER, OFF, 0, PL_TABLE_OFF_TRANS.second); 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::SCEX_HANDLER, OFF, 0, PL_TABLE_OFF_TRANS.second);
iht(objects::PLPCDU_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); 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 // Build OFF sequence
ihs(PL_SEQUENCE_OFF.second, PL_TABLE_OFF_TGT.first, 0, false); 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.first, 0, false);
ss->addSequence(&PL_SEQUENCE_OFF.second, PL_SEQUENCE_OFF.first, PL_SEQUENCE_OFF.first, false, check(ss->addSequence(
true); 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) {
@ -133,7 +134,7 @@ void initPlMpsocStreamSequence(Subsystem* ss, ModeListEntry& eh) {
eh.setObject(obj); eh.setObject(obj);
eh.setMode(mode); eh.setMode(mode);
eh.setSubmode(submode); eh.setSubmode(submode);
CHK(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Insert Helper Sequence // Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds, auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
@ -141,7 +142,7 @@ void initPlMpsocStreamSequence(Subsystem* ss, ModeListEntry& eh) {
eh.setTableId(tableId); eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds); eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess); eh.setCheckSuccess(checkSuccess);
CHK(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Build MPSoC stream target // 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::PLOC_SWITCHER, ON, 0, PL_TABLE_MPSOC_STREAM_TGT.second);
iht(objects::CAM_SWITCHER, OFF, 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_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 // Build MPSoC stream transition 0
iht(objects::PLOC_SWITCHER, ON, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); 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::CAM_SWITCHER, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second);
iht(objects::SCEX_HANDLER, 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, check(ss->addTable(
true); TableEntry(PL_TABLE_MPSOC_STREAM_TRANS_0.first, &PL_TABLE_MPSOC_STREAM_TRANS_0.second)),
ctxc);
// Build MPSoC stream transition 1 // Build MPSoC stream transition 1
iht(objects::PLOC_SUBSYSTEM, NML, payload::ploc::MPSOC_ON, PL_TABLE_MPSOC_STREAM_TRANS_1.second); 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, check(ss->addTable(
true); TableEntry(PL_TABLE_MPSOC_STREAM_TRANS_1.first, &PL_TABLE_MPSOC_STREAM_TRANS_1.second)),
ctxc);
// Build MPSoC stream sequence // 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_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_0.first, 0, true);
ihs(PL_SEQUENCE_MPSOC_STREAM.second, PL_TABLE_MPSOC_STREAM_TRANS_1.first, 0, false); 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, check(ss->addSequence(SequenceEntry(PL_SEQUENCE_MPSOC_STREAM.first,
PL_SEQUENCE_OFF.first, false, true); &PL_SEQUENCE_MPSOC_STREAM.second, PL_SEQUENCE_OFF.first)),
ctxc);
} }
void initPlCamStreamSequence(Subsystem* ss, ModeListEntry& eh) { void initPlCamStreamSequence(Subsystem* ss, ModeListEntry& eh) {
@ -181,7 +187,7 @@ void initPlCamStreamSequence(Subsystem* ss, ModeListEntry& eh) {
eh.setObject(obj); eh.setObject(obj);
eh.setMode(mode); eh.setMode(mode);
eh.setSubmode(submode); eh.setSubmode(submode);
CHK(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Insert Helper Sequence // Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds, auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
@ -189,34 +195,38 @@ void initPlCamStreamSequence(Subsystem* ss, ModeListEntry& eh) {
eh.setTableId(tableId); eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds); eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess); eh.setCheckSuccess(checkSuccess);
CHK(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Build CAM target // Build CAM target
// Only check that the PL PCDU is on for now. It might later become necessary to switch on // 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. // the PLOC, so we ignore its state.
iht(objects::PLPCDU_HANDLER, NML, plpcdu::ALL_ON_SUBMODE, PL_TABLE_CAM_STREAM_TGT.second); 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 // Build CAM transition 0
// PLOC is actively commanded off here // PLOC is actively commanded off here
iht(objects::PLOC_SUBSYSTEM, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second); 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::CAM_SWITCHER, ON, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second);
iht(objects::SCEX_HANDLER, 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, check(ss->addTable(
true); TableEntry(PL_TABLE_MPSOC_STREAM_TRANS_0.first, &PL_TABLE_MPSOC_STREAM_TRANS_0.second)),
ctxc);
// Build CAM transition 1 // Build CAM transition 1
iht(objects::PLOC_SWITCHER, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_1.second); 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, check(ss->addTable(
true); TableEntry(PL_TABLE_MPSOC_STREAM_TRANS_1.first, &PL_TABLE_MPSOC_STREAM_TRANS_1.second)),
ctxc);
// Build CAM stream sequence // 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_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_0.first, 0, true);
ihs(PL_SEQUENCE_CAM_STREAM.second, PL_TABLE_CAM_STREAM_TRANS_1.first, 0, false); 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, check(ss->addSequence(SequenceEntry(PL_SEQUENCE_CAM_STREAM.first, &PL_SEQUENCE_CAM_STREAM.second,
PL_SEQUENCE_OFF.first, false, true); PL_SEQUENCE_OFF.first)),
ctxc);
} }
void initPlSpvSequence(Subsystem* ss, ModeListEntry& eh) { void initPlSpvSequence(Subsystem* ss, ModeListEntry& eh) {
@ -228,7 +238,7 @@ void initPlSpvSequence(Subsystem* ss, ModeListEntry& eh) {
eh.setObject(obj); eh.setObject(obj);
eh.setMode(mode); eh.setMode(mode);
eh.setSubmode(submode); eh.setSubmode(submode);
CHK(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Insert Helper Sequence // Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds, auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
@ -236,18 +246,21 @@ void initPlSpvSequence(Subsystem* ss, ModeListEntry& eh) {
eh.setTableId(tableId); eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds); eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess); eh.setCheckSuccess(checkSuccess);
CHK(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Build Payload Supervisor Only target // Build Payload Supervisor Only target
iht(objects::PLOC_SWITCHER, ON, 0, PL_TABLE_SUPV_ONLY_TGT.second); 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_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 // Build Payload Supervisor Only transition 0
iht(objects::PLOC_SWITCHER, ON, 0, PL_TABLE_SUPV_ONLY_TRANS_0.second); 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); 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 // 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_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_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_0.first, 0, true);
ihs(PL_SEQUENCE_SUPV_ONLY.second, PL_TABLE_SUPV_ONLY_TRANS_1.first, 0, false); 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, check(ss->addSequence(SequenceEntry(PL_SEQUENCE_SUPV_ONLY.first, &PL_SEQUENCE_SUPV_ONLY.second,
PL_SEQUENCE_OFF.first)); PL_SEQUENCE_OFF.first)),
ctxc);
} }
void initEarthObsvSequence(Subsystem* ss, ModeListEntry& eh) { void initEarthObsvSequence(Subsystem* ss, ModeListEntry& eh) {
@ -269,7 +283,7 @@ void initEarthObsvSequence(Subsystem* ss, ModeListEntry& eh) {
eh.setObject(obj); eh.setObject(obj);
eh.setMode(mode); eh.setMode(mode);
eh.setSubmode(submode); eh.setSubmode(submode);
CHK(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Insert Helper Sequence // Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds, auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
@ -277,7 +291,7 @@ void initEarthObsvSequence(Subsystem* ss, ModeListEntry& eh) {
eh.setTableId(tableId); eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds); eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess); eh.setCheckSuccess(checkSuccess);
CHK(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Build Earth Observation target // 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::CAM_SWITCHER, ON, 0, PL_TABLE_EARTH_OBSV_TGT.second);
iht(objects::PLPCDU_HANDLER, OFF, 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); 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 // Build Earth Observation transition 0
iht(objects::PLOC_SWITCHER, ON, 0, PL_TABLE_EARTH_OBSV_TRANS_0.second); 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::CAM_SWITCHER, ON, 0, PL_TABLE_EARTH_OBSV_TRANS_0.second);
iht(objects::PLPCDU_HANDLER, OFF, 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 // Build Earth Observation transition 1
iht(objects::PLOC_SUBSYSTEM, NML, payload::ploc::MPSOC_ON, PL_TABLE_EARTH_OBSV_TRANS_1.second); 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_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_0.first, 0, true);
ihs(PL_SEQUENCE_EARTH_OBSV.second, PL_TABLE_EARTH_OBSV_TRANS_1.first, 0, false); 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, check(ss->addSequence(SequenceEntry(PL_SEQUENCE_EARTH_OBSV.first, &PL_SEQUENCE_EARTH_OBSV.second,
PL_SEQUENCE_OFF.first)); PL_SEQUENCE_OFF.first)),
ctxc);
} }
void initScexSequence(Subsystem* ss, ModeListEntry& eh) { void initScexSequence(Subsystem* ss, ModeListEntry& eh) {
@ -313,7 +333,7 @@ void initScexSequence(Subsystem* ss, ModeListEntry& eh) {
eh.setObject(obj); eh.setObject(obj);
eh.setMode(mode); eh.setMode(mode);
eh.setSubmode(submode); eh.setSubmode(submode);
CHK(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Insert Helper Sequence // Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds, auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
@ -321,28 +341,24 @@ void initScexSequence(Subsystem* ss, ModeListEntry& eh) {
eh.setTableId(tableId); eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds); eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess); eh.setCheckSuccess(checkSuccess);
CHK(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Build SCEX target // Build SCEX target
iht(objects::SCEX_HANDLER, NML, 0, PL_TABLE_SCEX_TGT.second); 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 // Build SCEX transition 0
iht(objects::SCEX_HANDLER, NML, 0, PL_TABLE_SCEX_TGT.second); 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 // Build SCEX sequence
ihs(PL_SEQUENCE_SCEX.second, PL_TABLE_SCEX_TGT.first, 0, true); 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); ihs(PL_SEQUENCE_SCEX.second, PL_TABLE_SCEX_TRANS_0.first, 0, false);
ss->addSequence( check(ss->addSequence(
SequenceEntry(PL_SEQUENCE_SCEX.first, &PL_SEQUENCE_SCEX.second, PL_SEQUENCE_OFF.first)); SequenceEntry(PL_SEQUENCE_SCEX.first, &PL_SEQUENCE_SCEX.second, PL_SEQUENCE_OFF.first)),
} ctxc);
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 } // namespace

View File

@ -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;
}
}

View File

@ -0,0 +1,12 @@
#ifndef MISSION_SYSTEM_TREE_UTIL_H_
#define MISSION_SYSTEM_TREE_UTIL_H_
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
namespace subsystem {
void checkInsert(ReturnValue_t result, const char* ctx);
}
#endif /* MISSION_SYSTEM_TREE_UTIL_H_ */