eive-obsw/mission/system/tree/payloadModeTree.cpp

376 lines
16 KiB
C++
Raw Normal View History

2022-04-25 13:36:11 +02:00
#include "payloadModeTree.h"
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <fsfw/modes/HasModesIF.h>
2022-08-29 15:56:18 +02:00
#include <fsfw/retval.h>
2022-04-25 13:36:11 +02:00
#include <fsfw/subsystem/Subsystem.h>
2022-11-03 20:57:55 +01:00
#include "eive/objects.h"
2022-04-25 18:44:38 +02:00
#include "mission/devices/devicedefinitions/payloadPcduDefinitions.h"
2022-04-25 13:36:11 +02:00
#include "mission/system/objects/PayloadSubsystem.h"
2022-04-25 18:44:38 +02:00
#include "mission/system/objects/definitions.h"
#include "util.h"
2022-04-25 13:36:11 +02:00
namespace {
2022-11-10 15:39:08 +01:00
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);
2022-04-25 13:36:11 +02:00
} // namespace
2022-11-10 15:39:08 +01:00
Subsystem satsystem::pl::SUBSYSTEM = Subsystem(objects::PL_SUBSYSTEM, 12, 24);
const auto check = subsystem::checkInsert;
2022-04-25 13:36:11 +02:00
static const auto OFF = HasModesIF::MODE_OFF;
2022-04-25 18:44:38 +02:00
static const auto ON = HasModesIF::MODE_ON;
static const auto NML = DeviceHandlerIF::MODE_NORMAL;
2022-04-25 13:36:11 +02:00
2023-01-20 10:08:41 +01:00
auto PL_SEQUENCE_OFF = std::make_pair(payload::Mode::OFF << 24, FixedArrayList<ModeListEntry, 3>());
auto PL_TABLE_OFF_TGT =
std::make_pair((payload::Mode::OFF << 24) | 1, FixedArrayList<ModeListEntry, 1>());
auto PL_TABLE_OFF_TRANS_0 =
std::make_pair((payload::Mode::OFF << 24) | 2, FixedArrayList<ModeListEntry, 5>());
auto PL_TABLE_OFF_TRANS_1 =
std::make_pair((payload::Mode::OFF << 24) | 3, FixedArrayList<ModeListEntry, 1>());
2022-04-25 13:36:11 +02:00
2022-04-25 18:44:38 +02:00
auto PL_SEQUENCE_MPSOC_STREAM =
2023-01-20 10:08:41 +01:00
std::make_pair(payload::Mode::MPSOC_STREAM << 24, FixedArrayList<ModeListEntry, 3>());
2022-04-25 18:44:38 +02:00
auto PL_TABLE_MPSOC_STREAM_TGT =
2023-01-20 10:08:41 +01:00
std::make_pair((payload::Mode::MPSOC_STREAM << 24) | 1, FixedArrayList<ModeListEntry, 5>());
2022-04-25 18:44:38 +02:00
auto PL_TABLE_MPSOC_STREAM_TRANS_0 =
2023-01-20 10:08:41 +01:00
std::make_pair((payload::Mode::MPSOC_STREAM << 24) | 2, FixedArrayList<ModeListEntry, 4>());
2022-04-25 18:44:38 +02:00
auto PL_TABLE_MPSOC_STREAM_TRANS_1 =
2023-01-20 10:08:41 +01:00
std::make_pair((payload::Mode::MPSOC_STREAM << 24) | 3, FixedArrayList<ModeListEntry, 2>());
2022-04-25 18:44:38 +02:00
auto PL_SEQUENCE_CAM_STREAM =
2023-01-20 10:08:41 +01:00
std::make_pair(payload::Mode::CAM_STREAM << 24, FixedArrayList<ModeListEntry, 3>());
2022-04-25 18:44:38 +02:00
auto PL_TABLE_CAM_STREAM_TGT =
2023-01-20 10:08:41 +01:00
std::make_pair((payload::Mode::CAM_STREAM << 24) | 1, FixedArrayList<ModeListEntry, 2>());
2022-04-25 18:44:38 +02:00
auto PL_TABLE_CAM_STREAM_TRANS_0 =
2023-01-20 10:08:41 +01:00
std::make_pair((payload::Mode::CAM_STREAM << 24) | 2, FixedArrayList<ModeListEntry, 4>());
2022-04-28 15:05:38 +02:00
auto PL_TABLE_CAM_STREAM_TRANS_1 =
2023-01-20 10:08:41 +01:00
std::make_pair((payload::Mode::CAM_STREAM << 24) | 3, FixedArrayList<ModeListEntry, 2>());
2022-04-25 18:44:38 +02:00
auto PL_SEQUENCE_SUPV_ONLY =
2023-01-20 10:08:41 +01:00
std::make_pair(payload::Mode::SUPV_ONLY << 24, FixedArrayList<ModeListEntry, 3>());
2022-04-25 18:44:38 +02:00
auto PL_TABLE_SUPV_ONLY_TGT =
2023-01-20 10:08:41 +01:00
std::make_pair((payload::Mode::SUPV_ONLY << 24) | 1, FixedArrayList<ModeListEntry, 5>());
2022-04-25 18:44:38 +02:00
auto PL_TABLE_SUPV_ONLY_TRANS_0 =
2023-01-20 10:08:41 +01:00
std::make_pair((payload::Mode::SUPV_ONLY << 24) | 2, FixedArrayList<ModeListEntry, 5>());
2022-04-25 18:44:38 +02:00
auto PL_TABLE_SUPV_ONLY_TRANS_1 =
2023-01-20 10:08:41 +01:00
std::make_pair((payload::Mode::SUPV_ONLY << 24) | 3, FixedArrayList<ModeListEntry, 5>());
2022-04-28 15:05:38 +02:00
auto PL_SEQUENCE_EARTH_OBSV =
2023-01-20 10:08:41 +01:00
std::make_pair(payload::Mode::EARTH_OBSV << 24, FixedArrayList<ModeListEntry, 3>());
2022-04-28 15:05:38 +02:00
auto PL_TABLE_EARTH_OBSV_TGT =
2023-01-20 10:08:41 +01:00
std::make_pair((payload::Mode::EARTH_OBSV << 24) | 1, FixedArrayList<ModeListEntry, 5>());
2022-04-28 15:05:38 +02:00
auto PL_TABLE_EARTH_OBSV_TRANS_0 =
2023-01-20 10:08:41 +01:00
std::make_pair((payload::Mode::EARTH_OBSV << 24) | 2, FixedArrayList<ModeListEntry, 3>());
2022-04-28 15:05:38 +02:00
auto PL_TABLE_EARTH_OBSV_TRANS_1 =
2023-01-20 10:08:41 +01:00
std::make_pair((payload::Mode::EARTH_OBSV << 24) | 3, FixedArrayList<ModeListEntry, 2>());
2022-04-28 15:05:38 +02:00
auto PL_SEQUENCE_SCEX =
2023-01-20 10:08:41 +01:00
std::make_pair(payload::Mode::SCEX << 24, FixedArrayList<ModeListEntry, 2>());
2022-04-28 15:05:38 +02:00
auto PL_TABLE_SCEX_TGT =
2023-01-20 10:08:41 +01:00
std::make_pair((payload::Mode::SCEX << 24) | 1, FixedArrayList<ModeListEntry, 1>());
2022-04-28 15:05:38 +02:00
auto PL_TABLE_SCEX_TRANS_0 =
2023-01-20 10:08:41 +01:00
std::make_pair((payload::Mode::SCEX << 24) | 2, FixedArrayList<ModeListEntry, 1>());
2022-04-25 18:44:38 +02:00
2022-04-25 13:36:11 +02:00
void satsystem::pl::init() {
ModeListEntry entry;
2022-11-10 15:39:08 +01:00
initOffSequence(SUBSYSTEM, entry);
initPlMpsocStreamSequence(SUBSYSTEM, entry);
initPlCamStreamSequence(SUBSYSTEM, entry);
initPlSpvSequence(SUBSYSTEM, entry);
initEarthObsvSequence(SUBSYSTEM, entry);
initScexSequence(SUBSYSTEM, entry);
SUBSYSTEM.setInitialMode(OFF);
2022-04-25 13:36:11 +02:00
}
namespace {
2022-11-10 15:39:08 +01:00
void initOffSequence(Subsystem& ss, ModeListEntry& eh) {
2022-04-25 13:36:11 +02:00
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<ModeListEntry>& sequence) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
check(sequence.insert(eh), ctxc);
2022-04-25 13:36:11 +02:00
};
// Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
check(sequence.insert(eh), ctxc);
2022-04-25 13:36:11 +02:00
};
// Build OFF target. Is empty
2022-11-10 15:39:08 +01:00
check(ss.addTable(TableEntry(PL_TABLE_OFF_TGT.first, &PL_TABLE_OFF_TGT.second)), ctxc);
2022-04-25 13:36:11 +02:00
// Build OFF transition 0
2022-11-03 22:59:51 +01:00
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);
2022-11-10 15:39:08 +01:00
check(ss.addTable(TableEntry(PL_TABLE_OFF_TRANS_0.first, &PL_TABLE_OFF_TRANS_0.second)), ctxc);
2022-11-03 22:59:51 +01:00
// Build OFF transition 1
iht(objects::PLOC_SUPERVISOR_HANDLER, OFF, 0, PL_TABLE_OFF_TRANS_1.second);
2022-11-10 15:39:08 +01:00
check(ss.addTable(TableEntry(PL_TABLE_OFF_TRANS_1.first, &PL_TABLE_OFF_TRANS_1.second)), ctxc);
2022-04-25 13:36:11 +02:00
// Build OFF sequence
ihs(PL_SEQUENCE_OFF.second, PL_TABLE_OFF_TGT.first, 0, false);
2022-11-03 22:59:51 +01:00
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);
2022-11-10 15:39:08 +01:00
check(ss.addSequence(
SequenceEntry(PL_SEQUENCE_OFF.first, &PL_SEQUENCE_OFF.second, PL_SEQUENCE_OFF.first)),
ctxc);
2022-04-25 13:36:11 +02:00
}
2022-11-10 15:39:08 +01:00
void initPlMpsocStreamSequence(Subsystem& ss, ModeListEntry& eh) {
2022-04-25 18:44:38 +02:00
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,
ArrayList<ModeListEntry>& sequence) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
check(sequence.insert(eh), ctxc);
2022-04-25 18:44:38 +02:00
};
// Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
check(sequence.insert(eh), ctxc);
2022-04-25 18:44:38 +02:00
};
// Build MPSoC stream target
// Camera should always be off to prevent a conflict with the MPSoC streaming
2022-11-03 22:59:51 +01:00
// PL PCDU must be on and in normal mode, but this is commanded separately because of the
// number of commands invovled
2022-04-25 18:44:38 +02:00
iht(objects::PLPCDU_HANDLER, NML, plpcdu::ALL_ON_SUBMODE, PL_TABLE_MPSOC_STREAM_TGT.second);
iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_MPSOC_STREAM_TGT.second);
2022-11-03 22:59:51 +01:00
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);
2022-11-10 15:39:08 +01:00
check(ss.addTable(TableEntry(PL_TABLE_MPSOC_STREAM_TGT.first, &PL_TABLE_MPSOC_STREAM_TGT.second)),
ctxc);
2022-04-25 18:44:38 +02:00
// 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);
2022-11-10 15:12:50 +01:00
iht(objects::PLOC_SUPERVISOR_HANDLER, NML, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second);
2022-11-10 15:39:08 +01:00
check(ss.addTable(
TableEntry(PL_TABLE_MPSOC_STREAM_TRANS_0.first, &PL_TABLE_MPSOC_STREAM_TRANS_0.second)),
ctxc);
2022-04-25 18:44:38 +02:00
// Build MPSoC stream transition 1
2022-11-10 15:12:50 +01:00
iht(objects::PLOC_MPSOC_HANDLER, NML, 0, PL_TABLE_MPSOC_STREAM_TRANS_1.second);
2022-11-10 15:39:08 +01:00
check(ss.addTable(
TableEntry(PL_TABLE_MPSOC_STREAM_TRANS_1.first, &PL_TABLE_MPSOC_STREAM_TRANS_1.second)),
ctxc);
2022-04-25 18:44:38 +02:00
// 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);
2022-11-10 15:39:08 +01:00
check(ss.addSequence(SequenceEntry(PL_SEQUENCE_MPSOC_STREAM.first,
&PL_SEQUENCE_MPSOC_STREAM.second, PL_SEQUENCE_OFF.first)),
ctxc);
2022-04-25 18:44:38 +02:00
}
2022-11-10 15:39:08 +01:00
void initPlCamStreamSequence(Subsystem& ss, ModeListEntry& eh) {
2022-11-10 15:12:50 +01:00
std::string context = "satsystem::payload::initPlCamStreamSequence";
2022-04-25 13:36:11 +02:00
auto ctxc = context.c_str();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
ArrayList<ModeListEntry>& sequence) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
check(sequence.insert(eh), ctxc);
2022-04-25 13:36:11 +02:00
};
// Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
check(sequence.insert(eh), ctxc);
2022-04-25 13:36:11 +02:00
};
2022-04-25 18:44:38 +02:00
// 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);
2022-11-10 15:39:08 +01:00
check(ss.addTable(TableEntry(PL_TABLE_CAM_STREAM_TGT.first, &PL_TABLE_CAM_STREAM_TGT.second)),
ctxc);
2022-04-25 18:44:38 +02:00
// Build CAM transition 0
// PLOC is actively commanded off here
2022-11-10 15:12:50 +01:00
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);
2022-11-10 15:39:08 +01:00
check(ss.addTable(
2022-11-10 15:12:50 +01:00
TableEntry(PL_TABLE_CAM_STREAM_TRANS_0.first, &PL_TABLE_CAM_STREAM_TRANS_0.second)),
ctxc);
2022-04-25 18:44:38 +02:00
// Build CAM transition 1
2022-11-10 15:12:50 +01:00
iht(objects::PLOC_SUPERVISOR_HANDLER, OFF, 0, PL_TABLE_CAM_STREAM_TRANS_1.second);
2022-11-10 15:39:08 +01:00
check(ss.addTable(
2022-11-10 15:12:50 +01:00
TableEntry(PL_TABLE_CAM_STREAM_TRANS_1.first, &PL_TABLE_CAM_STREAM_TRANS_1.second)),
ctxc);
2022-04-25 18:44:38 +02:00
// 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);
2022-11-10 15:39:08 +01:00
check(ss.addSequence(SequenceEntry(PL_SEQUENCE_CAM_STREAM.first, &PL_SEQUENCE_CAM_STREAM.second,
PL_SEQUENCE_OFF.first)),
ctxc);
2022-04-25 13:36:11 +02:00
}
2022-11-10 15:39:08 +01:00
void initPlSpvSequence(Subsystem& ss, ModeListEntry& eh) {
2022-04-25 18:44:38 +02:00
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<ModeListEntry>& sequence) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
check(sequence.insert(eh), ctxc);
2022-04-25 18:44:38 +02:00
};
// Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
check(sequence.insert(eh), ctxc);
2022-04-25 18:44:38 +02:00
};
// Build Payload Supervisor Only target
iht(objects::PLOC_SUPERVISOR_HANDLER, NML, 0, PL_TABLE_SUPV_ONLY_TGT.second);
2022-11-10 15:39:08 +01:00
check(ss.addTable(TableEntry(PL_TABLE_SUPV_ONLY_TGT.first, &PL_TABLE_SUPV_ONLY_TGT.second)),
ctxc);
2022-04-25 13:36:11 +02:00
2022-04-25 18:44:38 +02:00
// Build Payload Supervisor Only transition 0
iht(objects::PLOC_SUPERVISOR_HANDLER, NML, 0, PL_TABLE_SUPV_ONLY_TRANS_0.second);
2022-04-28 15:05:38 +02:00
iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_SUPV_ONLY_TRANS_0.second);
2022-11-10 15:39:08 +01:00
check(
ss.addTable(TableEntry(PL_TABLE_SUPV_ONLY_TRANS_0.first, &PL_TABLE_SUPV_ONLY_TRANS_0.second)),
ctxc);
2022-04-28 15:05:38 +02:00
// Build Payload Supervisor Only transition 1
iht(objects::PLOC_MPSOC_HANDLER, OFF, 0, PL_TABLE_SUPV_ONLY_TRANS_1.second);
2022-11-10 15:39:08 +01:00
check(
ss.addTable(TableEntry(PL_TABLE_SUPV_ONLY_TRANS_1.first, &PL_TABLE_SUPV_ONLY_TRANS_1.second)),
ctxc);
2022-04-28 15:05:38 +02:00
// 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);
2022-11-10 15:39:08 +01:00
check(ss.addSequence(SequenceEntry(PL_SEQUENCE_SUPV_ONLY.first, &PL_SEQUENCE_SUPV_ONLY.second,
PL_SEQUENCE_OFF.first)),
ctxc);
2022-04-28 15:05:38 +02:00
}
2022-11-10 15:39:08 +01:00
void initEarthObsvSequence(Subsystem& ss, ModeListEntry& eh) {
2022-04-28 15:05:38 +02:00
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<ModeListEntry>& sequence) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
check(sequence.insert(eh), ctxc);
2022-04-28 15:05:38 +02:00
};
// Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
check(sequence.insert(eh), ctxc);
2022-04-28 15:05:38 +02:00
};
2022-04-25 18:44:38 +02:00
2022-04-28 15:05:38 +02:00
// Build Earth Observation target
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);
2022-04-28 15:05:38 +02:00
iht(objects::CAM_SWITCHER, ON, 0, PL_TABLE_EARTH_OBSV_TGT.second);
iht(objects::PLPCDU_HANDLER, OFF, 0, PL_TABLE_EARTH_OBSV_TGT.second);
2022-11-10 15:39:08 +01:00
check(ss.addTable(TableEntry(PL_TABLE_EARTH_OBSV_TGT.first, &PL_TABLE_EARTH_OBSV_TGT.second)),
ctxc);
2022-04-28 15:05:38 +02:00
// Build Earth Observation transition 0
iht(objects::PLOC_SUPERVISOR_HANDLER, NML, 0, PL_TABLE_EARTH_OBSV_TRANS_0.second);
2022-04-28 15:05:38 +02:00
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);
2022-11-10 15:39:08 +01:00
check(ss.addTable(
TableEntry(PL_TABLE_EARTH_OBSV_TRANS_0.first, &PL_TABLE_EARTH_OBSV_TRANS_0.second)),
ctxc);
2022-04-28 15:05:38 +02:00
// Build Earth Observation transition 1
iht(objects::PLOC_MPSOC_HANDLER, NML, 0, PL_TABLE_CAM_STREAM_TRANS_1.second);
2022-11-10 15:39:08 +01:00
check(ss.addTable(
TableEntry(PL_TABLE_EARTH_OBSV_TRANS_1.first, &PL_TABLE_EARTH_OBSV_TRANS_1.second)),
ctxc);
2022-04-28 15:05:38 +02:00
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);
2022-11-10 15:39:08 +01:00
check(ss.addSequence(SequenceEntry(PL_SEQUENCE_EARTH_OBSV.first, &PL_SEQUENCE_EARTH_OBSV.second,
PL_SEQUENCE_OFF.first)),
ctxc);
2022-04-25 18:44:38 +02:00
}
2022-04-25 13:36:11 +02:00
2022-11-10 15:39:08 +01:00
void initScexSequence(Subsystem& ss, ModeListEntry& eh) {
2022-04-28 15:05:38 +02:00
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<ModeListEntry>& sequence) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
check(sequence.insert(eh), ctxc);
2022-04-28 15:05:38 +02:00
};
// Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
check(sequence.insert(eh), ctxc);
2022-04-28 15:05:38 +02:00
};
// Build SCEX target
iht(objects::SCEX, NML, 0, PL_TABLE_SCEX_TGT.second);
2022-11-10 15:39:08 +01:00
check(ss.addTable(TableEntry(PL_TABLE_SCEX_TGT.first, &PL_TABLE_SCEX_TGT.second)), ctxc);
2022-04-25 13:36:11 +02:00
2022-04-28 15:05:38 +02:00
// Build SCEX transition 0
2022-11-10 15:39:08 +01:00
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);
2022-04-28 15:05:38 +02:00
// 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);
2022-11-10 15:39:08 +01:00
check(ss.addSequence(
SequenceEntry(PL_SEQUENCE_SCEX.first, &PL_SEQUENCE_SCEX.second, PL_SEQUENCE_OFF.first)),
ctxc);
2022-04-25 13:36:11 +02:00
}
} // namespace