From ca6556c000c297adec08c6b6a4b43a1b63d98b8c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Mar 2023 15:41:56 +0100 Subject: [PATCH 1/9] add health handling for TCS ASSY --- mission/system/objects/TcsBoardAssembly.cpp | 27 +++++++++++++++++++-- mission/system/objects/TcsBoardAssembly.h | 1 + 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/mission/system/objects/TcsBoardAssembly.cpp b/mission/system/objects/TcsBoardAssembly.cpp index 88075fdc..974c073e 100644 --- a/mission/system/objects/TcsBoardAssembly.cpp +++ b/mission/system/objects/TcsBoardAssembly.cpp @@ -41,6 +41,12 @@ ReturnValue_t TcsBoardAssembly::commandChildren(Mode_t mode, Submode_t submode) modeTable[idx].setMode(MODE_OFF); modeTable[idx].setSubmode(SUBMODE_NONE); } + if (recoveryState == RecoveryState::RECOVERY_IDLE) { + result = checkAndHandleHealthStates(mode, submode); + if (result == NEED_TO_CHANGE_HEALTH) { + return returnvalue::OK; + } + } if (recoveryState != RecoveryState::RECOVERY_STARTED) { if (mode == DeviceHandlerIF::MODE_NORMAL or mode == MODE_ON) { result = handleNormalOrOnModeCmd(mode, submode); @@ -180,9 +186,26 @@ void TcsBoardAssembly::handleModeReached() { } void TcsBoardAssembly::handleChildrenLostMode(ReturnValue_t result) { - // TODO: Maybe try a reboot once here? triggerEvent(CHILDREN_LOST_MODE, result); - return; + startTransition(mode, submode); +} + +ReturnValue_t TcsBoardAssembly::checkAndHandleHealthStates(Mode_t deviceMode, + Submode_t deviceSubmode) { + ReturnValue_t status = returnvalue::OK; + auto overwriteHealthForOneDev = [&](object_id_t dev) { + HealthState health = healthHelper.healthTable->getHealth(dev); + if (health == FAULTY or health == PERMANENT_FAULTY) { + overwriteDeviceHealth(dev, health); + status = NEED_TO_CHANGE_HEALTH; + } else if (health == EXTERNAL_CONTROL) { + modeHelper.setForced(true); + } + }; + for (const auto& dev : helper.rtdInfos) { + overwriteHealthForOneDev(dev.first); + } + return returnvalue::OK; } void TcsBoardAssembly::handleModeTransitionFailed(ReturnValue_t result) { diff --git a/mission/system/objects/TcsBoardAssembly.h b/mission/system/objects/TcsBoardAssembly.h index fb5f7d38..3c3fc0d6 100644 --- a/mission/system/objects/TcsBoardAssembly.h +++ b/mission/system/objects/TcsBoardAssembly.h @@ -52,6 +52,7 @@ class TcsBoardAssembly : public AssemblyBase, public ConfirmsFailuresIF { ReturnValue_t isModeCombinationValid(Mode_t mode, Submode_t submode) override; void startTransition(Mode_t mode, Submode_t submode) override; void handleModeReached() override; + ReturnValue_t checkAndHandleHealthStates(Mode_t deviceMode, Submode_t deviceSubmode); // These two overrides prevent a transition of the whole assembly back to off just because // some devices are not working -- 2.43.0 From cee56f6d02a4f489247800aa263cd51b422417b6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Mar 2023 15:58:19 +0100 Subject: [PATCH 2/9] changelog update --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b08ae006..0ddb1cfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +## Fixed + +- Health handling for TCS board assembly + # [v1.35.1] 2023-03-04 ## Fixed -- 2.43.0 From 2ccd2a832c85459501685ddce661a1f7885c8ecf Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Mar 2023 17:34:04 +0100 Subject: [PATCH 3/9] tricky --- mission/system/objects/TcsBoardAssembly.cpp | 23 ++++++++++++--------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/mission/system/objects/TcsBoardAssembly.cpp b/mission/system/objects/TcsBoardAssembly.cpp index 974c073e..4c8da92f 100644 --- a/mission/system/objects/TcsBoardAssembly.cpp +++ b/mission/system/objects/TcsBoardAssembly.cpp @@ -68,10 +68,10 @@ ReturnValue_t TcsBoardAssembly::checkChildrenStateOn(Mode_t wantedMode, Submode_ } catch (const std::out_of_range& e) { sif::error << "TcsBoardAssembly: Invalid children map: " << e.what() << std::endl; } - if (devsInWrongMode >= 3) { + if (devsInWrongMode == NUMBER_RTDS) { if (warningSwitch) { - sif::warning << "TcsBoardAssembly::checkChildrenStateOn: " << devsInWrongMode << " devices in" - << " wrong mode" << std::endl; + sif::warning << "TcsBoardAssembly::checkChildrenStateOn: All devices in wrong mode" + << std::endl; warningSwitch = false; } return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE; @@ -193,19 +193,22 @@ void TcsBoardAssembly::handleChildrenLostMode(ReturnValue_t result) { ReturnValue_t TcsBoardAssembly::checkAndHandleHealthStates(Mode_t deviceMode, Submode_t deviceSubmode) { ReturnValue_t status = returnvalue::OK; - auto overwriteHealthForOneDev = [&](object_id_t dev) { - HealthState health = healthHelper.healthTable->getHealth(dev); + for (const auto& dev : helper.rtdInfos) { + HealthState health = healthHelper.healthTable->getHealth(dev.first); + if (health == HealthState::HEALTHY) { + return returnvalue::OK; + } + } + + for (const auto& dev : helper.rtdInfos) { + HealthState health = healthHelper.healthTable->getHealth(dev.first); if (health == FAULTY or health == PERMANENT_FAULTY) { - overwriteDeviceHealth(dev, health); status = NEED_TO_CHANGE_HEALTH; } else if (health == EXTERNAL_CONTROL) { modeHelper.setForced(true); } - }; - for (const auto& dev : helper.rtdInfos) { - overwriteHealthForOneDev(dev.first); } - return returnvalue::OK; + return status; } void TcsBoardAssembly::handleModeTransitionFailed(ReturnValue_t result) { -- 2.43.0 From db2905c834d1faa922a9e48cc06bc6aa43204dcb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Mar 2023 17:59:28 +0100 Subject: [PATCH 4/9] order bugfix for TCS subsystem --- mission/system/tree/tcsModeTree.cpp | 31 +++++++++++++++-------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/mission/system/tree/tcsModeTree.cpp b/mission/system/tree/tcsModeTree.cpp index d411161a..43ed2e85 100644 --- a/mission/system/tree/tcsModeTree.cpp +++ b/mission/system/tree/tcsModeTree.cpp @@ -19,8 +19,8 @@ static const auto NML = DeviceHandlerIF::MODE_NORMAL; auto TCS_SEQUENCE_OFF = std::make_pair(OFF, FixedArrayList()); auto TCS_TABLE_OFF_TGT = std::make_pair((OFF << 24) | 1, FixedArrayList()); -auto TCS_TABLE_OFF_TRANS_0 = std::make_pair((OFF << 24) | 2, FixedArrayList()); -auto TCS_TABLE_OFF_TRANS_1 = std::make_pair((OFF << 24) | 3, FixedArrayList()); +auto TCS_TABLE_OFF_TRANS_0 = std::make_pair((OFF << 24) | 2, FixedArrayList()); +auto TCS_TABLE_OFF_TRANS_1 = std::make_pair((OFF << 24) | 3, FixedArrayList()); auto TCS_SEQUENCE_NORMAL = std::make_pair(NML, FixedArrayList()); auto TCS_TABLE_NORMAL_TGT = std::make_pair((NML << 24) | 1, FixedArrayList()); @@ -59,18 +59,19 @@ void buildOffSequence(Subsystem& ss, ModeListEntry& eh) { // OFF target table is empty check(ss.addTable(TableEntry(TCS_TABLE_OFF_TGT.first, &TCS_TABLE_OFF_TGT.second)), ctxc); - iht(objects::TCS_BOARD_ASS, OFF, 0, TCS_TABLE_OFF_TRANS_0.second); - iht(objects::TMP1075_HANDLER_TCS_0, OFF, 0, TCS_TABLE_OFF_TRANS_0.second); - iht(objects::TMP1075_HANDLER_TCS_1, OFF, 0, TCS_TABLE_OFF_TRANS_0.second); - iht(objects::TMP1075_HANDLER_PLPCDU_0, OFF, 0, TCS_TABLE_OFF_TRANS_0.second); - // damaged - // iht(objects::TMP1075_HANDLER_PLPCDU_1, OFF, 0, TCS_TABLE_OFF_TRANS_0.second); - iht(objects::TMP1075_HANDLER_IF_BOARD, OFF, 0, TCS_TABLE_OFF_TRANS_0.second); - check(ss.addTable(TableEntry(TCS_TABLE_OFF_TRANS_0.first, &TCS_TABLE_OFF_TRANS_0.second)), ctxc); - + // Transition 1 iht(objects::THERMAL_CONTROLLER, OFF, 0, TCS_TABLE_OFF_TRANS_0.second); + check(ss.addTable(TableEntry(TCS_TABLE_OFF_TRANS_1.first, &TCS_TABLE_OFF_TRANS_0.second)), ctxc); + + iht(objects::TCS_BOARD_ASS, OFF, 0, TCS_TABLE_OFF_TRANS_1.second); + iht(objects::TMP1075_HANDLER_TCS_0, OFF, 0, TCS_TABLE_OFF_TRANS_1.second); + iht(objects::TMP1075_HANDLER_TCS_1, OFF, 0, TCS_TABLE_OFF_TRANS_1.second); + iht(objects::TMP1075_HANDLER_PLPCDU_0, OFF, 0, TCS_TABLE_OFF_TRANS_1.second); + // TMP PL PCDU 1 is damaged + iht(objects::TMP1075_HANDLER_IF_BOARD, OFF, 0, TCS_TABLE_OFF_TRANS_1.second); check(ss.addTable(TableEntry(TCS_TABLE_OFF_TRANS_1.first, &TCS_TABLE_OFF_TRANS_1.second)), ctxc); + ihs(TCS_SEQUENCE_OFF.second, TCS_TABLE_OFF_TGT.first, 0, false); ihs(TCS_SEQUENCE_OFF.second, TCS_TABLE_OFF_TRANS_0.first, 0, false); ihs(TCS_SEQUENCE_OFF.second, TCS_TABLE_OFF_TRANS_1.first, 0, false); @@ -98,20 +99,20 @@ void buildNormalSequence(Subsystem& ss, ModeListEntry& eh) { check(sequence.insert(eh), ctxc); }; - // OFF target table is empty + // Normal target table is empty check(ss.addTable(TableEntry(TCS_TABLE_NORMAL_TGT.first, &TCS_TABLE_NORMAL_TGT.second)), ctxc); iht(objects::TCS_BOARD_ASS, NML, 0, TCS_TABLE_NORMAL_TRANS_0.second); iht(objects::TMP1075_HANDLER_TCS_0, NML, 0, TCS_TABLE_NORMAL_TRANS_0.second); iht(objects::TMP1075_HANDLER_TCS_1, NML, 0, TCS_TABLE_NORMAL_TRANS_0.second); iht(objects::TMP1075_HANDLER_PLPCDU_0, NML, 0, TCS_TABLE_NORMAL_TRANS_0.second); - // damaged - // iht(objects::TMP1075_HANDLER_PLPCDU_1, NML, 0, TCS_TABLE_NORMAL_TRANS_0.second); + // TMP PL PCDU 1 is damaged iht(objects::TMP1075_HANDLER_IF_BOARD, NML, 0, TCS_TABLE_NORMAL_TRANS_0.second); check(ss.addTable(TableEntry(TCS_TABLE_NORMAL_TRANS_0.first, &TCS_TABLE_NORMAL_TRANS_0.second)), ctxc); - iht(objects::THERMAL_CONTROLLER, NML, 0, TCS_TABLE_NORMAL_TRANS_0.second); + // Transition 1 + iht(objects::THERMAL_CONTROLLER, NML, 0, TCS_TABLE_NORMAL_TRANS_1.second); check(ss.addTable(TableEntry(TCS_TABLE_NORMAL_TRANS_1.first, &TCS_TABLE_NORMAL_TRANS_1.second)), ctxc); -- 2.43.0 From 52182028241769a4692b3c1371f0e61ee2979b64 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 7 Mar 2023 10:16:32 +0100 Subject: [PATCH 5/9] bump tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 9462a6e2..e74e7511 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 9462a6e2459e11ac03c2bb9694772959ac228cd0 +Subproject commit e74e751142e46c801852a110bef11510cc7c7bfa -- 2.43.0 From e48d0806737585ad8b01c9161f8e6c168fb7834a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 7 Mar 2023 17:08:33 +0100 Subject: [PATCH 6/9] small tweak --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49badb4a..0edc354f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ will consitute of a breaking change warranting a new major release: ## Fixed - Health handling for TCS board assembly + ## Changed - Transmitter timeout set to 2 minutes instead of 15 minutes. This will prevent to discharge the battery -- 2.43.0 From 4863dad1cd4e7e8231f23b02a5b80c23dcd40293 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 8 Mar 2023 18:59:22 +0100 Subject: [PATCH 7/9] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index de02ac75..d348f8fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ will consitute of a breaking change warranting a new major release: ## Fixed +- Command TCS controller off first for TCS subsystem transition to off. - Health handling for TCS board assembly - Mode fallback from IDLE mode to SAFE mode due to ACS errors/events now works properly for the ACS subsystem -- 2.43.0 From 101117cebe3d1ce0156024148c493efcc3d55c2b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 8 Mar 2023 19:06:48 +0100 Subject: [PATCH 8/9] small fix --- mission/system/tree/tcsModeTree.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mission/system/tree/tcsModeTree.cpp b/mission/system/tree/tcsModeTree.cpp index 43ed2e85..a3bd4319 100644 --- a/mission/system/tree/tcsModeTree.cpp +++ b/mission/system/tree/tcsModeTree.cpp @@ -61,7 +61,7 @@ void buildOffSequence(Subsystem& ss, ModeListEntry& eh) { // Transition 1 iht(objects::THERMAL_CONTROLLER, OFF, 0, TCS_TABLE_OFF_TRANS_0.second); - check(ss.addTable(TableEntry(TCS_TABLE_OFF_TRANS_1.first, &TCS_TABLE_OFF_TRANS_0.second)), ctxc); + check(ss.addTable(TableEntry(TCS_TABLE_OFF_TRANS_0.first, &TCS_TABLE_OFF_TRANS_0.second)), ctxc); iht(objects::TCS_BOARD_ASS, OFF, 0, TCS_TABLE_OFF_TRANS_1.second); iht(objects::TMP1075_HANDLER_TCS_0, OFF, 0, TCS_TABLE_OFF_TRANS_1.second); -- 2.43.0 From 0a37db617b63dfc54b9a16cecebfc74630112650 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 8 Mar 2023 19:12:10 +0100 Subject: [PATCH 9/9] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index af17e306..d758a1f1 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit af17e30676b3c4e364b6969873519951453181e2 +Subproject commit d758a1f11ac4d39eda08918c124d8736da104687 -- 2.43.0