Merge pull request 'New Subsystem adder functions' (#73) from mueller/new-ss-adder-functions-eive into eive/develop

Reviewed-on: eive/fsfw#73
This commit is contained in:
Jakob Meier 2022-04-30 17:00:34 +02:00
commit 7760b3063e
2 changed files with 40 additions and 2 deletions

View File

@ -307,6 +307,11 @@ void Subsystem::replyToCommand(ReturnValue_t status, uint32_t parameter) {
} }
} }
ReturnValue_t Subsystem::addSequence(SequenceEntry sequence) {
return addSequence(sequence.table, sequence.mode, sequence.fallbackMode, sequence.inStore,
sequence.preInit);
}
ReturnValue_t Subsystem::addSequence(ArrayList<ModeListEntry> *sequence, Mode_t id, ReturnValue_t Subsystem::addSequence(ArrayList<ModeListEntry> *sequence, Mode_t id,
Mode_t fallbackSequence, bool inStore, bool preInit) { Mode_t fallbackSequence, bool inStore, bool preInit) {
ReturnValue_t result; ReturnValue_t result;
@ -350,6 +355,10 @@ ReturnValue_t Subsystem::addSequence(ArrayList<ModeListEntry> *sequence, Mode_t
return result; return result;
} }
ReturnValue_t Subsystem::addTable(TableEntry table) {
return addTable(table.table, table.mode, table.inStore, table.preInit);
}
ReturnValue_t Subsystem::addTable(ArrayList<ModeListEntry> *table, Mode_t id, bool inStore, ReturnValue_t Subsystem::addTable(ArrayList<ModeListEntry> *table, Mode_t id, bool inStore,
bool preInit) { bool preInit) {
ReturnValue_t result; ReturnValue_t result;
@ -458,6 +467,7 @@ ReturnValue_t Subsystem::initialize() {
} }
mode = initialMode; mode = initialMode;
submode = initSubmode;
return RETURN_OK; return RETURN_OK;
} }
@ -595,7 +605,10 @@ ReturnValue_t Subsystem::checkObjectConnections() {
return RETURN_OK; return RETURN_OK;
} }
void Subsystem::setInitialMode(Mode_t mode) { initialMode = mode; } void Subsystem::setInitialMode(Mode_t mode, Submode_t submode) {
this->initialMode = mode;
this->initSubmode = submode;
}
void Subsystem::cantKeepMode() { void Subsystem::cantKeepMode() {
ReturnValue_t result; ReturnValue_t result;

View File

@ -10,6 +10,28 @@
#include "fsfw/FSFW.h" #include "fsfw/FSFW.h"
#include "modes/ModeDefinitions.h" #include "modes/ModeDefinitions.h"
struct TableSequenceBase {
public:
TableSequenceBase(Mode_t mode, ArrayList<ModeListEntry> *table) : mode(mode), table(table){};
Mode_t mode;
ArrayList<ModeListEntry> *table;
bool inStore = false;
bool preInit = true;
};
struct TableEntry : public TableSequenceBase {
public:
TableEntry(Mode_t mode, ArrayList<ModeListEntry> *table) : TableSequenceBase(mode, table){};
};
struct SequenceEntry : public TableSequenceBase {
public:
SequenceEntry(Mode_t mode, ArrayList<ModeListEntry> *table, Mode_t fallbackMode)
: TableSequenceBase(mode, table), fallbackMode(fallbackMode) {}
Mode_t fallbackMode;
};
/** /**
* @brief This class extends the SubsystemBase to perform the management of mode tables * @brief This class extends the SubsystemBase to perform the management of mode tables
* and mode sequences * and mode sequences
@ -48,13 +70,15 @@ class Subsystem : public SubsystemBase, public HasModeSequenceIF {
uint32_t maxNumberOfTables); uint32_t maxNumberOfTables);
virtual ~Subsystem(); virtual ~Subsystem();
ReturnValue_t addSequence(SequenceEntry sequence);
ReturnValue_t addSequence(ArrayList<ModeListEntry> *sequence, Mode_t id, Mode_t fallbackSequence, ReturnValue_t addSequence(ArrayList<ModeListEntry> *sequence, Mode_t id, Mode_t fallbackSequence,
bool inStore = true, bool preInit = true); bool inStore = true, bool preInit = true);
ReturnValue_t addTable(TableEntry table);
ReturnValue_t addTable(ArrayList<ModeListEntry> *table, Mode_t id, bool inStore = true, ReturnValue_t addTable(ArrayList<ModeListEntry> *table, Mode_t id, bool inStore = true,
bool preInit = true); bool preInit = true);
void setInitialMode(Mode_t mode); void setInitialMode(Mode_t mode, Submode_t submode = SUBMODE_NONE);
virtual ReturnValue_t initialize() override; virtual ReturnValue_t initialize() override;
@ -93,6 +117,7 @@ class Subsystem : public SubsystemBase, public HasModeSequenceIF {
Submode_t targetSubmode; Submode_t targetSubmode;
Mode_t initialMode = 0; Mode_t initialMode = 0;
Submode_t initSubmode = SUBMODE_NONE;
HybridIterator<ModeListEntry> currentSequenceIterator; HybridIterator<ModeListEntry> currentSequenceIterator;