added 5v stack status read in PCDU handler
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
This commit is contained in:
@ -6,13 +6,16 @@ Stack5VHandler::Stack5VHandler(PowerSwitchIF& switcher) : switcher(switcher) {
|
||||
|
||||
ReturnValue_t Stack5VHandler::deviceToOn(StackCommander commander) {
|
||||
MutexGuard mg(stackLock);
|
||||
if (switchIsOn or handlerState == HandlerState::SWITCH_PENDING) {
|
||||
if (switchIsOn) {
|
||||
if (commander == StackCommander::PL_PCDU) {
|
||||
plPcduIsOn = true;
|
||||
} else {
|
||||
radSensorIsOn = true;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
if (commander == StackCommander::PL_PCDU) {
|
||||
plPcduCommandedOn = true;
|
||||
} else if (commander == StackCommander::RAD_SENSOR) {
|
||||
radSensorCommandedOn = true;
|
||||
if (handlerState == HandlerState::SWITCH_PENDING) {
|
||||
return BUSY;
|
||||
}
|
||||
return switcher.sendSwitchCommand(stackSwitch, PowerSwitchIF::SWITCH_ON);
|
||||
}
|
||||
@ -20,13 +23,21 @@ ReturnValue_t Stack5VHandler::deviceToOn(StackCommander commander) {
|
||||
ReturnValue_t Stack5VHandler::deviceToOff(StackCommander commander) {
|
||||
MutexGuard mg(stackLock);
|
||||
if (not switchIsOn) {
|
||||
if (commander == StackCommander::PL_PCDU) {
|
||||
plPcduIsOn = false;
|
||||
} else {
|
||||
radSensorIsOn = false;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
if (commander == StackCommander::PL_PCDU) {
|
||||
plPcduCommandedOn = true;
|
||||
} else if (commander == StackCommander::RAD_SENSOR) {
|
||||
radSensorCommandedOn = true;
|
||||
if (handlerState == HandlerState::SWITCH_PENDING) {
|
||||
return BUSY;
|
||||
}
|
||||
if ((commander == StackCommander::PL_PCDU and radSensorIsOn) or
|
||||
(commander == StackCommander::RAD_SENSOR and plPcduIsOn)) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
return switcher.sendSwitchCommand(stackSwitch, PowerSwitchIF::SWITCH_OFF);
|
||||
}
|
||||
|
||||
@ -39,12 +50,6 @@ bool Stack5VHandler::isSwitchOn() {
|
||||
}
|
||||
switchIsOn = true;
|
||||
}
|
||||
if (plPcduCommandedOn) {
|
||||
plPcduIsOn = true;
|
||||
}
|
||||
if (radSensorCommandedOn) {
|
||||
radSensorIsOn = true;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
if (switchIsOn) {
|
||||
@ -55,8 +60,6 @@ bool Stack5VHandler::isSwitchOn() {
|
||||
}
|
||||
radSensorIsOn = false;
|
||||
plPcduIsOn = false;
|
||||
radSensorCommandedOn = false;
|
||||
plPcduCommandedOn = false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user