This commit is contained in:
parent
164bfc3521
commit
dcf6367314
@ -6,7 +6,7 @@ Stack5VHandler::Stack5VHandler(PowerSwitchIF& switcher) : switcher(switcher) {
|
||||
|
||||
ReturnValue_t Stack5VHandler::deviceToOn(StackCommander commander) {
|
||||
MutexGuard mg(stackLock);
|
||||
if (radSensorIsOn or plPcduIsOn) {
|
||||
if (switchIsOn or handlerState == HandlerState::SWITCH_PENDING) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
if (commander == StackCommander::PL_PCDU) {
|
||||
@ -19,7 +19,7 @@ ReturnValue_t Stack5VHandler::deviceToOn(StackCommander commander) {
|
||||
|
||||
ReturnValue_t Stack5VHandler::deviceToOff(StackCommander commander) {
|
||||
MutexGuard mg(stackLock);
|
||||
if (not radSensorIsOn and not plPcduIsOn and not plPcduCommandedOn and not radSensorCommandedOn) {
|
||||
if (not switchIsOn) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
if (commander == StackCommander::PL_PCDU) {
|
||||
@ -33,7 +33,30 @@ ReturnValue_t Stack5VHandler::deviceToOff(StackCommander commander) {
|
||||
bool Stack5VHandler::isSwitchOn() {
|
||||
MutexGuard mg(stackLock);
|
||||
if (switcher.getSwitchState(stackSwitch) == PowerSwitchIF::SWITCH_ON) {
|
||||
if (not switchIsOn) {
|
||||
if (handlerState == HandlerState::SWITCH_PENDING) {
|
||||
handlerState = HandlerState::IDLE;
|
||||
}
|
||||
switchIsOn = true;
|
||||
}
|
||||
if (plPcduCommandedOn) {
|
||||
plPcduIsOn = true;
|
||||
}
|
||||
if (radSensorCommandedOn) {
|
||||
radSensorIsOn = true;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
if (switchIsOn) {
|
||||
if (handlerState == HandlerState::SWITCH_PENDING) {
|
||||
handlerState = HandlerState::IDLE;
|
||||
}
|
||||
switchIsOn = false;
|
||||
}
|
||||
radSensorIsOn = false;
|
||||
plPcduIsOn = false;
|
||||
radSensorCommandedOn = false;
|
||||
plPcduCommandedOn = false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
|
||||
|
||||
enum class StackCommander { RAD_SENSOR = 0, PL_PCDU = 1 };
|
||||
enum class HandlerState { SWITCH_PENDING, IDLE };
|
||||
|
||||
class Stack5VHandler {
|
||||
public:
|
||||
@ -19,8 +20,10 @@ class Stack5VHandler {
|
||||
private:
|
||||
MutexIF* stackLock;
|
||||
PowerSwitchIF& switcher;
|
||||
bool radSensorCommandedOn = false;
|
||||
bool switchIsOn = false;
|
||||
HandlerState handlerState = HandlerState::IDLE;
|
||||
bool plPcduCommandedOn = false;
|
||||
bool radSensorCommandedOn = false;
|
||||
bool radSensorIsOn = false;
|
||||
bool plPcduIsOn = false;
|
||||
pcdu::Switches stackSwitch = pcdu::Switches::P60_DOCK_5V_STACK;
|
||||
|
Loading…
Reference in New Issue
Block a user