maybe that fixes the issues

This commit is contained in:
Robin Müller 2023-04-05 10:27:19 +02:00
parent a06d90daad
commit 845548ed25
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 15 additions and 1 deletions

View File

@ -260,6 +260,7 @@ ReturnValue_t AcsBoardAssembly::checkAndHandleHealthStates(Mode_t deviceMode,
Submode_t deviceSubmode) { Submode_t deviceSubmode) {
using namespace returnvalue; using namespace returnvalue;
ReturnValue_t status = returnvalue::OK; ReturnValue_t status = returnvalue::OK;
bool healthNeedsToBeOverwritten = false;
auto checkAcsBoardSensorGroup = [&](object_id_t o0, object_id_t o1, object_id_t o2, auto checkAcsBoardSensorGroup = [&](object_id_t o0, object_id_t o1, object_id_t o2,
object_id_t o3) { object_id_t o3) {
HealthState h0 = healthHelper.healthTable->getHealth(o0); HealthState h0 = healthHelper.healthTable->getHealth(o0);
@ -272,6 +273,7 @@ ReturnValue_t AcsBoardAssembly::checkAndHandleHealthStates(Mode_t deviceMode,
overwriteDeviceHealth(o1, h1); overwriteDeviceHealth(o1, h1);
overwriteDeviceHealth(o2, h2); overwriteDeviceHealth(o2, h2);
overwriteDeviceHealth(o3, h3); overwriteDeviceHealth(o3, h3);
healthNeedsToBeOverwritten = true;
} }
if (h0 == EXTERNAL_CONTROL or h1 == EXTERNAL_CONTROL or h2 == EXTERNAL_CONTROL or if (h0 == EXTERNAL_CONTROL or h1 == EXTERNAL_CONTROL or h2 == EXTERNAL_CONTROL or
h3 == EXTERNAL_CONTROL) { h3 == EXTERNAL_CONTROL) {
@ -285,22 +287,29 @@ ReturnValue_t AcsBoardAssembly::checkAndHandleHealthStates(Mode_t deviceMode,
if (healthHelper.healthTable->getHealth(helper.healthDevGps0) == PERMANENT_FAULTY and if (healthHelper.healthTable->getHealth(helper.healthDevGps0) == PERMANENT_FAULTY and
healthHelper.healthTable->getHealth(helper.healthDevGps1) == FAULTY) { healthHelper.healthTable->getHealth(helper.healthDevGps1) == FAULTY) {
overwriteDeviceHealth(helper.healthDevGps1, FAULTY); overwriteDeviceHealth(helper.healthDevGps1, FAULTY);
healthNeedsToBeOverwritten = true;
} else if (healthHelper.healthTable->getHealth(helper.healthDevGps1) == PERMANENT_FAULTY and } else if (healthHelper.healthTable->getHealth(helper.healthDevGps1) == PERMANENT_FAULTY and
healthHelper.healthTable->getHealth(helper.healthDevGps0) == FAULTY) { healthHelper.healthTable->getHealth(helper.healthDevGps0) == FAULTY) {
overwriteDeviceHealth(helper.healthDevGps0, FAULTY); overwriteDeviceHealth(helper.healthDevGps0, FAULTY);
healthNeedsToBeOverwritten = true;
} else if (healthHelper.healthTable->isFaulty(helper.healthDevGps0) or } else if (healthHelper.healthTable->isFaulty(helper.healthDevGps0) or
healthHelper.healthTable->isFaulty(helper.healthDevGps1)) { healthHelper.healthTable->isFaulty(helper.healthDevGps1)) {
overwriteDeviceHealth(helper.healthDevGps0, overwriteDeviceHealth(helper.healthDevGps0,
healthHelper.healthTable->getHealth(helper.healthDevGps0)); healthHelper.healthTable->getHealth(helper.healthDevGps0));
overwriteDeviceHealth(helper.healthDevGps1, overwriteDeviceHealth(helper.healthDevGps1,
healthHelper.healthTable->getHealth(helper.healthDevGps1)); healthHelper.healthTable->getHealth(helper.healthDevGps1));
healthNeedsToBeOverwritten = true;
} }
if (deviceSubmode == duallane::DUAL_MODE) { if (deviceSubmode == duallane::DUAL_MODE) {
checkAcsBoardSensorGroup(helper.mgm0Lis3IdSideA, helper.mgm1Rm3100IdSideA, checkAcsBoardSensorGroup(helper.mgm0Lis3IdSideA, helper.mgm1Rm3100IdSideA,
helper.mgm2Lis3IdSideB, helper.mgm3Rm3100IdSideB); helper.mgm2Lis3IdSideB, helper.mgm3Rm3100IdSideB);
checkAcsBoardSensorGroup(helper.gyro0AdisIdSideA, helper.gyro1L3gIdSideA, checkAcsBoardSensorGroup(helper.gyro0AdisIdSideA, helper.gyro1L3gIdSideA,
helper.gyro2AdisIdSideB, helper.gyro3L3gIdSideB);
helper.gyro2AdisIdSideB, helper.gyro3L3gIdSideB);
}
if(healthNeedsToBeOverwritten) {
return NEED_TO_CHANGE_HEALTH;
} }
return status; return status;
} }

View File

@ -143,6 +143,7 @@ void SusAssembly::refreshHelperModes() {
ReturnValue_t SusAssembly::checkAndHandleHealthStates(Mode_t deviceMode, Submode_t deviceSubmode) { ReturnValue_t SusAssembly::checkAndHandleHealthStates(Mode_t deviceMode, Submode_t deviceSubmode) {
using namespace returnvalue; using namespace returnvalue;
ReturnValue_t status = returnvalue::OK; ReturnValue_t status = returnvalue::OK;
bool needsHealthOverwritten = false;
auto checkSusGroup = [&](object_id_t devNom, object_id_t devRed) { auto checkSusGroup = [&](object_id_t devNom, object_id_t devRed) {
HealthState healthNom = healthHelper.healthTable->getHealth(devNom); HealthState healthNom = healthHelper.healthTable->getHealth(devNom);
HealthState healthRed = healthHelper.healthTable->getHealth(devRed); HealthState healthRed = healthHelper.healthTable->getHealth(devRed);
@ -150,6 +151,7 @@ ReturnValue_t SusAssembly::checkAndHandleHealthStates(Mode_t deviceMode, Submode
(healthRed == FAULTY or healthRed == PERMANENT_FAULTY)) { (healthRed == FAULTY or healthRed == PERMANENT_FAULTY)) {
overwriteDeviceHealth(devNom, healthNom); overwriteDeviceHealth(devNom, healthNom);
overwriteDeviceHealth(devRed, healthRed); overwriteDeviceHealth(devRed, healthRed);
needsHealthOverwritten = true;
} }
}; };
auto checkHealthForOneDev = [&](object_id_t dev) { auto checkHealthForOneDev = [&](object_id_t dev) {
@ -168,5 +170,8 @@ ReturnValue_t SusAssembly::checkAndHandleHealthStates(Mode_t deviceMode, Submode
checkHealthForOneDev(helper.susIds[idx]); checkHealthForOneDev(helper.susIds[idx]);
} }
} }
if(needsHealthOverwritten) {
return NEED_TO_CHANGE_HEALTH;
}
return status; return status;
} }