Dual Side to Single Side Bugfix #497

Merged
meggert merged 4 commits from bugfix_dual_to_single_side into develop 2023-03-20 14:52:53 +01:00
2 changed files with 11 additions and 2 deletions
Showing only changes of commit 5890e639fe - Show all commits

View File

@ -34,10 +34,17 @@ void DualLaneAssemblyBase::performChildOperation() {
} }
void DualLaneAssemblyBase::startTransition(Mode_t mode, Submode_t submode) { void DualLaneAssemblyBase::startTransition(Mode_t mode, Submode_t submode) {
// doStartTransition(mode, submode);
using namespace duallane; using namespace duallane;
pwrStateMachine.reset(); pwrStateMachine.reset();
if (mode != MODE_OFF) { 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 // If anything other than MODE_OFF is commanded, perform power state machine first
// Cache the target modes, required by power state machine // Cache the target modes, required by power state machine
pwrStateMachine.start(mode, submode); pwrStateMachine.start(mode, submode);
@ -111,7 +118,7 @@ ReturnValue_t DualLaneAssemblyBase::isModeCombinationValid(Mode_t mode, Submode_
void DualLaneAssemblyBase::handleModeReached() { void DualLaneAssemblyBase::handleModeReached() {
using namespace duallane; using namespace duallane;
if (targetMode == MODE_OFF) { if (targetMode == MODE_OFF or dualToSingleSideTransition) {
pwrStateMachine.start(targetMode, targetSubmode); pwrStateMachine.start(targetMode, targetSubmode);
// Now we can switch off the power. After that, the AssemblyBase::handleModeReached function // Now we can switch off the power. After that, the AssemblyBase::handleModeReached function
// will be called // will be called
@ -229,6 +236,7 @@ void DualLaneAssemblyBase::finishModeOp() {
pwrStateMachine.reset(); pwrStateMachine.reset();
powerRetryCounter = 0; powerRetryCounter = 0;
tryingOtherSide = false; tryingOtherSide = false;
dualToSingleSideTransition = false;
dualModeErrorSwitch = true; dualModeErrorSwitch = true;
} }

View File

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