From 2950876ce4fb73f8a9e10c5d9c88d88b3e1006b0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 5 Apr 2023 16:05:05 +0200 Subject: [PATCH 1/4] syrlinks ASSY --- mission/system/com/SyrlinksAssembly.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mission/system/com/SyrlinksAssembly.cpp b/mission/system/com/SyrlinksAssembly.cpp index b5e50924..f04142a1 100644 --- a/mission/system/com/SyrlinksAssembly.cpp +++ b/mission/system/com/SyrlinksAssembly.cpp @@ -19,7 +19,7 @@ ReturnValue_t SyrlinksAssembly::commandChildren(Mode_t mode, Submode_t submode) if (recoveryState == RECOVERY_IDLE) { ReturnValue_t result = checkAndHandleHealthState(mode, submode); if (result == NEED_TO_CHANGE_HEALTH) { - return OK; + return result; } } executeTable(iter); From 7549a24f6f5ad3db3355918bc73ebfd5e820dd47 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 5 Apr 2023 16:19:53 +0200 Subject: [PATCH 2/4] same adaption for IMTQ --- mission/system/acs/ImtqAssembly.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mission/system/acs/ImtqAssembly.cpp b/mission/system/acs/ImtqAssembly.cpp index 37d7fcc1..c2e99171 100644 --- a/mission/system/acs/ImtqAssembly.cpp +++ b/mission/system/acs/ImtqAssembly.cpp @@ -18,7 +18,7 @@ ReturnValue_t ImtqAssembly::commandChildren(Mode_t mode, Submode_t submode) { if (recoveryState == RECOVERY_IDLE) { ReturnValue_t result = checkAndHandleHealthState(mode, submode); if (result == NEED_TO_CHANGE_HEALTH) { - return OK; + return result; } } HybridIterator iter(commandTable.begin(), commandTable.end()); From 36d5f8fd31f023880c3d231def87622031e88185 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 5 Apr 2023 16:41:49 +0200 Subject: [PATCH 3/4] changelog, updates --- CHANGELOG.md | 6 +++ mission/system/acs/AcsBoardAssembly.cpp | 41 +++++++++++++++++++-- mission/system/acs/DualLaneAssemblyBase.cpp | 2 +- mission/system/acs/ImtqAssembly.cpp | 2 +- mission/system/com/SyrlinksAssembly.cpp | 2 +- 5 files changed, 46 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5754910c..5f11fbb0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,12 @@ will consitute of a breaking change warranting a new major release: - Syrlinks assembly - Dual Lane Assembly +## Fixed + +- Dual lane assemblies: Fix handling when health states are overwritten. Also add better handling + when some devices are permanent faulty and some are only faulty. In that case, only the faulty + devices will be restored. + # [v1.43.1] 2023-04-04 ## Fixed diff --git a/mission/system/acs/AcsBoardAssembly.cpp b/mission/system/acs/AcsBoardAssembly.cpp index 62fe316a..4893ce98 100644 --- a/mission/system/acs/AcsBoardAssembly.cpp +++ b/mission/system/acs/AcsBoardAssembly.cpp @@ -267,12 +267,45 @@ ReturnValue_t AcsBoardAssembly::checkAndHandleHealthStates(Mode_t commandedMode, HealthState h1 = healthHelper.healthTable->getHealth(o1); HealthState h2 = healthHelper.healthTable->getHealth(o2); HealthState h3 = healthHelper.healthTable->getHealth(o3); + // All device are faulty or permanent faulty, but this is a safe mode assembly, so we need + // to restore the devices. if ((h0 == FAULTY or h0 == PERMANENT_FAULTY) and (h1 == FAULTY or h1 == PERMANENT_FAULTY) and (h2 == FAULTY or h2 == PERMANENT_FAULTY) and (h3 == FAULTY or h3 == PERMANENT_FAULTY)) { - overwriteDeviceHealth(o0, h0); - overwriteDeviceHealth(o1, h1); - overwriteDeviceHealth(o2, h2); - overwriteDeviceHealth(o3, h3); + uint8_t numPermFaulty = 0; + if (h0 == PERMANENT_FAULTY) { + numPermFaulty++; + } + if (h1 == PERMANENT_FAULTY) { + numPermFaulty++; + } + if (h2 == PERMANENT_FAULTY) { + numPermFaulty++; + } + if (h3 == PERMANENT_FAULTY) { + numPermFaulty++; + } + if (numPermFaulty < 4) { + // Some are faulty and some are permanent faulty, so only set faulty ones to + // EXTERNAL_CONTROL. + if (h0 == FAULTY) { + overwriteDeviceHealth(o0, h0); + } + if (h1 == FAULTY) { + overwriteDeviceHealth(o0, h0); + } + if (h2 == FAULTY) { + overwriteDeviceHealth(o0, h0); + } + if (h3 == FAULTY) { + overwriteDeviceHealth(o0, h0); + } + } else { + // All permanent faulty, so set all to EXTERNAL_CONTROL + overwriteDeviceHealth(o0, h0); + overwriteDeviceHealth(o1, h1); + overwriteDeviceHealth(o2, h2); + overwriteDeviceHealth(o3, h3); + } healthNeedsToBeOverwritten = true; } if (h0 == EXTERNAL_CONTROL or h1 == EXTERNAL_CONTROL or h2 == EXTERNAL_CONTROL or diff --git a/mission/system/acs/DualLaneAssemblyBase.cpp b/mission/system/acs/DualLaneAssemblyBase.cpp index 788ec34e..7d22fbd1 100644 --- a/mission/system/acs/DualLaneAssemblyBase.cpp +++ b/mission/system/acs/DualLaneAssemblyBase.cpp @@ -117,7 +117,7 @@ ReturnValue_t DualLaneAssemblyBase::isModeCombinationValid(Mode_t mode, Submode_ if (mode != MODE_OFF and (submode != A_SIDE and submode != B_SIDE and submode != DUAL_MODE)) { return HasModesIF::INVALID_SUBMODE; } - if(mode == MODE_OFF and submode != SUBMODE_NONE) { + if (mode == MODE_OFF and submode != SUBMODE_NONE) { return HasModesIF::INVALID_SUBMODE; } return returnvalue::OK; diff --git a/mission/system/acs/ImtqAssembly.cpp b/mission/system/acs/ImtqAssembly.cpp index c2e99171..e973a11b 100644 --- a/mission/system/acs/ImtqAssembly.cpp +++ b/mission/system/acs/ImtqAssembly.cpp @@ -35,7 +35,7 @@ ReturnValue_t ImtqAssembly::checkChildrenStateOn(Mode_t wantedMode, Submode_t wa ReturnValue_t ImtqAssembly::isModeCombinationValid(Mode_t mode, Submode_t submode) { if (mode == MODE_ON or mode == DeviceHandlerIF::MODE_NORMAL or mode == MODE_OFF) { - if(submode != SUBMODE_NONE) { + if (submode != SUBMODE_NONE) { return HasModesIF::INVALID_SUBMODE; } return returnvalue::OK; diff --git a/mission/system/com/SyrlinksAssembly.cpp b/mission/system/com/SyrlinksAssembly.cpp index c79e1f8f..b8063bbf 100644 --- a/mission/system/com/SyrlinksAssembly.cpp +++ b/mission/system/com/SyrlinksAssembly.cpp @@ -41,7 +41,7 @@ ReturnValue_t SyrlinksAssembly::isModeCombinationValid(Mode_t mode, Submode_t su } return returnvalue::OK; } - if(mode == MODE_OFF and submode != SUBMODE_NONE) { + if (mode == MODE_OFF and submode != SUBMODE_NONE) { return HasModesIF::INVALID_SUBMODE; } return returnvalue::OK; From 0a68b50ad79b1dfa1c04824bbd5b2fcf302e97ec Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 5 Apr 2023 16:58:32 +0200 Subject: [PATCH 4/4] copy and paste fix --- mission/system/acs/AcsBoardAssembly.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mission/system/acs/AcsBoardAssembly.cpp b/mission/system/acs/AcsBoardAssembly.cpp index 4893ce98..a4060343 100644 --- a/mission/system/acs/AcsBoardAssembly.cpp +++ b/mission/system/acs/AcsBoardAssembly.cpp @@ -291,13 +291,13 @@ ReturnValue_t AcsBoardAssembly::checkAndHandleHealthStates(Mode_t commandedMode, overwriteDeviceHealth(o0, h0); } if (h1 == FAULTY) { - overwriteDeviceHealth(o0, h0); + overwriteDeviceHealth(o1, h1); } if (h2 == FAULTY) { - overwriteDeviceHealth(o0, h0); + overwriteDeviceHealth(o2, h2); } if (h3 == FAULTY) { - overwriteDeviceHealth(o0, h0); + overwriteDeviceHealth(o3, h3); } } else { // All permanent faulty, so set all to EXTERNAL_CONTROL