that should fix the issue
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2023-03-31 19:14:42 +02:00
parent e365e03c2a
commit 65989261b0
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
4 changed files with 26 additions and 15 deletions

View File

@ -112,20 +112,7 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s
using namespace duallane;
ReturnValue_t result = returnvalue::OK;
bool needsSecondStep = false;
if (sideSwitchState == SideSwitchState::REQUESTED) {
sideSwitchState = SideSwitchState::TO_DUAL;
}
// Switch to dual side first, and later switch back to the otherside
if (sideSwitchState == SideSwitchState::TO_DUAL) {
targetSubmodeForSideSwitch = static_cast<duallane::Submodes>(submode);
submode = Submodes::DUAL_MODE;
sideSwitchState = SideSwitchState::DISABLE_OTHER_SIDE;
// TODO: Ugly hack. The base class should support arbitrary number of steps..
needsSecondStep = true;
} else if (sideSwitchState == SideSwitchState::DISABLE_OTHER_SIDE) {
dualToSingleSideTransition = true;
submode = targetSubmodeForSideSwitch;
}
handleSideSwitchStates(submode, needsSecondStep);
auto cmdSeq = [&](object_id_t objectId, Mode_t devMode, ModeTableIdx tableIdx) {
if (mode == devMode) {
modeTable[tableIdx].setMode(mode);

View File

@ -130,7 +130,11 @@ void DualLaneAssemblyBase::handleModeReached() {
// For dual to single side transition, devices should be logically off, but the switch
// handling still needs to be done.
if (dualToSingleSideTransition) {
if (sideSwitchState == SideSwitchState::DISABLE_OTHER_SIDE) {
pwrStateMachine.start(targetMode, targetSubmodeForSideSwitch);
} else {
pwrStateMachine.start(targetMode, targetSubmode);
}
pwrStateMachineWrapper();
return;
}
@ -238,6 +242,24 @@ bool DualLaneAssemblyBase::sideSwitchTransition(Mode_t mode, Submode_t submode)
return false;
}
void DualLaneAssemblyBase::handleSideSwitchStates(uint8_t& submode, bool& needsSecondStep) {
if (sideSwitchState == SideSwitchState::REQUESTED) {
sideSwitchState = SideSwitchState::TO_DUAL;
}
// Switch to dual side first, and later switch back to the otherside
if (sideSwitchState == SideSwitchState::TO_DUAL) {
targetSubmodeForSideSwitch = static_cast<duallane::Submodes>(submode);
submode = duallane::Submodes::DUAL_MODE;
sideSwitchState = SideSwitchState::DISABLE_OTHER_SIDE;
// TODO: Ugly hack. The base class should support arbitrary number of steps..
needsSecondStep = true;
} else if (sideSwitchState == SideSwitchState::DISABLE_OTHER_SIDE) {
// Set this flag because the power needs to be switched off.
dualToSingleSideTransition = true;
submode = targetSubmodeForSideSwitch;
}
}
void DualLaneAssemblyBase::finishModeOp() {
using namespace duallane;
AssemblyBase::handleModeReached();

View File

@ -47,6 +47,7 @@ class DualLaneAssemblyBase : public AssemblyBase, public ConfirmsFailuresIF {
} customRecoveryStates = RecoveryCustomStates::IDLE;
MessageQueueIF* eventQueue = nullptr;
void handleSideSwitchStates(uint8_t& submode, bool& needsSecondStep);
/**
* Check whether it makes sense to send mode commands to the device.

View File

@ -45,6 +45,7 @@ ReturnValue_t SusAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t submod
using namespace duallane;
ReturnValue_t result = returnvalue::OK;
bool needsSecondStep = false;
handleSideSwitchStates(submode, needsSecondStep);
auto cmdSeq = [&](object_id_t objectId, Mode_t devMode, uint8_t tableIdx) {
if (mode == devMode) {
modeTable[tableIdx].setMode(mode);