this should do the job
This commit is contained in:
parent
268233551d
commit
a3d1dde455
@ -30,9 +30,23 @@ void PayloadPcduHandler::doStartUp() {
|
|||||||
sif::error << "PayloadPcduHandler::doStartUp: Invalid state" << std::endl;
|
sif::error << "PayloadPcduHandler::doStartUp: Invalid state" << std::endl;
|
||||||
}
|
}
|
||||||
clearSetOnOffFlag = true;
|
clearSetOnOffFlag = true;
|
||||||
if (true) {
|
if (state == States::PL_PCDU_OFF) {
|
||||||
|
state = States::STACK_5V_SWITCHING;
|
||||||
|
}
|
||||||
|
if (state == States::STACK_5V_SWITCHING) {
|
||||||
|
ReturnValue_t retval = stackHandler.deviceToOn(StackCommander::PL_PCDU);
|
||||||
|
if (retval == BUSY) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state == States::STACK_5V_PENDING;
|
||||||
|
}
|
||||||
|
if (state == States::STACK_5V_PENDING) {
|
||||||
|
if (stackHandler.isSwitchOn()) {
|
||||||
|
state = States::STACK_5V_CORRECT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (state == States::STACK_5V_CORRECT) {
|
||||||
quickTransitionAlreadyCalled = false;
|
quickTransitionAlreadyCalled = false;
|
||||||
state = States::POWER_CHANNELS_ON;
|
|
||||||
setMode(_MODE_TO_ON);
|
setMode(_MODE_TO_ON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -47,7 +61,19 @@ void PayloadPcduHandler::doShutDown() {
|
|||||||
clearSetOnOffFlag = false;
|
clearSetOnOffFlag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (true) {
|
if (state == States::STACK_5V_SWITCHING) {
|
||||||
|
ReturnValue_t retval = stackHandler.deviceToOff(StackCommander::PL_PCDU);
|
||||||
|
if (retval == BUSY) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state == States::STACK_5V_PENDING;
|
||||||
|
}
|
||||||
|
if (state == States::STACK_5V_PENDING) {
|
||||||
|
if (not stackHandler.isSwitchOn()) {
|
||||||
|
state == States::STACK_5V_CORRECT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (state == States::STACK_5V_CORRECT) {
|
||||||
state = States::PL_PCDU_OFF;
|
state = States::PL_PCDU_OFF;
|
||||||
// No need to set mode _MODE_POWER_DOWN, power switching was already handled
|
// No need to set mode _MODE_POWER_DOWN, power switching was already handled
|
||||||
setMode(MODE_OFF);
|
setMode(MODE_OFF);
|
||||||
@ -72,7 +98,7 @@ ReturnValue_t PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_
|
|||||||
setMode(MODE_OFF);
|
setMode(MODE_OFF);
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if (state == States::POWER_CHANNELS_ON) {
|
if (state == States::STACK_5V_CORRECT) {
|
||||||
#if OBSW_VERBOSE_LEVEL >= 1
|
#if OBSW_VERBOSE_LEVEL >= 1
|
||||||
sif::info << "Switching on SSR VBAT0 & VBAT1 GPIOs" << std::endl;
|
sif::info << "Switching on SSR VBAT0 & VBAT1 GPIOs" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
@ -347,7 +373,7 @@ void PayloadPcduHandler::quickTransitionBackToOff(bool startTransitionToOff, boo
|
|||||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_TX);
|
gpioIF->pullLow(gpioIds::PLPCDU_ENB_TX);
|
||||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_VBAT0);
|
gpioIF->pullLow(gpioIds::PLPCDU_ENB_VBAT0);
|
||||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_VBAT1);
|
gpioIF->pullLow(gpioIds::PLPCDU_ENB_VBAT1);
|
||||||
state = States::PL_PCDU_OFF;
|
state = States::STACK_5V_SWITCHING;
|
||||||
adcState = AdcStates::OFF;
|
adcState = AdcStates::OFF;
|
||||||
if (startTransitionToOff) {
|
if (startTransitionToOff) {
|
||||||
startTransition(MODE_OFF, 0);
|
startTransition(MODE_OFF, 0);
|
||||||
|
@ -78,7 +78,9 @@ class PayloadPcduHandler : public DeviceHandlerBase {
|
|||||||
private:
|
private:
|
||||||
enum class States : uint8_t {
|
enum class States : uint8_t {
|
||||||
PL_PCDU_OFF,
|
PL_PCDU_OFF,
|
||||||
POWER_CHANNELS_ON,
|
STACK_5V_SWITCHING,
|
||||||
|
STACK_5V_PENDING,
|
||||||
|
STACK_5V_CORRECT,
|
||||||
// Solid State Relay, enable battery voltages VBAT0 and VBAT1. This will also switch on
|
// Solid State Relay, enable battery voltages VBAT0 and VBAT1. This will also switch on
|
||||||
// the ADC
|
// the ADC
|
||||||
ON_TRANS_SSR,
|
ON_TRANS_SSR,
|
||||||
|
@ -17,6 +17,7 @@ ReturnValue_t Stack5VHandler::deviceToOn(StackCommander commander) {
|
|||||||
if (handlerState == HandlerState::SWITCH_PENDING) {
|
if (handlerState == HandlerState::SWITCH_PENDING) {
|
||||||
return BUSY;
|
return BUSY;
|
||||||
}
|
}
|
||||||
|
handlerState == HandlerState::SWITCH_PENDING;
|
||||||
return switcher.sendSwitchCommand(stackSwitch, PowerSwitchIF::SWITCH_ON);
|
return switcher.sendSwitchCommand(stackSwitch, PowerSwitchIF::SWITCH_ON);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +38,7 @@ ReturnValue_t Stack5VHandler::deviceToOff(StackCommander commander) {
|
|||||||
(commander == StackCommander::RAD_SENSOR and plPcduIsOn)) {
|
(commander == StackCommander::RAD_SENSOR and plPcduIsOn)) {
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
handlerState == HandlerState::SWITCH_PENDING;
|
||||||
return switcher.sendSwitchCommand(stackSwitch, PowerSwitchIF::SWITCH_OFF);
|
return switcher.sendSwitchCommand(stackSwitch, PowerSwitchIF::SWITCH_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user