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

This commit is contained in:
Robin Müller 2023-03-24 19:14:27 +01:00
parent bea0c31a12
commit ec40044b6e
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
5 changed files with 16 additions and 10 deletions

View File

@ -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 *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 *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 *GPS_FIX_CHANGE_STRING = "GPS_FIX_CHANGE";
const char *CANT_GET_FIX_STRING = "CANT_GET_FIX";

View File

@ -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 *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 *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 *GPS_FIX_CHANGE_STRING = "GPS_FIX_CHANGE";
const char *CANT_GET_FIX_STRING = "CANT_GET_FIX";

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;