bugfix for dual to single side transition
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2023-03-20 10:17:41 +01:00
parent a196ab136e
commit 5890e639fe
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 11 additions and 2 deletions

View File

@ -34,10 +34,17 @@ void DualLaneAssemblyBase::performChildOperation() {
}
void DualLaneAssemblyBase::startTransition(Mode_t mode, Submode_t submode) {
// doStartTransition(mode, submode);
using namespace duallane;
pwrStateMachine.reset();
if (mode != MODE_OFF) {
// Special exception: A transition from dual side to single mode must be handled like
// going OFF.
if ((this->mode == MODE_ON or this->mode == DeviceHandlerIF::MODE_NORMAL) and
this->submode == DUAL_MODE and submode != DUAL_MODE) {
dualToSingleSideTransition = true;
AssemblyBase::startTransition(mode, submode);
return;
}
// 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);
@ -111,7 +118,7 @@ ReturnValue_t DualLaneAssemblyBase::isModeCombinationValid(Mode_t mode, Submode_
void DualLaneAssemblyBase::handleModeReached() {
using namespace duallane;
if (targetMode == MODE_OFF) {
if (targetMode == MODE_OFF or dualToSingleSideTransition) {
pwrStateMachine.start(targetMode, targetSubmode);
// Now we can switch off the power. After that, the AssemblyBase::handleModeReached function
// will be called
@ -229,6 +236,7 @@ void DualLaneAssemblyBase::finishModeOp() {
pwrStateMachine.reset();
powerRetryCounter = 0;
tryingOtherSide = false;
dualToSingleSideTransition = false;
dualModeErrorSwitch = true;
}

View File

@ -31,6 +31,7 @@ class DualLaneAssemblyBase : public AssemblyBase, public ConfirmsFailuresIF {
uint8_t powerRetryCounter = 0;
bool tryingOtherSide = false;
bool dualModeErrorSwitch = true;
bool dualToSingleSideTransition = false;
duallane::Submodes defaultSubmode = duallane::Submodes::A_SIDE;
enum RecoveryCustomStates {