2022-04-25 08:48:22 +02:00
|
|
|
#include "acsModeTree.h"
|
|
|
|
|
2022-10-10 17:40:30 +02:00
|
|
|
#include <fsfw/container/FixedMap.h>
|
2022-04-22 17:49:28 +02:00
|
|
|
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
2022-04-22 17:00:23 +02:00
|
|
|
#include <fsfw/modes/HasModesIF.h>
|
2022-04-25 08:48:22 +02:00
|
|
|
#include <fsfw/subsystem/Subsystem.h>
|
|
|
|
#include <fsfw/subsystem/modes/ModeDefinitions.h>
|
2022-04-22 17:00:23 +02:00
|
|
|
|
2022-09-29 19:40:00 +02:00
|
|
|
#include "eive/objects.h"
|
2023-02-02 16:27:50 +01:00
|
|
|
#include "mission/acsDefs.h"
|
2022-04-28 16:20:41 +02:00
|
|
|
#include "util.h"
|
2022-04-22 17:49:28 +02:00
|
|
|
|
2022-10-17 10:52:05 +02:00
|
|
|
Subsystem satsystem::acs::ACS_SUBSYSTEM(objects::ACS_SUBSYSTEM, 12, 24);
|
|
|
|
|
2022-04-25 13:36:11 +02:00
|
|
|
namespace {
|
2022-10-17 10:52:05 +02:00
|
|
|
// Alias for checker function
|
|
|
|
const auto check = subsystem::checkInsert;
|
2022-09-29 19:40:00 +02:00
|
|
|
|
2022-11-14 13:46:26 +01:00
|
|
|
void buildOffSequence(Subsystem& ss, ModeListEntry& eh);
|
2022-11-14 13:36:51 +01:00
|
|
|
void buildDetumbleSequence(Subsystem& ss, ModeListEntry& entryHelper);
|
|
|
|
void buildSafeSequence(Subsystem& ss, ModeListEntry& entryHelper);
|
|
|
|
void buildIdleSequence(Subsystem& ss, ModeListEntry& entryHelper);
|
|
|
|
void buildTargetPtSequence(Subsystem& ss, ModeListEntry& entryHelper);
|
2022-04-25 13:36:11 +02:00
|
|
|
} // namespace
|
2022-04-25 10:50:59 +02:00
|
|
|
|
2022-04-22 17:49:28 +02:00
|
|
|
static const auto OFF = HasModesIF::MODE_OFF;
|
|
|
|
static const auto NML = DeviceHandlerIF::MODE_NORMAL;
|
2022-04-22 17:00:23 +02:00
|
|
|
|
2023-02-02 16:27:50 +01:00
|
|
|
auto ACS_SEQUENCE_OFF = std::make_pair(acs::CtrlSubmode::OFF, FixedArrayList<ModeListEntry, 2>());
|
2022-04-25 08:48:22 +02:00
|
|
|
auto ACS_TABLE_OFF_TGT =
|
2023-02-02 16:27:50 +01:00
|
|
|
std::make_pair((acs::CtrlSubmode::OFF << 24) | 1, FixedArrayList<ModeListEntry, 1>());
|
2022-04-25 08:48:22 +02:00
|
|
|
auto ACS_TABLE_OFF_TRANS =
|
2023-02-02 16:27:50 +01:00
|
|
|
std::make_pair((acs::CtrlSubmode::OFF << 24) | 2, FixedArrayList<ModeListEntry, 6>());
|
2022-04-25 08:48:22 +02:00
|
|
|
|
|
|
|
auto ACS_SEQUENCE_DETUMBLE =
|
2023-02-02 16:27:50 +01:00
|
|
|
std::make_pair(acs::CtrlSubmode::DETUMBLE, FixedArrayList<ModeListEntry, 3>());
|
2022-04-25 08:48:22 +02:00
|
|
|
auto ACS_TABLE_DETUMBLE_TGT =
|
2023-02-02 16:27:50 +01:00
|
|
|
std::make_pair((acs::CtrlSubmode::DETUMBLE << 24) | 1, FixedArrayList<ModeListEntry, 4>());
|
2022-04-25 08:48:22 +02:00
|
|
|
auto ACS_TABLE_DETUMBLE_TRANS_0 =
|
2023-02-02 16:27:50 +01:00
|
|
|
std::make_pair((acs::CtrlSubmode::DETUMBLE << 24) | 2, FixedArrayList<ModeListEntry, 5>());
|
2022-04-25 08:48:22 +02:00
|
|
|
auto ACS_TABLE_DETUMBLE_TRANS_1 =
|
2023-02-02 16:27:50 +01:00
|
|
|
std::make_pair((acs::CtrlSubmode::DETUMBLE << 24) | 3, FixedArrayList<ModeListEntry, 1>());
|
2022-04-25 08:48:22 +02:00
|
|
|
|
2023-02-02 16:27:50 +01:00
|
|
|
auto ACS_SEQUENCE_SAFE = std::make_pair(acs::CtrlSubmode::SAFE, FixedArrayList<ModeListEntry, 3>());
|
2022-04-25 10:08:29 +02:00
|
|
|
auto ACS_TABLE_SAFE_TGT =
|
2023-02-02 16:27:50 +01:00
|
|
|
std::make_pair((acs::CtrlSubmode::SAFE << 24) | 1, FixedArrayList<ModeListEntry, 4>());
|
2022-04-25 10:08:29 +02:00
|
|
|
auto ACS_TABLE_SAFE_TRANS_0 =
|
2023-02-02 16:27:50 +01:00
|
|
|
std::make_pair((acs::CtrlSubmode::SAFE << 24) | 2, FixedArrayList<ModeListEntry, 5>());
|
2022-04-25 10:08:29 +02:00
|
|
|
auto ACS_TABLE_SAFE_TRANS_1 =
|
2023-02-02 16:27:50 +01:00
|
|
|
std::make_pair((acs::CtrlSubmode::SAFE << 24) | 3, FixedArrayList<ModeListEntry, 1>());
|
2022-04-25 10:08:29 +02:00
|
|
|
|
2023-02-02 16:27:50 +01:00
|
|
|
auto ACS_SEQUENCE_IDLE = std::make_pair(acs::CtrlSubmode::IDLE, FixedArrayList<ModeListEntry, 3>());
|
2022-04-25 10:08:29 +02:00
|
|
|
auto ACS_TABLE_IDLE_TGT =
|
2023-02-02 16:27:50 +01:00
|
|
|
std::make_pair((acs::CtrlSubmode::IDLE << 24) | 1, FixedArrayList<ModeListEntry, 6>());
|
2022-04-25 10:08:29 +02:00
|
|
|
auto ACS_TABLE_IDLE_TRANS_0 =
|
2023-02-02 16:27:50 +01:00
|
|
|
std::make_pair((acs::CtrlSubmode::IDLE << 24) | 2, FixedArrayList<ModeListEntry, 6>());
|
2022-04-25 10:08:29 +02:00
|
|
|
auto ACS_TABLE_IDLE_TRANS_1 =
|
2023-02-02 16:27:50 +01:00
|
|
|
std::make_pair((acs::CtrlSubmode::IDLE << 24) | 3, FixedArrayList<ModeListEntry, 2>());
|
|
|
|
|
|
|
|
auto ACS_SEQUENCE_PTG_TARGET =
|
|
|
|
std::make_pair(acs::CtrlSubmode::PTG_TARGET, FixedArrayList<ModeListEntry, 3>());
|
|
|
|
auto ACS_TABLE_PTG_TARGET_TGT =
|
|
|
|
std::make_pair((acs::CtrlSubmode::PTG_TARGET << 24) | 1, FixedArrayList<ModeListEntry, 6>());
|
|
|
|
auto ACS_TABLE_PTG_TARGET_TRANS_0 =
|
|
|
|
std::make_pair((acs::CtrlSubmode::PTG_TARGET << 24) | 2, FixedArrayList<ModeListEntry, 5>());
|
|
|
|
auto ACS_TABLE_PTG_TARGET_TRANS_1 =
|
|
|
|
std::make_pair((acs::CtrlSubmode::PTG_TARGET << 24) | 3, FixedArrayList<ModeListEntry, 1>());
|
|
|
|
|
|
|
|
/*
|
|
|
|
auto ACS_SEQUENCE_PTG_TARGET =
|
|
|
|
std::make_pair(acs::CtrlSubmode::TARGET_PT, FixedArrayList<ModeListEntry, 3>());
|
2022-04-25 10:08:29 +02:00
|
|
|
auto ACS_TABLE_TARGET_PT_TGT =
|
2023-02-02 16:27:50 +01:00
|
|
|
std::make_pair((acs::CtrlSubmode::TARGET_PT << 24) | 1, FixedArrayList<ModeListEntry, 6>());
|
2022-04-25 10:08:29 +02:00
|
|
|
auto ACS_TABLE_TARGET_PT_TRANS_0 =
|
2023-02-02 16:27:50 +01:00
|
|
|
std::make_pair((acs::CtrlSubmode::TARGET_PT << 24) | 2, FixedArrayList<ModeListEntry, 5>());
|
2022-04-25 10:08:29 +02:00
|
|
|
auto ACS_TABLE_TARGET_PT_TRANS_1 =
|
2023-02-02 16:27:50 +01:00
|
|
|
std::make_pair((acs::CtrlSubmode::TARGET_PT << 24) | 3, FixedArrayList<ModeListEntry, 1>());
|
|
|
|
*/
|
2022-04-25 10:08:29 +02:00
|
|
|
|
2022-04-25 13:36:11 +02:00
|
|
|
void satsystem::acs::init() {
|
2022-04-22 17:00:23 +02:00
|
|
|
ModeListEntry entry;
|
2022-11-14 13:36:51 +01:00
|
|
|
buildOffSequence(ACS_SUBSYSTEM, entry);
|
|
|
|
buildSafeSequence(ACS_SUBSYSTEM, entry);
|
|
|
|
buildDetumbleSequence(ACS_SUBSYSTEM, entry);
|
|
|
|
buildIdleSequence(ACS_SUBSYSTEM, entry);
|
|
|
|
buildTargetPtSequence(ACS_SUBSYSTEM, entry);
|
2023-02-02 16:27:50 +01:00
|
|
|
ACS_SUBSYSTEM.setInitialMode(::acs::CtrlSubmode::SAFE);
|
2022-04-22 17:00:23 +02:00
|
|
|
}
|
|
|
|
|
2022-04-25 13:36:11 +02:00
|
|
|
namespace {
|
|
|
|
|
2022-11-14 13:36:51 +01:00
|
|
|
void buildOffSequence(Subsystem& ss, ModeListEntry& eh) {
|
2022-04-25 13:36:11 +02:00
|
|
|
std::string context = "satsystem::acs::buildOffSequence";
|
2022-04-22 17:49:28 +02:00
|
|
|
auto ctxc = context.c_str();
|
2022-04-25 10:08:29 +02:00
|
|
|
// Insert Helper Table
|
2022-04-25 10:30:47 +02:00
|
|
|
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) {
|
2022-04-25 08:48:22 +02:00
|
|
|
eh.setObject(obj);
|
|
|
|
eh.setMode(mode);
|
|
|
|
eh.setSubmode(submode);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(table.insert(eh), ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
};
|
|
|
|
// Insert Helper Sequence
|
2022-04-25 10:30:47 +02:00
|
|
|
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
|
|
|
|
bool checkSuccess) {
|
2022-04-25 10:08:29 +02:00
|
|
|
eh.setTableId(tableId);
|
|
|
|
eh.setWaitSeconds(waitSeconds);
|
|
|
|
eh.setCheckSuccess(checkSuccess);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(sequence.insert(eh), ctxc);
|
2022-04-25 08:48:22 +02:00
|
|
|
};
|
2022-04-22 17:00:23 +02:00
|
|
|
|
2022-04-25 10:08:29 +02:00
|
|
|
// OFF Target table is empty
|
2022-11-14 13:36:51 +01:00
|
|
|
check(ss.addTable(&ACS_TABLE_OFF_TGT.second, ACS_TABLE_OFF_TGT.first, false, true), ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
|
2022-04-22 17:00:23 +02:00
|
|
|
// Build OFF transition
|
2022-04-25 10:08:29 +02:00
|
|
|
iht(objects::ACS_CONTROLLER, OFF, 0, ACS_TABLE_OFF_TRANS.second);
|
|
|
|
iht(objects::IMTQ_HANDLER, OFF, 0, ACS_TABLE_OFF_TRANS.second);
|
|
|
|
iht(objects::STAR_TRACKER, 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::RW_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second);
|
2022-11-14 13:36:51 +01:00
|
|
|
check(ss.addTable(&ACS_TABLE_OFF_TRANS.second, ACS_TABLE_OFF_TRANS.first, false, true), ctxc);
|
2022-04-22 17:00:23 +02:00
|
|
|
|
|
|
|
// Build OFF sequence
|
2022-04-25 10:08:29 +02:00
|
|
|
ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TGT.first, 0, false);
|
|
|
|
ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TRANS.first, 0, false);
|
2022-11-14 13:36:51 +01:00
|
|
|
check(ss.addSequence(&ACS_SEQUENCE_OFF.second, ACS_SEQUENCE_OFF.first, ACS_SEQUENCE_OFF.first,
|
2022-11-14 13:46:26 +01:00
|
|
|
false, true),
|
2022-04-28 16:20:41 +02:00
|
|
|
ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
}
|
2022-04-22 17:00:23 +02:00
|
|
|
|
2022-11-14 13:36:51 +01:00
|
|
|
void buildSafeSequence(Subsystem& ss, ModeListEntry& eh) {
|
2022-04-25 13:36:11 +02:00
|
|
|
std::string context = "satsystem::acs::buildSafeSequence";
|
2022-04-25 10:08:29 +02:00
|
|
|
auto ctxc = context.c_str();
|
|
|
|
// Insert Helper Table
|
|
|
|
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
|
2022-04-25 10:30:47 +02:00
|
|
|
ArrayList<ModeListEntry>& sequence) {
|
2022-04-25 10:08:29 +02:00
|
|
|
eh.setObject(obj);
|
|
|
|
eh.setMode(mode);
|
|
|
|
eh.setSubmode(submode);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(sequence.insert(eh), ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
};
|
|
|
|
// Insert Helper Sequence
|
2022-04-25 10:30:47 +02:00
|
|
|
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
|
|
|
|
bool checkSuccess) {
|
2022-04-25 10:08:29 +02:00
|
|
|
eh.setTableId(tableId);
|
|
|
|
eh.setWaitSeconds(waitSeconds);
|
|
|
|
eh.setCheckSuccess(checkSuccess);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(sequence.insert(eh), ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
};
|
|
|
|
// Build SAFE target
|
2023-02-02 16:27:50 +01:00
|
|
|
iht(objects::ACS_CONTROLLER, acs::CtrlSubmode::SAFE, 0, ACS_TABLE_SAFE_TGT.second);
|
2022-04-25 10:08:29 +02:00
|
|
|
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);
|
2022-11-14 13:36:51 +01:00
|
|
|
check(ss.addTable(&ACS_TABLE_SAFE_TGT.second, ACS_TABLE_SAFE_TGT.first, false, true), ctxc);
|
2022-04-22 17:00:23 +02:00
|
|
|
|
2022-04-25 10:08:29 +02:00
|
|
|
// Build SAFE transition 0
|
|
|
|
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_SAFE_TRANS_0.second);
|
|
|
|
iht(objects::SUS_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::RW_ASS, OFF, 0, ACS_TABLE_SAFE_TRANS_0.second);
|
2022-11-14 13:36:51 +01:00
|
|
|
check(ss.addTable(&ACS_TABLE_SAFE_TRANS_0.second, ACS_TABLE_SAFE_TRANS_0.first, false, true),
|
2022-04-28 16:20:41 +02:00
|
|
|
ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
|
|
|
|
// Build SAFE transition 1
|
2023-02-02 16:27:50 +01:00
|
|
|
iht(objects::ACS_CONTROLLER, acs::CtrlSubmode::SAFE, 0, ACS_TABLE_SAFE_TRANS_1.second);
|
2022-11-14 13:36:51 +01:00
|
|
|
check(ss.addTable(&ACS_TABLE_SAFE_TRANS_1.second, ACS_TABLE_SAFE_TRANS_1.first, false, true),
|
2022-04-28 16:20:41 +02:00
|
|
|
ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
|
|
|
|
// Build SAFE sequence
|
2022-04-25 10:30:47 +02:00
|
|
|
ihs(ACS_SEQUENCE_SAFE.second, ACS_TABLE_SAFE_TGT.first, 0, true);
|
2022-04-25 10:08:29 +02:00
|
|
|
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);
|
2022-11-14 13:36:51 +01:00
|
|
|
check(ss.addSequence(&ACS_SEQUENCE_SAFE.second, ACS_SEQUENCE_SAFE.first, ACS_SEQUENCE_SAFE.first,
|
2022-11-14 13:46:26 +01:00
|
|
|
false, true),
|
2022-04-28 16:20:41 +02:00
|
|
|
ctxc);
|
2022-04-22 17:49:28 +02:00
|
|
|
}
|
|
|
|
|
2022-11-14 13:36:51 +01:00
|
|
|
void buildDetumbleSequence(Subsystem& ss, ModeListEntry& eh) {
|
2022-04-25 13:36:11 +02:00
|
|
|
std::string context = "satsystem::acs::buildDetumbleSequence";
|
2022-04-22 17:49:28 +02:00
|
|
|
auto ctxc = context.c_str();
|
2022-04-25 10:08:29 +02:00
|
|
|
// Insert Helper Table
|
|
|
|
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
|
2022-04-25 10:30:47 +02:00
|
|
|
ArrayList<ModeListEntry>& sequence) {
|
2022-04-25 08:48:22 +02:00
|
|
|
eh.setObject(obj);
|
|
|
|
eh.setMode(mode);
|
|
|
|
eh.setSubmode(submode);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(sequence.insert(eh), ctxc);
|
2022-04-25 08:48:22 +02:00
|
|
|
};
|
2022-04-25 10:08:29 +02:00
|
|
|
// Insert Helper Sequence
|
2022-04-25 10:30:47 +02:00
|
|
|
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
|
|
|
|
bool checkSuccess) {
|
2022-04-25 10:08:29 +02:00
|
|
|
eh.setTableId(tableId);
|
|
|
|
eh.setWaitSeconds(waitSeconds);
|
|
|
|
eh.setCheckSuccess(checkSuccess);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(sequence.insert(eh), ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
};
|
2022-04-22 17:49:28 +02:00
|
|
|
// Build DETUMBLE target
|
2023-02-02 16:27:50 +01:00
|
|
|
iht(objects::ACS_CONTROLLER, acs::CtrlSubmode::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TGT.second);
|
2022-04-25 10:08:29 +02:00
|
|
|
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);
|
2022-11-14 13:36:51 +01:00
|
|
|
check(ss.addTable(&ACS_TABLE_DETUMBLE_TGT.second, ACS_TABLE_DETUMBLE_TGT.first, false, true),
|
2022-04-28 16:20:41 +02:00
|
|
|
ctxc);
|
2022-04-22 17:49:28 +02:00
|
|
|
|
|
|
|
// Build DETUMBLE transition 0
|
2022-04-25 10:08:29 +02:00
|
|
|
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
|
|
|
|
iht(objects::ACS_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::RW_ASS, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
|
2022-11-14 13:36:51 +01:00
|
|
|
check(ss.addTable(&ACS_TABLE_DETUMBLE_TRANS_0.second, ACS_TABLE_DETUMBLE_TRANS_0.first, false,
|
2022-11-14 13:46:26 +01:00
|
|
|
true),
|
2022-04-28 16:20:41 +02:00
|
|
|
ctxc);
|
2022-04-22 17:49:28 +02:00
|
|
|
|
|
|
|
// Build DETUMBLE transition 1
|
2023-02-02 16:27:50 +01:00
|
|
|
iht(objects::ACS_CONTROLLER, acs::CtrlSubmode::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TRANS_1.second);
|
2022-11-14 13:36:51 +01:00
|
|
|
check(ss.addTable(&ACS_TABLE_DETUMBLE_TRANS_1.second, ACS_TABLE_DETUMBLE_TRANS_1.first, false,
|
2022-11-14 13:46:26 +01:00
|
|
|
true),
|
2022-04-28 16:20:41 +02:00
|
|
|
ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
|
|
|
|
// Build DETUMBLE sequence
|
2022-04-25 10:30:47 +02:00
|
|
|
ihs(ACS_SEQUENCE_DETUMBLE.second, ACS_TABLE_DETUMBLE_TGT.first, 0, true);
|
2022-04-25 10:08:29 +02:00
|
|
|
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);
|
2022-11-14 13:36:51 +01:00
|
|
|
check(ss.addSequence(&ACS_SEQUENCE_DETUMBLE.second, ACS_SEQUENCE_DETUMBLE.first,
|
2022-11-14 13:46:26 +01:00
|
|
|
ACS_SEQUENCE_SAFE.first, false, true),
|
2022-04-28 16:20:41 +02:00
|
|
|
ctxc);
|
2022-04-22 17:49:28 +02:00
|
|
|
}
|
|
|
|
|
2022-11-14 13:36:51 +01:00
|
|
|
void buildIdleSequence(Subsystem& ss, ModeListEntry& eh) {
|
2022-04-25 13:36:11 +02:00
|
|
|
std::string context = "satsystem::acs::buildIdleSequence";
|
2022-04-25 10:08:29 +02:00
|
|
|
auto ctxc = context.c_str();
|
|
|
|
// Insert Helper Table
|
|
|
|
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
|
2022-04-25 10:30:47 +02:00
|
|
|
ArrayList<ModeListEntry>& sequence) {
|
2022-04-25 10:08:29 +02:00
|
|
|
eh.setObject(obj);
|
|
|
|
eh.setMode(mode);
|
|
|
|
eh.setSubmode(submode);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(sequence.insert(eh), ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
};
|
|
|
|
// Insert Helper Sequence
|
2022-04-25 10:30:47 +02:00
|
|
|
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
|
|
|
|
bool checkSuccess) {
|
2022-04-25 10:08:29 +02:00
|
|
|
eh.setTableId(tableId);
|
|
|
|
eh.setWaitSeconds(waitSeconds);
|
|
|
|
eh.setCheckSuccess(checkSuccess);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(sequence.insert(eh), ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
};
|
|
|
|
// Build IDLE target
|
2023-02-02 16:27:50 +01:00
|
|
|
iht(objects::ACS_CONTROLLER, acs::CtrlSubmode::IDLE, 0, ACS_TABLE_IDLE_TGT.second);
|
2022-04-25 10:08:29 +02:00
|
|
|
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_IDLE_TGT.second);
|
|
|
|
iht(objects::RW_ASS, NML, 0, ACS_TABLE_IDLE_TGT.second);
|
|
|
|
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_TGT.second);
|
|
|
|
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_TGT.second);
|
2022-11-14 13:36:51 +01:00
|
|
|
ss.addTable(&ACS_TABLE_IDLE_TGT.second, ACS_TABLE_IDLE_TGT.first, false, true);
|
2022-04-25 10:08:29 +02:00
|
|
|
|
|
|
|
// Build IDLE transition 0
|
2022-04-25 10:30:47 +02:00
|
|
|
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_IDLE_TRANS_0.second);
|
|
|
|
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_TRANS_0.second);
|
|
|
|
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_TRANS_0.second);
|
|
|
|
iht(objects::RW_ASS, NML, 0, ACS_TABLE_IDLE_TRANS_0.second);
|
2023-02-02 16:27:50 +01:00
|
|
|
iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_IDLE_TRANS_0.second);
|
2022-11-14 13:36:51 +01:00
|
|
|
ss.addTable(&ACS_TABLE_IDLE_TRANS_0.second, ACS_TABLE_IDLE_TRANS_0.first, false, true);
|
2022-04-25 10:08:29 +02:00
|
|
|
|
|
|
|
// Build IDLE transition 1
|
2023-02-02 16:27:50 +01:00
|
|
|
iht(objects::ACS_CONTROLLER, acs::CtrlSubmode::IDLE, 0, ACS_TABLE_IDLE_TRANS_1.second);
|
2022-11-14 13:36:51 +01:00
|
|
|
ss.addTable(&ACS_TABLE_IDLE_TRANS_1.second, ACS_TABLE_IDLE_TRANS_1.first, false, true);
|
2022-04-25 10:08:29 +02:00
|
|
|
|
|
|
|
// Build IDLE sequence
|
2022-04-25 10:30:47 +02:00
|
|
|
ihs(ACS_SEQUENCE_IDLE.second, ACS_TABLE_IDLE_TGT.first, 0, true);
|
|
|
|
ihs(ACS_SEQUENCE_IDLE.second, ACS_TABLE_IDLE_TRANS_0.first, 0, true);
|
2022-04-25 10:08:29 +02:00
|
|
|
ihs(ACS_SEQUENCE_IDLE.second, ACS_TABLE_IDLE_TRANS_1.first, 0, false);
|
2022-11-14 13:46:26 +01:00
|
|
|
ss.addSequence(&ACS_SEQUENCE_IDLE.second, ACS_SEQUENCE_IDLE.first, ACS_SEQUENCE_SAFE.first, false,
|
|
|
|
true);
|
2022-04-25 10:30:47 +02:00
|
|
|
}
|
|
|
|
|
2022-11-14 13:36:51 +01:00
|
|
|
void buildTargetPtSequence(Subsystem& ss, ModeListEntry& eh) {
|
2022-04-25 13:36:11 +02:00
|
|
|
std::string context = "satsystem::acs::buildTargetPtSequence";
|
2022-04-25 10:08:29 +02:00
|
|
|
auto ctxc = context.c_str();
|
|
|
|
// Insert Helper Table
|
|
|
|
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
|
2022-04-25 10:30:47 +02:00
|
|
|
ArrayList<ModeListEntry>& sequence) {
|
2022-04-25 10:08:29 +02:00
|
|
|
eh.setObject(obj);
|
|
|
|
eh.setMode(mode);
|
|
|
|
eh.setSubmode(submode);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(sequence.insert(eh), ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
};
|
|
|
|
// Insert Helper Sequence
|
2022-04-25 10:30:47 +02:00
|
|
|
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
|
|
|
|
bool checkSuccess) {
|
2022-04-25 10:08:29 +02:00
|
|
|
eh.setTableId(tableId);
|
|
|
|
eh.setWaitSeconds(waitSeconds);
|
|
|
|
eh.setCheckSuccess(checkSuccess);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(sequence.insert(eh), ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// Build TARGET PT table
|
2023-02-02 16:27:50 +01:00
|
|
|
iht(objects::ACS_CONTROLLER, acs::CtrlSubmode::PTG_TARGET, 0, ACS_TABLE_PTG_TARGET_TGT.second);
|
|
|
|
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_PTG_TARGET_TGT.second);
|
|
|
|
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_TGT.second);
|
|
|
|
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_TGT.second);
|
|
|
|
iht(objects::RW_ASS, NML, 0, ACS_TABLE_PTG_TARGET_TGT.second);
|
|
|
|
iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_PTG_TARGET_TGT.second);
|
|
|
|
check(ss.addTable(&ACS_TABLE_PTG_TARGET_TGT.second, ACS_TABLE_PTG_TARGET_TGT.first, false, true),
|
2022-04-28 16:20:41 +02:00
|
|
|
ctxc);
|
2022-04-22 17:49:28 +02:00
|
|
|
|
2022-04-25 10:08:29 +02:00
|
|
|
// Build TARGET PT transition 0
|
2023-02-02 16:27:50 +01:00
|
|
|
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_PTG_TARGET_TRANS_0.second);
|
|
|
|
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_TRANS_0.second);
|
|
|
|
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_TRANS_0.second);
|
|
|
|
iht(objects::RW_ASS, NML, 0, ACS_TABLE_PTG_TARGET_TRANS_0.second);
|
|
|
|
iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_PTG_TARGET_TRANS_0.second);
|
|
|
|
check(ss.addTable(&ACS_TABLE_PTG_TARGET_TRANS_0.second, ACS_TABLE_PTG_TARGET_TRANS_0.first, false,
|
2022-11-14 13:46:26 +01:00
|
|
|
true),
|
2022-04-28 16:20:41 +02:00
|
|
|
ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
|
|
|
|
// Build TARGET PT transition 1
|
2023-02-02 16:27:50 +01:00
|
|
|
iht(objects::ACS_CONTROLLER, acs::CtrlSubmode::PTG_TARGET, 0,
|
|
|
|
ACS_TABLE_PTG_TARGET_TRANS_1.second);
|
|
|
|
check(ss.addTable(&ACS_TABLE_PTG_TARGET_TRANS_1.second, ACS_TABLE_PTG_TARGET_TRANS_1.first, false,
|
2022-11-14 13:46:26 +01:00
|
|
|
true),
|
2022-04-28 16:20:41 +02:00
|
|
|
ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
|
|
|
|
// Build IDLE sequence
|
2023-02-02 16:27:50 +01:00
|
|
|
ihs(ACS_SEQUENCE_PTG_TARGET.second, ACS_TABLE_PTG_TARGET_TGT.first, 0, true);
|
|
|
|
ihs(ACS_SEQUENCE_PTG_TARGET.second, ACS_TABLE_PTG_TARGET_TRANS_0.first, 0, true);
|
|
|
|
ihs(ACS_SEQUENCE_PTG_TARGET.second, ACS_TABLE_PTG_TARGET_TRANS_1.first, 0, false);
|
|
|
|
check(ss.addSequence(&ACS_SEQUENCE_PTG_TARGET.second, ACS_SEQUENCE_PTG_TARGET.first,
|
2022-11-14 13:46:26 +01:00
|
|
|
ACS_SEQUENCE_IDLE.first, false, true),
|
2022-04-28 16:20:41 +02:00
|
|
|
ctxc);
|
2022-04-22 17:00:23 +02:00
|
|
|
}
|
2022-04-25 13:36:11 +02:00
|
|
|
|
|
|
|
} // namespace
|