Merge pull request 'Health handling for ACS brd assy' (#415) from bugfix_acs_brd_ass into develop
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

Reviewed-on: #415
This commit is contained in:
Robin Müller 2023-03-06 14:36:19 +01:00
commit 3b5ecb43cc
11 changed files with 50 additions and 16 deletions

View File

@ -16,6 +16,12 @@ will consitute of a breaking change warranting a new major release:
# [unreleased] # [unreleased]
## Fixed
- ACS Board Assembly FDIR: Prevent permanent SAFE mode fallbacks by introducing special health
handling.
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/418/files
## Added ## Added
- Add IMTQ assembly - Add IMTQ assembly

View File

@ -48,7 +48,7 @@ void GyrAdis1650XHandler::doShutDown() {
updatePeriodicReply(false, adis1650x::REPLY); updatePeriodicReply(false, adis1650x::REPLY);
internalState = InternalState::NONE; internalState = InternalState::NONE;
commandExecuted = false; commandExecuted = false;
setMode(_MODE_POWER_DOWN); setMode(MODE_OFF);
} }
} }
@ -90,7 +90,8 @@ void GyrAdis1650XHandler::fillCommandAndReplyMap() {
ReturnValue_t GyrAdis1650XHandler::scanForReply(const uint8_t *start, size_t remainingSize, ReturnValue_t GyrAdis1650XHandler::scanForReply(const uint8_t *start, size_t remainingSize,
DeviceCommandId_t *foundId, size_t *foundLen) { DeviceCommandId_t *foundId, size_t *foundLen) {
if (breakCountdown.isBusy() or getMode() == _MODE_WAIT_OFF or getMode() == _MODE_WAIT_ON) { if (breakCountdown.isBusy() or getMode() == _MODE_WAIT_OFF or getMode() == _MODE_WAIT_ON or
getMode() == _MODE_POWER_DOWN) {
return IGNORE_FULL_PACKET; return IGNORE_FULL_PACKET;
} }
if (remainingSize != sizeof(acs::Adis1650XReply)) { if (remainingSize != sizeof(acs::Adis1650XReply)) {

View File

@ -44,7 +44,7 @@ void GyrL3gCustomHandler::doShutDown() {
internalState = InternalState::NONE; internalState = InternalState::NONE;
updatePeriodicReply(false, l3gd20h::REPLY); updatePeriodicReply(false, l3gd20h::REPLY);
commandExecuted = false; commandExecuted = false;
setMode(_MODE_POWER_DOWN); setMode(MODE_OFF);
} }
} }
@ -100,7 +100,7 @@ ReturnValue_t GyrL3gCustomHandler::buildCommandFromCommand(DeviceCommandId_t dev
ReturnValue_t GyrL3gCustomHandler::scanForReply(const uint8_t *start, size_t len, ReturnValue_t GyrL3gCustomHandler::scanForReply(const uint8_t *start, size_t len,
DeviceCommandId_t *foundId, size_t *foundLen) { DeviceCommandId_t *foundId, size_t *foundLen) {
if (getMode() == _MODE_WAIT_OFF or getMode() == _MODE_WAIT_ON) { if (getMode() == _MODE_WAIT_OFF or getMode() == _MODE_WAIT_ON or getMode() == _MODE_POWER_DOWN) {
return IGNORE_FULL_PACKET; return IGNORE_FULL_PACKET;
} }
if (len != sizeof(acs::GyroL3gReply)) { if (len != sizeof(acs::GyroL3gReply)) {

View File

@ -37,7 +37,7 @@ void MgmLis3CustomHandler::doShutDown() {
updatePeriodicReply(false, REPLY); updatePeriodicReply(false, REPLY);
commandExecuted = false; commandExecuted = false;
internalState = InternalState::NONE; internalState = InternalState::NONE;
setMode(_MODE_POWER_DOWN); setMode(MODE_OFF);
} }
} }

View File

@ -38,7 +38,7 @@ void MgmRm3100CustomHandler::doShutDown() {
} }
if (internalState == InternalState::SHUTDOWN and commandExecuted) { if (internalState == InternalState::SHUTDOWN and commandExecuted) {
updatePeriodicReply(false, REPLY); updatePeriodicReply(false, REPLY);
setMode(_MODE_POWER_DOWN); setMode(MODE_OFF);
commandExecuted = false; commandExecuted = false;
} }
} }

View File

@ -55,6 +55,12 @@ ReturnValue_t AcsBoardAssembly::commandChildren(Mode_t mode, Submode_t submode)
modeTable[ModeTableIdx::MGM_3_B].setSubmode(SUBMODE_NONE); modeTable[ModeTableIdx::MGM_3_B].setSubmode(SUBMODE_NONE);
modeTable[ModeTableIdx::GPS].setMode(MODE_OFF); modeTable[ModeTableIdx::GPS].setMode(MODE_OFF);
modeTable[ModeTableIdx::GPS].setSubmode(SUBMODE_NONE); modeTable[ModeTableIdx::GPS].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 (recoveryState != RecoveryState::RECOVERY_STARTED) {
if (mode == DeviceHandlerIF::MODE_NORMAL or mode == MODE_ON) { if (mode == DeviceHandlerIF::MODE_NORMAL or mode == MODE_ON) {
result = handleNormalOrOnModeCmd(mode, submode); result = handleNormalOrOnModeCmd(mode, submode);
@ -280,3 +286,30 @@ ReturnValue_t AcsBoardAssembly::initialize() {
} }
return AssemblyBase::initialize(); return AssemblyBase::initialize();
} }
ReturnValue_t AcsBoardAssembly::checkAndHandleHealthStates(Mode_t deviceMode,
Submode_t deviceSubmode) {
using namespace returnvalue;
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);
}
};
if (deviceSubmode == duallane::DUAL_MODE) {
overwriteHealthForOneDev(helper.mgm0Lis3IdSideA);
overwriteHealthForOneDev(helper.mgm1Rm3100IdSideA);
overwriteHealthForOneDev(helper.mgm2Lis3IdSideB);
overwriteHealthForOneDev(helper.mgm3Rm3100IdSideB);
overwriteHealthForOneDev(helper.gyro0AdisIdSideA);
overwriteHealthForOneDev(helper.gyro1L3gIdSideA);
overwriteHealthForOneDev(helper.gyro2AdisIdSideB);
overwriteHealthForOneDev(helper.gyro3L3gIdSideB);
overwriteHealthForOneDev(helper.gpsId);
}
return status;
}

View File

@ -121,6 +121,7 @@ class AcsBoardAssembly : public DualLaneAssemblyBase {
ReturnValue_t checkChildrenStateOn(Mode_t wantedMode, Submode_t wantedSubmode) override; ReturnValue_t checkChildrenStateOn(Mode_t wantedMode, Submode_t wantedSubmode) override;
ReturnValue_t handleNormalOrOnModeCmd(Mode_t mode, Submode_t submode); ReturnValue_t handleNormalOrOnModeCmd(Mode_t mode, Submode_t submode);
ReturnValue_t checkAndHandleHealthStates(Mode_t deviceMode, Submode_t deviceSubmode);
void refreshHelperModes(); void refreshHelperModes();
}; };

View File

@ -235,8 +235,3 @@ void DualLaneAssemblyBase::setPreferredSide(duallane::Submodes submode) {
} }
this->defaultSubmode = submode; this->defaultSubmode = submode;
} }
ReturnValue_t DualLaneAssemblyBase::checkAndHandleHealthState(Mode_t deviceMode,
Submode_t deviceSubmode) {
return returnvalue::OK;
}

View File

@ -70,11 +70,11 @@ class DualLaneAssemblyBase : public AssemblyBase, public ConfirmsFailuresIF {
virtual void handleChildrenLostMode(ReturnValue_t result) override; virtual void handleChildrenLostMode(ReturnValue_t result) override;
virtual void handleModeTransitionFailed(ReturnValue_t result) override; virtual void handleModeTransitionFailed(ReturnValue_t result) override;
virtual void handleModeReached() override; virtual void handleModeReached() override;
ReturnValue_t checkAndHandleHealthState(Mode_t deviceMode, Submode_t deviceSubmode);
MessageQueueId_t getEventReceptionQueue() override; MessageQueueId_t getEventReceptionQueue() override;
bool sideSwitchTransition(Mode_t mode, Submode_t submode); bool sideSwitchTransition(Mode_t mode, Submode_t submode);
ReturnValue_t checkAndHandleHealthState(Mode_t deviceMode, Submode_t deviceSubmode);
/** /**
* Implemented by user. Will be called if a full mode operation has finished. * Implemented by user. Will be called if a full mode operation has finished.

View File

@ -51,6 +51,4 @@ ReturnValue_t ImtqAssembly::checkAndHandleHealthState(Mode_t deviceMode, Submode
return OK; return OK;
} }
void ImtqAssembly::handleChildrenLostMode(ReturnValue_t result) { void ImtqAssembly::handleChildrenLostMode(ReturnValue_t result) { startTransition(mode, submode); }
startTransition(mode, submode);
}

2
tmtc

@ -1 +1 @@
Subproject commit 208d328683a9911ecaa1d60abd3b8a9e3a841c37 Subproject commit 9462a6e2459e11ac03c2bb9694772959ac228cd0