eive-obsw/mission/system/acs/StrAssembly.cpp
Robin Mueller 9270165bf8
fix STR bugs and improve code
- Reset reply size after returning a reply
- Reset data link layer and flush RX for regular commands and before
  performing special commands to ensure consistent start state
- Clean up DHB a bit
- Set STR dev to OFF in assembly when it is faulty.
2023-04-04 01:35:05 +02:00

36 lines
1.1 KiB
C++

#include "StrAssembly.h"
#include <eive/objects.h>
StrAssembly::StrAssembly(object_id_t objectId) : AssemblyBase(objectId) {
ModeListEntry entry;
entry.setObject(objects::STAR_TRACKER);
entry.setMode(MODE_OFF);
entry.setSubmode(SUBMODE_NONE);
commandTable.insert(entry);
}
ReturnValue_t StrAssembly::commandChildren(Mode_t mode, Submode_t submode) {
// To ensure consistent state.
commandTable[0].setMode(MODE_OFF);
commandTable[0].setSubmode(submode);
if (healthHelper.healthTable->getHealth(objects::STAR_TRACKER) != FAULTY) {
commandTable[0].setMode(mode);
commandTable[0].setSubmode(submode);
}
HybridIterator<ModeListEntry> iter(commandTable.begin(), commandTable.end());
executeTable(iter);
return returnvalue::OK;
}
ReturnValue_t StrAssembly::checkChildrenStateOn(Mode_t wantedMode, Submode_t wantedSubmode) {
if (childrenMap[objects::STAR_TRACKER].mode != wantedMode) {
return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE;
}
return returnvalue::OK;
}
ReturnValue_t StrAssembly::isModeCombinationValid(Mode_t mode, Submode_t submode) {
return returnvalue::OK;
}