1
0
forked from fsfw/fsfw

subsystem folder update

This commit is contained in:
2020-10-10 17:41:51 +02:00
parent 3aa666633e
commit 837a18135e
9 changed files with 73 additions and 83 deletions

View File

@ -12,13 +12,10 @@ Subsystem::Subsystem(object_id_t setObjectId, object_id_t parent,
uint32_t maxNumberOfSequences, uint32_t maxNumberOfTables) :
SubsystemBase(setObjectId, parent, 0), isInTransition(false),
childrenChangedHealth(false), currentTargetTable(),
targetMode(0), targetSubmode(SUBMODE_NONE), initialMode(0),
currentSequenceIterator(), modeTables(maxNumberOfTables),
modeSequences(maxNumberOfSequences) {}
targetSubmode(SUBMODE_NONE), currentSequenceIterator(),
modeTables(maxNumberOfTables), modeSequences(maxNumberOfSequences) {}
Subsystem::~Subsystem() {
//Auto-generated destructor stub
}
Subsystem::~Subsystem() {}
ReturnValue_t Subsystem::checkSequence(HybridIterator<ModeListEntry> iter,
Mode_t fallbackSequence) {
@ -344,7 +341,8 @@ ReturnValue_t Subsystem::addSequence(ArrayList<ModeListEntry> *sequence,
ReturnValue_t result;
//Before initialize() is called, tables must not be checked as the children are not added yet.
//Before initialize() is called, tables must not be checked as the
//children are not added yet.
//Sequences added before are checked by initialize()
if (!preInit) {
result = checkSequence(
@ -390,8 +388,8 @@ ReturnValue_t Subsystem::addTable(ArrayList<ModeListEntry> *table, Mode_t id,
ReturnValue_t result;
//Before initialize() is called, tables must not be checked as the children are not added yet.
//Tables added before are checked by initialize()
//Before initialize() is called, tables must not be checked as the children
//are not added yet. Tables added before are checked by initialize()
if (!preInit) {
result = checkTable(
HybridIterator<ModeListEntry>(table->front(), table->back()));
@ -582,12 +580,14 @@ void Subsystem::transitionFailed(ReturnValue_t failureCode,
triggerEvent(MODE_TRANSITION_FAILED, failureCode, parameter);
if (mode == targetMode) {
//already tried going back to the current mode
//go into fallback mode, also set current mode to fallback mode, so we come here at the next fail
//go into fallback mode, also set current mode to fallback mode,
//so we come here at the next fail
modeHelper.setForced(true);
ReturnValue_t result;
if ((result = checkSequence(getFallbackSequence(mode))) != RETURN_OK) {
triggerEvent(FALLBACK_FAILED, result, getFallbackSequence(mode));
isInTransition = false; //keep still and allow arbitrary mode commands to recover
//keep still and allow arbitrary mode commands to recover
isInTransition = false;
return;
}
mode = getFallbackSequence(mode);
@ -651,8 +651,10 @@ void Subsystem::cantKeepMode() {
modeHelper.setForced(true);
//already set the mode, so that we do not try to go back in our old mode when the transition fails
//already set the mode, so that we do not try to go back in our old mode
//when the transition fails
mode = getFallbackSequence(mode);
//SHOULDDO: We should store submodes for fallback sequence as well, otherwise we should get rid of submodes completely.
//SHOULDDO: We should store submodes for fallback sequence as well,
//otherwise we should get rid of submodes completely.
startTransition(mode, SUBMODE_NONE);
}