started acs subsystem
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
This commit is contained in:
116
mission/system/tree/payloadModeTree.cpp
Normal file
116
mission/system/tree/payloadModeTree.cpp
Normal file
@@ -0,0 +1,116 @@
|
||||
#include "payloadModeTree.h"
|
||||
|
||||
#include <commonObjects.h>
|
||||
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||
#include <fsfw/modes/HasModesIF.h>
|
||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||
#include <fsfw/subsystem/Subsystem.h>
|
||||
|
||||
#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<ModeListEntry, 2>());
|
||||
auto PL_TABLE_OFF_TGT = std::make_pair((OFF << 24) | 1, FixedArrayList<ModeListEntry, 0>());
|
||||
auto PL_TABLE_OFF_TRANS = std::make_pair((OFF << 24) | 2, FixedArrayList<ModeListEntry, 5>());
|
||||
|
||||
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<ModeListEntry>& sequence) {
|
||||
eh.setObject(obj);
|
||||
eh.setMode(mode);
|
||||
eh.setSubmode(submode);
|
||||
CHK(sequence.insert(eh), ctxc);
|
||||
};
|
||||
// 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);
|
||||
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<ModeListEntry>& sequence) {
|
||||
eh.setObject(obj);
|
||||
eh.setMode(mode);
|
||||
eh.setSubmode(submode);
|
||||
CHK(sequence.insert(eh), ctxc);
|
||||
};
|
||||
// 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);
|
||||
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
|
||||
Reference in New Issue
Block a user