reattempt power switching at least once
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
@@ -6,8 +6,17 @@
|
||||
DualLanePowerStateMachine::DualLanePowerStateMachine(pcduSwitches::Switches switchA,
|
||||
pcduSwitches::Switches switchB,
|
||||
PowerSwitchIF* pwrSwitcher,
|
||||
duallane::PwrStates& state)
|
||||
: SWITCH_A(switchA), SWITCH_B(switchB), state(state), pwrSwitcher(pwrSwitcher) {}
|
||||
duallane::PwrStates& state,
|
||||
dur_millis_t checkTimeout)
|
||||
: SWITCH_A(switchA),
|
||||
SWITCH_B(switchB),
|
||||
state(state),
|
||||
pwrSwitcher(pwrSwitcher),
|
||||
checkTimeout(checkTimeout) {}
|
||||
|
||||
void DualLanePowerStateMachine::setCheckTimeout(dur_millis_t timeout) {
|
||||
checkTimeout.setTimeout(timeout);
|
||||
}
|
||||
|
||||
duallane::OpCodes DualLanePowerStateMachine::powerStateMachine(Mode_t mode, Submode_t submode) {
|
||||
using namespace duallane;
|
||||
@@ -58,6 +67,7 @@ duallane::OpCodes DualLanePowerStateMachine::powerStateMachine(Mode_t mode, Subm
|
||||
if (switchStateB != PowerSwitchIF::SWITCH_OFF) {
|
||||
pwrSwitcher->sendSwitchCommand(SWITCH_B, PowerSwitchIF::SWITCH_OFF);
|
||||
}
|
||||
checkTimeout.resetTimer();
|
||||
} else {
|
||||
switch (submode) {
|
||||
case (A_SIDE): {
|
||||
@@ -67,6 +77,7 @@ duallane::OpCodes DualLanePowerStateMachine::powerStateMachine(Mode_t mode, Subm
|
||||
if (switchStateB != PowerSwitchIF::SWITCH_OFF) {
|
||||
pwrSwitcher->sendSwitchCommand(SWITCH_B, PowerSwitchIF::SWITCH_OFF);
|
||||
}
|
||||
checkTimeout.resetTimer();
|
||||
break;
|
||||
}
|
||||
case (B_SIDE): {
|
||||
@@ -76,6 +87,7 @@ duallane::OpCodes DualLanePowerStateMachine::powerStateMachine(Mode_t mode, Subm
|
||||
if (switchStateB != PowerSwitchIF::SWITCH_ON) {
|
||||
pwrSwitcher->sendSwitchCommand(SWITCH_B, PowerSwitchIF::SWITCH_OFF);
|
||||
}
|
||||
checkTimeout.resetTimer();
|
||||
break;
|
||||
}
|
||||
case (DUAL_MODE): {
|
||||
@@ -85,6 +97,7 @@ duallane::OpCodes DualLanePowerStateMachine::powerStateMachine(Mode_t mode, Subm
|
||||
if (switchStateB != PowerSwitchIF::SWITCH_ON) {
|
||||
pwrSwitcher->sendSwitchCommand(SWITCH_B, PowerSwitchIF::SWITCH_ON);
|
||||
}
|
||||
checkTimeout.resetTimer();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -92,7 +105,14 @@ duallane::OpCodes DualLanePowerStateMachine::powerStateMachine(Mode_t mode, Subm
|
||||
state = PwrStates::CHECKING_POWER;
|
||||
}
|
||||
if (state == PwrStates::CHECKING_POWER) {
|
||||
// TODO: Could check for a timeout (temporal or cycles) here and resend command
|
||||
if (checkTimeout.hasTimedOut()) {
|
||||
return OpCodes::TIMEOUT_OCCURED;
|
||||
}
|
||||
}
|
||||
return OpCodes::NONE;
|
||||
}
|
||||
|
||||
void DualLanePowerStateMachine::reset() {
|
||||
state = duallane::PwrStates::IDLE;
|
||||
checkTimeout.resetTimer();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user