remove duplicate code
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2023-04-04 18:29:07 +02:00
parent 28882cc359
commit a06d90daad
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
4 changed files with 4 additions and 27 deletions

2
fsfw

@ -1 +1 @@
Subproject commit 9fca7581dd75d074df343802c922e48f95b677eb Subproject commit 6650c293da09d8851c2bd6c4d6e6c5a8390d003e

View File

@ -50,7 +50,7 @@ ReturnValue_t SusAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t submod
if (mode == devMode) { if (mode == devMode) {
modeTable[tableIdx].setMode(mode); modeTable[tableIdx].setMode(mode);
} else if (mode == DeviceHandlerIF::MODE_NORMAL) { } else if (mode == DeviceHandlerIF::MODE_NORMAL) {
if (isUseable(objectId, devMode)) { if (isModeCommandable(objectId, devMode)) {
if (devMode == MODE_ON) { if (devMode == MODE_ON) {
modeTable[tableIdx].setMode(mode); modeTable[tableIdx].setMode(mode);
modeTable[tableIdx].setSubmode(SUBMODE_NONE); modeTable[tableIdx].setSubmode(SUBMODE_NONE);
@ -63,7 +63,7 @@ ReturnValue_t SusAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t submod
} }
} }
} else if (mode == MODE_ON) { } else if (mode == MODE_ON) {
if (isUseable(objectId, devMode)) { if (isModeCommandable(objectId, devMode)) {
modeTable[tableIdx].setMode(MODE_ON); modeTable[tableIdx].setMode(MODE_ON);
modeTable[tableIdx].setSubmode(SUBMODE_NONE); modeTable[tableIdx].setSubmode(SUBMODE_NONE);
} }
@ -134,22 +134,6 @@ ReturnValue_t SusAssembly::initialize() {
return AssemblyBase::initialize(); return AssemblyBase::initialize();
} }
bool SusAssembly::isUseable(object_id_t object, Mode_t mode) {
if (healthHelper.healthTable->isFaulty(object)) {
return false;
}
// Check if device is already in target mode
if (childrenMap[object].mode == mode) {
return true;
}
if (healthHelper.healthTable->isCommandable(object)) {
return true;
}
return false;
}
void SusAssembly::refreshHelperModes() { void SusAssembly::refreshHelperModes() {
for (uint8_t idx = 0; idx < helper.susModes.size(); idx++) { for (uint8_t idx = 0; idx < helper.susModes.size(); idx++) {
helper.susModes[idx] = childrenMap[helper.susIds[idx]].mode; helper.susModes[idx] = childrenMap[helper.susIds[idx]].mode;

View File

@ -56,13 +56,6 @@ class SusAssembly : public DualLaneAssemblyBase {
ReturnValue_t commandChildren(Mode_t mode, Submode_t submode) override; ReturnValue_t commandChildren(Mode_t mode, Submode_t submode) override;
ReturnValue_t checkChildrenStateOn(Mode_t wantedMode, Submode_t wantedSubmode) override; ReturnValue_t checkChildrenStateOn(Mode_t wantedMode, Submode_t wantedSubmode) override;
/**
* Check whether it makes sense to send mode commands to the device
* @param object
* @param mode
* @return
*/
bool isUseable(object_id_t object, Mode_t mode);
void powerStateMachine(Mode_t mode, Submode_t submode); void powerStateMachine(Mode_t mode, Submode_t submode);
ReturnValue_t handleNormalOrOnModeCmd(Mode_t mode, Submode_t submode); ReturnValue_t handleNormalOrOnModeCmd(Mode_t mode, Submode_t submode);
void refreshHelperModes(); void refreshHelperModes();

2
tmtc

@ -1 +1 @@
Subproject commit 6975fae511ca7b2fdef70858f8715908f300f434 Subproject commit 50668ca7a74edd4219456e393cd10f7858591130