continued ACS board + SUS board assemblies
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

- Handling and Testing of basic FDIR
This commit is contained in:
2022-03-17 19:23:39 +01:00
parent e373fe0769
commit acd0307591
16 changed files with 381 additions and 191 deletions

View File

@@ -14,6 +14,7 @@ void DualLanePowerStateMachine::setCheckTimeout(dur_millis_t timeout) {
}
void DualLanePowerStateMachine::start(Mode_t mode, Submode_t submode) {
reset();
checkTimeout.resetTimer();
targetMode = mode;
targetSubmode = submode;
@@ -34,18 +35,19 @@ duallane::OpCodes DualLanePowerStateMachine::powerStateMachine() {
ReturnValue_t switchStateA = RETURN_OK;
ReturnValue_t switchStateB = RETURN_OK;
if (state == PwrStates::IDLE or state == PwrStates::MODE_COMMANDING) {
return duallane::OpCodes::NONE;
return opResult;
}
if (state == PwrStates::SWITCHING_POWER or state == PwrStates::CHECKING_POWER) {
switchStateA = pwrSwitcher->getSwitchState(SWITCH_A);
switchStateB = pwrSwitcher->getSwitchState(SWITCH_B);
} else {
return OpCodes::NONE;
return opResult;
}
if (targetMode == HasModesIF::MODE_OFF) {
if (switchStateA == PowerSwitchIF::SWITCH_OFF and switchStateB == PowerSwitchIF::SWITCH_OFF) {
state = PwrStates::IDLE;
return OpCodes::FINISH_OP;
opResult = OpCodes::TO_OFF_DONE;
return opResult;
}
} else {
switch (targetSubmode) {
@@ -53,7 +55,8 @@ duallane::OpCodes DualLanePowerStateMachine::powerStateMachine() {
if (switchStateA == PowerSwitchIF::SWITCH_ON and
switchStateB == PowerSwitchIF::SWITCH_OFF) {
state = PwrStates::MODE_COMMANDING;
return OpCodes::START_TRANSITION;
opResult = OpCodes::TO_NOT_OFF_DONE;
return opResult;
}
break;
}
@@ -61,14 +64,16 @@ duallane::OpCodes DualLanePowerStateMachine::powerStateMachine() {
if (switchStateA == PowerSwitchIF::SWITCH_OFF and
switchStateB == PowerSwitchIF::SWITCH_ON) {
state = PwrStates::MODE_COMMANDING;
return OpCodes::START_TRANSITION;
opResult = OpCodes::TO_NOT_OFF_DONE;
return opResult;
}
break;
}
case (DUAL_MODE): {
if (switchStateA == PowerSwitchIF::SWITCH_ON and switchStateB == PowerSwitchIF::SWITCH_ON) {
state = PwrStates::MODE_COMMANDING;
return OpCodes::START_TRANSITION;
opResult = OpCodes::TO_NOT_OFF_DONE;
return opResult;
}
}
}
@@ -123,11 +128,12 @@ duallane::OpCodes DualLanePowerStateMachine::powerStateMachine() {
return OpCodes::TIMEOUT_OCCURED;
}
}
return OpCodes::NONE;
return opResult;
}
void DualLanePowerStateMachine::reset() {
state = duallane::PwrStates::IDLE;
opResult = duallane::OpCodes::NONE;
targetMode = HasModesIF::MODE_OFF;
targetSubmode = 0;
checkTimeout.resetTimer();