boot sequence
Some checks failed
EIVE/eive-obsw/pipeline/head Build started...
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit

This commit is contained in:
Robin Müller 2023-03-14 14:44:32 +01:00
parent 4429dd1be9
commit 74fa81d8f6
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 72 additions and 9 deletions

11
mission/sysDefs.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef MISSION_SYSDEFS_H_
#define MISSION_SYSDEFS_H_
#include "acsDefs.h"
namespace satsystem {
enum Mode : Mode_t { BOOT = 5, SAFE = acs::AcsMode::SAFE, PTG_IDLE = acs::AcsMode::PTG_IDLE };
}
#endif /* MISSION_SYSDEFS_H_ */

View File

@ -3,6 +3,7 @@
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <fsfw/subsystem/Subsystem.h>
#include <mission/acsDefs.h>
#include <mission/sysDefs.h>
#include "acsModeTree.h"
#include "comModeTree.h"
@ -16,6 +17,7 @@ namespace {
// Alias for checker function
const auto check = subsystem::checkInsert;
void buildBootSequence(Subsystem& ss, ModeListEntry& eh);
void buildSafeSequence(Subsystem& ss, ModeListEntry& eh);
void buildIdleSequence(Subsystem& ss, ModeListEntry& eh);
} // namespace
@ -33,29 +35,36 @@ void satsystem::init() {
auto& comSubsystem = com::init();
comSubsystem.connectModeTreeParent(EIVE_SYSTEM);
ModeListEntry entry;
buildBootSequence(EIVE_SYSTEM, entry);
buildSafeSequence(EIVE_SYSTEM, entry);
buildIdleSequence(EIVE_SYSTEM, entry);
EIVE_SYSTEM.setInitialMode(HasModesIF::MODE_OFF, 0);
EIVE_SYSTEM.setInitialMode(satsystem::Mode::BOOT, 0);
}
EiveSystem satsystem::EIVE_SYSTEM = EiveSystem(objects::EIVE_SYSTEM, 12, 24);
auto EIVE_SEQUENCE_SAFE = std::make_pair(acs::AcsMode::SAFE, FixedArrayList<ModeListEntry, 5>());
auto EIVE_SEQUENCE_BOOT = std::make_pair(satsystem::Mode::BOOT, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_BOOT_TGT =
std::make_pair((satsystem::Mode::BOOT << 24) | 1, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_BOOT_TRANS_0 =
std::make_pair((satsystem::Mode::BOOT << 24) | 2, FixedArrayList<ModeListEntry, 5>());
auto EIVE_SEQUENCE_SAFE = std::make_pair(satsystem::Mode::SAFE, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_SAFE_TGT =
std::make_pair((acs::AcsMode::SAFE << 24) | 1, FixedArrayList<ModeListEntry, 5>());
std::make_pair((satsystem::Mode::SAFE << 24) | 1, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_SAFE_TRANS_0 =
std::make_pair((acs::AcsMode::SAFE << 24) | 2, FixedArrayList<ModeListEntry, 5>());
std::make_pair((satsystem::Mode::SAFE << 24) | 2, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_SAFE_TRANS_1 =
std::make_pair((acs::AcsMode::SAFE << 24) | 3, FixedArrayList<ModeListEntry, 5>());
std::make_pair((satsystem::Mode::SAFE << 24) | 3, FixedArrayList<ModeListEntry, 5>());
auto EIVE_SEQUENCE_IDLE =
std::make_pair(acs::AcsMode::PTG_IDLE, FixedArrayList<ModeListEntry, 5>());
std::make_pair(satsystem::Mode::PTG_IDLE, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_IDLE_TGT =
std::make_pair((acs::AcsMode::PTG_IDLE << 24) | 1, FixedArrayList<ModeListEntry, 5>());
std::make_pair((satsystem::Mode::PTG_IDLE << 24) | 1, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_IDLE_TRANS_0 =
std::make_pair((acs::AcsMode::PTG_IDLE << 24) | 2, FixedArrayList<ModeListEntry, 5>());
std::make_pair((satsystem::Mode::PTG_IDLE << 24) | 2, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_IDLE_TRANS_1 =
std::make_pair((acs::AcsMode::PTG_IDLE << 24) | 3, FixedArrayList<ModeListEntry, 5>());
std::make_pair((satsystem::Mode::PTG_IDLE << 24) | 3, FixedArrayList<ModeListEntry, 5>());
namespace {
@ -140,4 +149,47 @@ void buildIdleSequence(Subsystem& ss, ModeListEntry& eh) {
ctxc);
}
void buildBootSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::buildBootSequence";
auto ctxc = context.c_str();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table,
bool allowAllSubmodes = false) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
if (allowAllSubmodes) {
eh.allowAllSubmodes();
}
check(table.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);
check(sequence.insert(eh), ctxc);
};
iht(objects::ACS_SUBSYSTEM, acs::AcsMode::OFF, 0, EIVE_TABLE_BOOT_TGT.second, true);
iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_BOOT_TGT.second);
iht(objects::COM_SUBSYSTEM, com::RX_ONLY, 0, EIVE_TABLE_BOOT_TRANS_0.second);
iht(objects::TCS_SUBSYSTEM, OFF, 0, EIVE_TABLE_BOOT_TRANS_0.second);
check(ss.addTable(TableEntry(EIVE_TABLE_BOOT_TGT.first, &EIVE_TABLE_BOOT_TGT.second)), ctxc);
// Build SAFE transition 0.
iht(objects::TCS_SUBSYSTEM, OFF, 0, EIVE_TABLE_BOOT_TRANS_0.second);
iht(objects::COM_SUBSYSTEM, com::RX_ONLY, 0, EIVE_TABLE_BOOT_TRANS_0.second);
iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_BOOT_TRANS_0.second);
iht(objects::ACS_SUBSYSTEM, acs::AcsMode::OFF, 0, EIVE_TABLE_BOOT_TRANS_0.second, true);
check(ss.addTable(TableEntry(EIVE_TABLE_BOOT_TRANS_0.first, &EIVE_TABLE_BOOT_TRANS_0.second)),
ctxc);
// Build Safe sequence
ihs(EIVE_SEQUENCE_BOOT.second, EIVE_TABLE_BOOT_TGT.first, 0, false);
ihs(EIVE_SEQUENCE_BOOT.second, EIVE_TABLE_BOOT_TRANS_0.first, 0, false);
check(ss.addSequence(SequenceEntry(EIVE_SEQUENCE_BOOT.first, &EIVE_SEQUENCE_BOOT.second,
EIVE_SEQUENCE_SAFE.first)),
ctxc);
} // namespace