From 77b8c6eb3e480b4b1676907f7e43f76e0ee640ab Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 6 Apr 2023 19:11:26 +0200 Subject: [PATCH 1/2] bugfix RW asyy --- CHANGELOG.md | 5 +++ dummies/RwDummy.cpp | 4 +-- dummies/StarTrackerDummy.cpp | 4 +-- mission/system/acs/RwAssembly.cpp | 52 ++++--------------------------- mission/system/acs/RwAssembly.h | 5 --- tmtc | 2 +- 6 files changed, 16 insertions(+), 56 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 359d8b03..9c9a5933 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,11 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +## Fixed + +- RW Assembly: Correctly transition back to off when more than 1 devices is OFF. Also do this + when this was due to two devices being marked faulty. + # [v1.43.2] 2023-04-05 ## Changed diff --git a/dummies/RwDummy.cpp b/dummies/RwDummy.cpp index afc3a54f..0f97f24a 100644 --- a/dummies/RwDummy.cpp +++ b/dummies/RwDummy.cpp @@ -7,9 +7,9 @@ RwDummy::RwDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie) RwDummy::~RwDummy() {} -void RwDummy::doStartUp() {} +void RwDummy::doStartUp() { setMode(MODE_ON); } -void RwDummy::doShutDown() {} +void RwDummy::doShutDown() { setMode(MODE_OFF); } ReturnValue_t RwDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; } diff --git a/dummies/StarTrackerDummy.cpp b/dummies/StarTrackerDummy.cpp index 937b3422..d70c9a1b 100644 --- a/dummies/StarTrackerDummy.cpp +++ b/dummies/StarTrackerDummy.cpp @@ -7,9 +7,9 @@ StarTrackerDummy::StarTrackerDummy(object_id_t objectId, object_id_t comif, Cook StarTrackerDummy::~StarTrackerDummy() {} -void StarTrackerDummy::doStartUp() {} +void StarTrackerDummy::doStartUp() { setMode(MODE_ON); } -void StarTrackerDummy::doShutDown() {} +void StarTrackerDummy::doShutDown() { setMode(_MODE_POWER_DOWN); } ReturnValue_t StarTrackerDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; diff --git a/mission/system/acs/RwAssembly.cpp b/mission/system/acs/RwAssembly.cpp index ce90f4f5..eacd8d0d 100644 --- a/mission/system/acs/RwAssembly.cpp +++ b/mission/system/acs/RwAssembly.cpp @@ -56,12 +56,12 @@ ReturnValue_t RwAssembly::checkChildrenStateOn(Mode_t wantedMode, Submode_t want } } } catch (const std::out_of_range& e) { - sif::error << "RwAssembly: Invalid children map: " << e.what() << std::endl; + sif::error << "RW ASSY: Invalid children map: " << e.what() << std::endl; } if (devsInCorrectMode < 3) { if (warningSwitch) { - sif::warning << "RwAssembly::checkChildrenStateOn: Only " << devsInCorrectMode - << " devices in correct mode" << std::endl; + sif::warning << "RW ASSY: Only " << devsInCorrectMode << " devices in correct mode" + << std::endl; warningSwitch = false; } return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE; @@ -106,46 +106,18 @@ void RwAssembly::handleModeReached() { } } -void RwAssembly::handleChildrenLostMode(ReturnValue_t result) { - AssemblyBase::handleChildrenLostMode(result); -} - ReturnValue_t RwAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t submode) { ReturnValue_t result = returnvalue::OK; - bool needsSecondStep = false; - Mode_t devMode = 0; object_id_t objId = 0; try { for (uint8_t idx = 0; idx < NUMBER_RWS; idx++) { - devMode = childrenMap.at(helper.rwIds[idx]).mode; - objId = helper.rwIds[idx]; - if (mode == devMode) { + if (isUseable(objId, mode)) { modeTable[idx].setMode(mode); - } else if (mode == DeviceHandlerIF::MODE_NORMAL) { - if (isUseable(objId, devMode)) { - if (devMode == MODE_ON) { - modeTable[idx].setMode(mode); - modeTable[idx].setSubmode(SUBMODE_NONE); - } else { - modeTable[idx].setMode(MODE_ON); - modeTable[idx].setSubmode(SUBMODE_NONE); - if (internalState != STATE_SECOND_STEP) { - needsSecondStep = true; - } - } - } - } else if (mode == MODE_ON) { - if (isUseable(objId, devMode)) { - modeTable[idx].setMode(MODE_ON); - modeTable[idx].setSubmode(SUBMODE_NONE); - } + modeTable[idx].setSubmode(submode); } } } catch (const std::out_of_range& e) { - sif::error << "TcsBoardAssembly: Invalid children map: " << e.what() << std::endl; - } - if (needsSecondStep) { - result = NEED_SECOND_STEP; + sif::error << "RW ASSY: Invalid children map: " << e.what() << std::endl; } return result; } @@ -172,15 +144,3 @@ ReturnValue_t RwAssembly::initialize() { } return AssemblyBase::initialize(); } - -void RwAssembly::handleModeTransitionFailed(ReturnValue_t result) { - if (targetMode == MODE_OFF) { - AssemblyBase::handleModeTransitionFailed(result); - } else { - if (modeTransitionFailedSwitch) { - // To avoid transitioning back to off - triggerEvent(MODE_TRANSITION_FAILED, result); - modeTransitionFailedSwitch = false; - } - } -} diff --git a/mission/system/acs/RwAssembly.h b/mission/system/acs/RwAssembly.h index 0eb0b59f..540e37cc 100644 --- a/mission/system/acs/RwAssembly.h +++ b/mission/system/acs/RwAssembly.h @@ -41,11 +41,6 @@ class RwAssembly : public AssemblyBase { ReturnValue_t isModeCombinationValid(Mode_t mode, Submode_t submode) override; void startTransition(Mode_t mode, Submode_t submode) override; void handleModeReached() override; - - // These two overrides prevent a transition of the whole assembly back to off just because - // some devices are not working - void handleChildrenLostMode(ReturnValue_t result) override; - void handleModeTransitionFailed(ReturnValue_t result) override; }; #endif /* MISSION_SYSTEM_RWASS_H_ */ diff --git a/tmtc b/tmtc index dcf7d0af..7e5fa2e6 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit dcf7d0af71f6ba9d569f9f56604e9245a0233427 +Subproject commit 7e5fa2e61a3f2b50860fe2e3427f31f7ebaf854f From 5bdb7414bf7042c46d64bc7d363fa2d0785b14cb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 6 Apr 2023 19:12:15 +0200 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c9a5933..21c92c59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ will consitute of a breaking change warranting a new major release: - RW Assembly: Correctly transition back to off when more than 1 devices is OFF. Also do this when this was due to two devices being marked faulty. +- RW dummy and STR dummy components: Set/Update modes correctly. # [v1.43.2] 2023-04-05