This commit is contained in:
parent
773242cc8e
commit
d51e2c19f6
@ -7,7 +7,7 @@ PayloadPcduHandler::PayloadPcduHandler(object_id_t objectId, object_id_t comIF,
|
||||
: DeviceHandlerBase(objectId, comIF, cookie), gpioIF(gpioIF) {}
|
||||
|
||||
void PayloadPcduHandler::doStartUp() {
|
||||
if((state != States::PCDU_OFF) and (state != States::ON_TRANS_SSR)) {
|
||||
if ((state != States::PCDU_OFF) and (state != States::ON_TRANS_SSR)) {
|
||||
// Config error
|
||||
sif::error << "PayloadPcduHandler::doStartUp: Invalid state" << std::endl;
|
||||
}
|
||||
@ -20,7 +20,7 @@ void PayloadPcduHandler::doStartUp() {
|
||||
}
|
||||
if (state == States::ON_TRANS_SSR) {
|
||||
// If necessary, check whether a certain amount of time has elapsed
|
||||
if(transitionOk) {
|
||||
if (transitionOk) {
|
||||
transitionOk = false;
|
||||
// We are now in ON mode
|
||||
setMode(MODE_ON);
|
||||
@ -34,12 +34,12 @@ void PayloadPcduHandler::doStartUp() {
|
||||
void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
|
||||
if (mode == _MODE_TO_NORMAL) {
|
||||
if (state == States::ON_TRANS_ADC_CLOSE_ZERO) {
|
||||
if(not commandExecuted) {
|
||||
if (not commandExecuted) {
|
||||
countdown.resetTimer();
|
||||
commandExecuted = true;
|
||||
}
|
||||
// ADC values are ok, 5 seconds have elapsed
|
||||
if(transitionOk and countdown.hasTimedOut()) {
|
||||
if (transitionOk and countdown.hasTimedOut()) {
|
||||
state = States::ON_TRANS_DRO;
|
||||
// Now start monitoring for negative voltages instead
|
||||
monMode = MonitoringMode::NEGATIVE;
|
||||
@ -49,13 +49,13 @@ void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
|
||||
}
|
||||
}
|
||||
if (state == States::ON_TRANS_DRO) {
|
||||
if(not commandExecuted) {
|
||||
if (not commandExecuted) {
|
||||
// Switch on DRO and start monitoring for negative voltagea
|
||||
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_DRO);
|
||||
commandExecuted = true;
|
||||
commandExecuted = true;
|
||||
}
|
||||
// ADC values are ok, 5 seconds have elapsed
|
||||
if(transitionOk and countdown.hasTimedOut()) {
|
||||
if (transitionOk and countdown.hasTimedOut()) {
|
||||
state = States::ON_TRANS_X8;
|
||||
countdown.resetTimer();
|
||||
commandExecuted = false;
|
||||
@ -63,55 +63,55 @@ void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
|
||||
}
|
||||
}
|
||||
if (state == States::ON_TRANS_X8) {
|
||||
if(not commandExecuted) {
|
||||
if (not commandExecuted) {
|
||||
// Switch on X8
|
||||
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_X8);
|
||||
commandExecuted = true;
|
||||
commandExecuted = true;
|
||||
}
|
||||
// ADC values are ok, 5 seconds have elapsed
|
||||
if(transitionOk and countdown.hasTimedOut()) {
|
||||
if (transitionOk and countdown.hasTimedOut()) {
|
||||
state = States::ON_TRANS_TX;
|
||||
countdown.resetTimer();
|
||||
commandExecuted = false;
|
||||
transitionOk = false;
|
||||
}
|
||||
}
|
||||
if(state == States::ON_TRANS_TX) {
|
||||
if(not commandExecuted) {
|
||||
if (state == States::ON_TRANS_TX) {
|
||||
if (not commandExecuted) {
|
||||
// Switch on TX
|
||||
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_TX);
|
||||
commandExecuted = true;
|
||||
commandExecuted = true;
|
||||
}
|
||||
// ADC values are ok, 5 seconds have elapsed
|
||||
if(transitionOk and countdown.hasTimedOut()) {
|
||||
if (transitionOk and countdown.hasTimedOut()) {
|
||||
state = States::ON_TRANS_MPA;
|
||||
countdown.resetTimer();
|
||||
commandExecuted = false;
|
||||
transitionOk = false;
|
||||
}
|
||||
}
|
||||
if(state == States::ON_TRANS_MPA) {
|
||||
if(not commandExecuted) {
|
||||
if (state == States::ON_TRANS_MPA) {
|
||||
if (not commandExecuted) {
|
||||
// Switch on MPA
|
||||
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_MPA);
|
||||
commandExecuted = true;
|
||||
commandExecuted = true;
|
||||
}
|
||||
// ADC values are ok, 5 seconds have elapsed
|
||||
if(transitionOk and countdown.hasTimedOut()) {
|
||||
if (transitionOk and countdown.hasTimedOut()) {
|
||||
state = States::ON_TRANS_HPA;
|
||||
countdown.resetTimer();
|
||||
commandExecuted = false;
|
||||
transitionOk = false;
|
||||
}
|
||||
}
|
||||
if(state == States::ON_TRANS_HPA) {
|
||||
if(not commandExecuted) {
|
||||
if (state == States::ON_TRANS_HPA) {
|
||||
if (not commandExecuted) {
|
||||
// Switch on HPA
|
||||
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_HPA);
|
||||
commandExecuted = true;
|
||||
commandExecuted = true;
|
||||
}
|
||||
// ADC values are ok, 5 seconds have elapsed
|
||||
if(transitionOk and countdown.hasTimedOut()) {
|
||||
if (transitionOk and countdown.hasTimedOut()) {
|
||||
state = States::PCDU_ON;
|
||||
setMode(MODE_NORMAL);
|
||||
countdown.resetTimer();
|
||||
|
@ -46,11 +46,7 @@ class PayloadPcduHandler : DeviceHandlerBase {
|
||||
PCDU_ON,
|
||||
} state = States::PCDU_OFF;
|
||||
|
||||
enum class MonitoringMode {
|
||||
NONE,
|
||||
CLOSE_TO_ZERO,
|
||||
NEGATIVE
|
||||
} monMode = MonitoringMode::NONE;
|
||||
enum class MonitoringMode { NONE, CLOSE_TO_ZERO, NEGATIVE } monMode = MonitoringMode::NONE;
|
||||
|
||||
// This variable is tied to DRO +6 V voltage. Voltages, currents are monitored and the experiment
|
||||
// is shut down immediately if there is a negative voltage.
|
||||
|
Loading…
Reference in New Issue
Block a user