From a06d90daad87504392916fb0b42866a568392341 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 4 Apr 2023 18:29:07 +0200 Subject: [PATCH] remove duplicate code --- fsfw | 2 +- mission/system/acs/SusAssembly.cpp | 20 ++------------------ mission/system/acs/SusAssembly.h | 7 ------- tmtc | 2 +- 4 files changed, 4 insertions(+), 27 deletions(-) diff --git a/fsfw b/fsfw index 9fca7581..6650c293 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 9fca7581dd75d074df343802c922e48f95b677eb +Subproject commit 6650c293da09d8851c2bd6c4d6e6c5a8390d003e diff --git a/mission/system/acs/SusAssembly.cpp b/mission/system/acs/SusAssembly.cpp index 13946c13..75a3cb57 100644 --- a/mission/system/acs/SusAssembly.cpp +++ b/mission/system/acs/SusAssembly.cpp @@ -50,7 +50,7 @@ ReturnValue_t SusAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t submod if (mode == devMode) { modeTable[tableIdx].setMode(mode); } else if (mode == DeviceHandlerIF::MODE_NORMAL) { - if (isUseable(objectId, devMode)) { + if (isModeCommandable(objectId, devMode)) { if (devMode == MODE_ON) { modeTable[tableIdx].setMode(mode); modeTable[tableIdx].setSubmode(SUBMODE_NONE); @@ -63,7 +63,7 @@ ReturnValue_t SusAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t submod } } } else if (mode == MODE_ON) { - if (isUseable(objectId, devMode)) { + if (isModeCommandable(objectId, devMode)) { modeTable[tableIdx].setMode(MODE_ON); modeTable[tableIdx].setSubmode(SUBMODE_NONE); } @@ -134,22 +134,6 @@ ReturnValue_t SusAssembly::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() { for (uint8_t idx = 0; idx < helper.susModes.size(); idx++) { helper.susModes[idx] = childrenMap[helper.susIds[idx]].mode; diff --git a/mission/system/acs/SusAssembly.h b/mission/system/acs/SusAssembly.h index 15f347dd..2002fac0 100644 --- a/mission/system/acs/SusAssembly.h +++ b/mission/system/acs/SusAssembly.h @@ -56,13 +56,6 @@ class SusAssembly : public DualLaneAssemblyBase { ReturnValue_t commandChildren(Mode_t mode, Submode_t submode) 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); ReturnValue_t handleNormalOrOnModeCmd(Mode_t mode, Submode_t submode); void refreshHelperModes(); diff --git a/tmtc b/tmtc index 6975fae5..50668ca7 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 6975fae511ca7b2fdef70858f8715908f300f434 +Subproject commit 50668ca7a74edd4219456e393cd10f7858591130