continued pl ss
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

This commit is contained in:
Robin Müller 2022-04-25 18:44:38 +02:00
parent 0697cca88a
commit f5723dc181
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
3 changed files with 156 additions and 12 deletions

View File

@ -101,6 +101,9 @@ enum NormalSubmodeBits {
};
static constexpr Submode_t ALL_OFF_SUBMODE = 0;
static constexpr Submode_t ALL_ON_SUBMODE = (1 << HPA_ON) | (1 << MPA_ON) | (1 << TX_ON) |
(1 << X8_ON) | (1 << DRO_ON) |
(1 << SOLID_STATE_RELAYS_ADC_ON);
// 12 ADC values * 2 + trailing zero
static constexpr size_t ADC_REPLY_SIZE = 25;

View File

@ -18,8 +18,14 @@ enum Submodes : Submode_t { A_SIDE = 0, B_SIDE = 1, DUAL_MODE = 2 };
namespace payload {
enum Modes { NONE = 0, DAC = 1, CAM = 2, PL_DATA = 3, EARTH_OBSV = 4, SCEX = 5 };
enum Modes { NONE = 0, SUPV_ONLY = 1, MPSOC_STREAM = 2, CAM_STREAM = 3, EARTH_OBSV = 4, SCEX = 5 };
namespace ploc {
enum Modes { OFF = 0, SUPV_ONLY = 1, MPSOC_ON = 2 };
}
} // namespace payload
#endif /* MISSION_SYSTEM_DEFINITIONS_H_ */

View File

@ -6,33 +6,63 @@
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/subsystem/Subsystem.h>
#include "mission/devices/devicedefinitions/payloadPcduDefinitions.h"
#include "mission/system/objects/PayloadSubsystem.h"
#include "mission/system/objects/definitions.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 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);
} // namespace
const auto CHK = checkInsert;
static const auto OFF = HasModesIF::MODE_OFF;
// static const auto NML = DeviceHandlerIF::MODE_NORMAL;
static const auto ON = HasModesIF::MODE_ON;
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>());
auto PL_SEQUENCE_MPSOC_STREAM =
std::make_pair(payload::Modes::MPSOC_STREAM << 24, FixedArrayList<ModeListEntry, 2>());
auto PL_TABLE_MPSOC_STREAM_TGT =
std::make_pair((payload::Modes::MPSOC_STREAM << 24) | 1, FixedArrayList<ModeListEntry, 4>());
auto PL_TABLE_MPSOC_STREAM_TRANS_0 =
std::make_pair((payload::Modes::MPSOC_STREAM << 24) | 2, FixedArrayList<ModeListEntry, 3>());
auto PL_TABLE_MPSOC_STREAM_TRANS_1 =
std::make_pair((payload::Modes::MPSOC_STREAM << 24) | 2, FixedArrayList<ModeListEntry, 1>());
auto PL_SEQUENCE_CAM_STREAM =
std::make_pair(payload::Modes::CAM_STREAM << 24, FixedArrayList<ModeListEntry, 2>());
auto PL_TABLE_CAM_STREAM_TGT =
std::make_pair((payload::Modes::CAM_STREAM << 24) | 1, FixedArrayList<ModeListEntry, 1>());
auto PL_TABLE_CAM_STREAM_TRANS_0 =
std::make_pair((payload::Modes::CAM_STREAM << 24) | 2, FixedArrayList<ModeListEntry, 3>());
auto PL_TABLE_CAM_STREAM_TRANS_1 =
std::make_pair((payload::Modes::CAM_STREAM << 24) | 2, FixedArrayList<ModeListEntry, 1>());
auto PL_SEQUENCE_SUPV_ONLY =
std::make_pair(payload::Modes::CAM_STREAM << 24, FixedArrayList<ModeListEntry, 2>());
auto PL_TABLE_SUPV_ONLY_TGT =
std::make_pair((payload::Modes::CAM_STREAM << 24) | 1, FixedArrayList<ModeListEntry, 5>());
auto PL_TABLE_SUPV_ONLY_TRANS_0 =
std::make_pair((payload::Modes::CAM_STREAM << 24) | 2, FixedArrayList<ModeListEntry, 5>());
auto PL_TABLE_SUPV_ONLY_TRANS_1 =
std::make_pair((payload::Modes::CAM_STREAM << 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);
initPlMpsocStreamSequence(plSubsystem, entry);
initPlCamStreamSequence(plSubsystem, entry);
initPlSpvSequence(plSubsystem, entry);
initEarthObsvSequence(plSubsystem, entry);
initScexSequence(plSubsystem, entry);
plSubsystem->setInitialMode(OFF);
@ -78,8 +108,8 @@ void initOffSequence(Subsystem* ss, ModeListEntry& eh) {
true);
}
void initPlDacSequence(Subsystem* ss, ModeListEntry& eh) {
std::string context = "satsystem::payload::initPlDacSequence";
void initPlMpsocStreamSequence(Subsystem* ss, ModeListEntry& eh) {
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,
@ -97,11 +127,116 @@ void initPlDacSequence(Subsystem* ss, ModeListEntry& eh) {
eh.setCheckSuccess(checkSuccess);
CHK(sequence.insert(eh), ctxc);
};
// Build MPSoC stream target
// Camera should always be off to prevent a conflict with the MPSoC streaming
iht(objects::PLPCDU_HANDLER, NML, plpcdu::ALL_ON_SUBMODE, 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::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);
// Build MPSoC stream transition 0
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::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,
true);
// Build MPSoC stream transition 1
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,
true);
// 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);
ss->addSequence(&PL_SEQUENCE_MPSOC_STREAM.second, PL_SEQUENCE_MPSOC_STREAM.first,
PL_SEQUENCE_OFF.first, false, true);
}
void initPlCamSequence(Subsystem* ss, ModeListEntry& eh) {}
void initPlCamStreamSequence(Subsystem* ss, ModeListEntry& eh) {
std::string context = "satsystem::payload::initPlCamSequence";
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 initPlDataSequence(Subsystem* ss, ModeListEntry& eh) {}
// 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);
ss->addTable(&PL_TABLE_CAM_STREAM_TGT.second, PL_TABLE_CAM_STREAM_TGT.first, false, true);
// Build CAM transition 0
// PLOC is actively commanded off here
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::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,
true);
// Build CAM transition 1
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,
true);
// 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);
ss->addSequence(&PL_SEQUENCE_CAM_STREAM.second, PL_SEQUENCE_CAM_STREAM.first,
PL_SEQUENCE_OFF.first, false, true);
}
void initPlSpvSequence(Subsystem* ss, ModeListEntry& eh) {
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);
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 Payload Supervisor Only target
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);
ss->addTable(&PL_TABLE_SUPV_ONLY_TGT.second, PL_TABLE_SUPV_ONLY_TGT.first, false, true);
// Build Payload Supervisor Only transition 0
iht(objects::PLOC_SWITCHER, ON, 0, PL_TABLE_SUPV_ONLY_TRANS_0.second);
ss->addTable(&PL_TABLE_SUPV_ONLY_TRANS_0.second, PL_TABLE_SUPV_ONLY_TRANS_0.first, inStore,
preInit)
// Build Payload Supervisor Only transition 1
iht(objects::PLOC_SUBSYSTEM, NML, payload::ploc::SUPV_ONLY,
PL_TABLE_SUPV_ONLY_TRANS_1.second);
}
void initEarthObsvSequence(Subsystem* ss, ModeListEntry& eh) {}