some bugfixes
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
2023-03-24 19:14:27 +01:00
parent bea0c31a12
commit ec40044b6e
5 changed files with 16 additions and 10 deletions

View File

@ -110,13 +110,14 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s
using namespace duallane;
ReturnValue_t result = returnvalue::OK;
bool needsSecondStep = false;
if (sideSwitchTransition(mode, submode) and sideSwitchState == SideSwitchState::NONE) {
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) {
submode = Submodes::DUAL_MODE;
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) {

View File

@ -46,9 +46,13 @@ void DualLaneAssemblyBase::startTransition(Mode_t mode, Submode_t submode) {
AssemblyBase::startTransition(mode, submode);
return;
}
uint8_t pwrSubmode = submode;
if (sideSwitchState == SideSwitchState::REQUESTED) {
pwrSubmode = duallane::DUAL_MODE;
}
// If anything other than MODE_OFF is commanded, perform power state machine first
// Cache the target modes, required by power state machine
pwrStateMachine.start(mode, submode);
pwrStateMachine.start(mode, pwrSubmode);
// Cache these for later after the power state machine has finished
targetMode = mode;
targetSubmode = submode;
@ -112,7 +116,7 @@ ReturnValue_t DualLaneAssemblyBase::isModeCombinationValid(Mode_t mode, Submode_
return returnvalue::FAILED;
}
if (sideSwitchTransition(mode, submode)) {
// inSideSwitchTransition = true;
sideSwitchState = SideSwitchState::REQUESTED;
}
return returnvalue::OK;
}
@ -228,9 +232,8 @@ bool DualLaneAssemblyBase::sideSwitchTransition(Mode_t mode, Submode_t submode)
return false;
}
if (this->mode == MODE_ON or this->mode == DeviceHandlerIF::MODE_NORMAL) {
if (this->submode == Submodes::A_SIDE and submode == Submodes::B_SIDE) {
return true;
} else if (this->submode == Submodes::B_SIDE and submode == Submodes::A_SIDE) {
if ((this->submode == Submodes::A_SIDE and submode == Submodes::B_SIDE) or
(this->submode == Submodes::B_SIDE and submode == Submodes::A_SIDE)) {
return true;
}
return false;

View File

@ -34,7 +34,7 @@ class DualLaneAssemblyBase : public AssemblyBase, public ConfirmsFailuresIF {
bool dualToSingleSideTransition = false;
duallane::Submodes defaultSubmode = duallane::Submodes::A_SIDE;
enum SideSwitchState { NONE, TO_DUAL, DISABLE_OTHER_SIDE };
enum SideSwitchState { NONE, REQUESTED, TO_DUAL, DISABLE_OTHER_SIDE };
SideSwitchState sideSwitchState = SideSwitchState::NONE;
duallane::Submodes targetSubmodeForSideSwitch = duallane::Submodes::B_SIDE;