This commit is contained in:
parent
bea0c31a12
commit
ec40044b6e
@ -212,7 +212,8 @@ const char *SIDE_SWITCH_TRANSITION_NOT_ALLOWED_STRING = "SIDE_SWITCH_TRANSITION_
|
|||||||
const char *TRANSITION_OTHER_SIDE_FAILED_12900_STRING = "TRANSITION_OTHER_SIDE_FAILED_12900";
|
const char *TRANSITION_OTHER_SIDE_FAILED_12900_STRING = "TRANSITION_OTHER_SIDE_FAILED_12900";
|
||||||
const char *NOT_ENOUGH_DEVICES_DUAL_MODE_12901_STRING = "NOT_ENOUGH_DEVICES_DUAL_MODE_12901";
|
const char *NOT_ENOUGH_DEVICES_DUAL_MODE_12901_STRING = "NOT_ENOUGH_DEVICES_DUAL_MODE_12901";
|
||||||
const char *POWER_STATE_MACHINE_TIMEOUT_12902_STRING = "POWER_STATE_MACHINE_TIMEOUT_12902";
|
const char *POWER_STATE_MACHINE_TIMEOUT_12902_STRING = "POWER_STATE_MACHINE_TIMEOUT_12902";
|
||||||
const char *SIDE_SWITCH_TRANSITION_NOT_ALLOWED_12903_STRING = "SIDE_SWITCH_TRANSITION_NOT_ALLOWED_12903";
|
const char *SIDE_SWITCH_TRANSITION_NOT_ALLOWED_12903_STRING =
|
||||||
|
"SIDE_SWITCH_TRANSITION_NOT_ALLOWED_12903";
|
||||||
const char *CHILDREN_LOST_MODE_STRING = "CHILDREN_LOST_MODE";
|
const char *CHILDREN_LOST_MODE_STRING = "CHILDREN_LOST_MODE";
|
||||||
const char *GPS_FIX_CHANGE_STRING = "GPS_FIX_CHANGE";
|
const char *GPS_FIX_CHANGE_STRING = "GPS_FIX_CHANGE";
|
||||||
const char *CANT_GET_FIX_STRING = "CANT_GET_FIX";
|
const char *CANT_GET_FIX_STRING = "CANT_GET_FIX";
|
||||||
|
@ -212,7 +212,8 @@ const char *SIDE_SWITCH_TRANSITION_NOT_ALLOWED_STRING = "SIDE_SWITCH_TRANSITION_
|
|||||||
const char *TRANSITION_OTHER_SIDE_FAILED_12900_STRING = "TRANSITION_OTHER_SIDE_FAILED_12900";
|
const char *TRANSITION_OTHER_SIDE_FAILED_12900_STRING = "TRANSITION_OTHER_SIDE_FAILED_12900";
|
||||||
const char *NOT_ENOUGH_DEVICES_DUAL_MODE_12901_STRING = "NOT_ENOUGH_DEVICES_DUAL_MODE_12901";
|
const char *NOT_ENOUGH_DEVICES_DUAL_MODE_12901_STRING = "NOT_ENOUGH_DEVICES_DUAL_MODE_12901";
|
||||||
const char *POWER_STATE_MACHINE_TIMEOUT_12902_STRING = "POWER_STATE_MACHINE_TIMEOUT_12902";
|
const char *POWER_STATE_MACHINE_TIMEOUT_12902_STRING = "POWER_STATE_MACHINE_TIMEOUT_12902";
|
||||||
const char *SIDE_SWITCH_TRANSITION_NOT_ALLOWED_12903_STRING = "SIDE_SWITCH_TRANSITION_NOT_ALLOWED_12903";
|
const char *SIDE_SWITCH_TRANSITION_NOT_ALLOWED_12903_STRING =
|
||||||
|
"SIDE_SWITCH_TRANSITION_NOT_ALLOWED_12903";
|
||||||
const char *CHILDREN_LOST_MODE_STRING = "CHILDREN_LOST_MODE";
|
const char *CHILDREN_LOST_MODE_STRING = "CHILDREN_LOST_MODE";
|
||||||
const char *GPS_FIX_CHANGE_STRING = "GPS_FIX_CHANGE";
|
const char *GPS_FIX_CHANGE_STRING = "GPS_FIX_CHANGE";
|
||||||
const char *CANT_GET_FIX_STRING = "CANT_GET_FIX";
|
const char *CANT_GET_FIX_STRING = "CANT_GET_FIX";
|
||||||
|
@ -110,13 +110,14 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s
|
|||||||
using namespace duallane;
|
using namespace duallane;
|
||||||
ReturnValue_t result = returnvalue::OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
bool needsSecondStep = false;
|
bool needsSecondStep = false;
|
||||||
if (sideSwitchTransition(mode, submode) and sideSwitchState == SideSwitchState::NONE) {
|
if (sideSwitchState == SideSwitchState::REQUESTED) {
|
||||||
sideSwitchState = SideSwitchState::TO_DUAL;
|
sideSwitchState = SideSwitchState::TO_DUAL;
|
||||||
}
|
}
|
||||||
// Switch to dual side first, and later switch back to the otherside
|
// Switch to dual side first, and later switch back to the otherside
|
||||||
if (sideSwitchState == SideSwitchState::TO_DUAL) {
|
if (sideSwitchState == SideSwitchState::TO_DUAL) {
|
||||||
submode = Submodes::DUAL_MODE;
|
|
||||||
targetSubmodeForSideSwitch = static_cast<duallane::Submodes>(submode);
|
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..
|
// TODO: Ugly hack. The base class should support arbitrary number of steps..
|
||||||
needsSecondStep = true;
|
needsSecondStep = true;
|
||||||
} else if (sideSwitchState == SideSwitchState::DISABLE_OTHER_SIDE) {
|
} else if (sideSwitchState == SideSwitchState::DISABLE_OTHER_SIDE) {
|
||||||
|
@ -46,9 +46,13 @@ void DualLaneAssemblyBase::startTransition(Mode_t mode, Submode_t submode) {
|
|||||||
AssemblyBase::startTransition(mode, submode);
|
AssemblyBase::startTransition(mode, submode);
|
||||||
return;
|
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
|
// 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, pwrSubmode);
|
||||||
// Cache these for later after the power state machine has finished
|
// Cache these for later after the power state machine has finished
|
||||||
targetMode = mode;
|
targetMode = mode;
|
||||||
targetSubmode = submode;
|
targetSubmode = submode;
|
||||||
@ -112,7 +116,7 @@ ReturnValue_t DualLaneAssemblyBase::isModeCombinationValid(Mode_t mode, Submode_
|
|||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if (sideSwitchTransition(mode, submode)) {
|
if (sideSwitchTransition(mode, submode)) {
|
||||||
// inSideSwitchTransition = true;
|
sideSwitchState = SideSwitchState::REQUESTED;
|
||||||
}
|
}
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
@ -228,9 +232,8 @@ bool DualLaneAssemblyBase::sideSwitchTransition(Mode_t mode, Submode_t submode)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this->mode == MODE_ON or this->mode == DeviceHandlerIF::MODE_NORMAL) {
|
if (this->mode == MODE_ON or this->mode == DeviceHandlerIF::MODE_NORMAL) {
|
||||||
if (this->submode == Submodes::A_SIDE and submode == Submodes::B_SIDE) {
|
if ((this->submode == Submodes::A_SIDE and submode == Submodes::B_SIDE) or
|
||||||
return true;
|
(this->submode == Submodes::B_SIDE and submode == Submodes::A_SIDE)) {
|
||||||
} else if (this->submode == Submodes::B_SIDE and submode == Submodes::A_SIDE) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -34,7 +34,7 @@ class DualLaneAssemblyBase : public AssemblyBase, public ConfirmsFailuresIF {
|
|||||||
bool dualToSingleSideTransition = false;
|
bool dualToSingleSideTransition = false;
|
||||||
duallane::Submodes defaultSubmode = duallane::Submodes::A_SIDE;
|
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;
|
SideSwitchState sideSwitchState = SideSwitchState::NONE;
|
||||||
duallane::Submodes targetSubmodeForSideSwitch = duallane::Submodes::B_SIDE;
|
duallane::Submodes targetSubmodeForSideSwitch = duallane::Submodes::B_SIDE;
|
||||||
|
Loading…
Reference in New Issue
Block a user