auto formatter
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2022-02-10 18:05:14 +01:00
parent 773242cc8e
commit d51e2c19f6
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
2 changed files with 23 additions and 27 deletions

View File

@ -7,7 +7,7 @@ PayloadPcduHandler::PayloadPcduHandler(object_id_t objectId, object_id_t comIF,
: DeviceHandlerBase(objectId, comIF, cookie), gpioIF(gpioIF) {} : DeviceHandlerBase(objectId, comIF, cookie), gpioIF(gpioIF) {}
void PayloadPcduHandler::doStartUp() { 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 // Config error
sif::error << "PayloadPcduHandler::doStartUp: Invalid state" << std::endl; sif::error << "PayloadPcduHandler::doStartUp: Invalid state" << std::endl;
} }
@ -20,7 +20,7 @@ void PayloadPcduHandler::doStartUp() {
} }
if (state == States::ON_TRANS_SSR) { if (state == States::ON_TRANS_SSR) {
// If necessary, check whether a certain amount of time has elapsed // If necessary, check whether a certain amount of time has elapsed
if(transitionOk) { if (transitionOk) {
transitionOk = false; transitionOk = false;
// We are now in ON mode // We are now in ON mode
setMode(MODE_ON); setMode(MODE_ON);
@ -34,12 +34,12 @@ void PayloadPcduHandler::doStartUp() {
void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) { void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
if (mode == _MODE_TO_NORMAL) { if (mode == _MODE_TO_NORMAL) {
if (state == States::ON_TRANS_ADC_CLOSE_ZERO) { if (state == States::ON_TRANS_ADC_CLOSE_ZERO) {
if(not commandExecuted) { if (not commandExecuted) {
countdown.resetTimer(); countdown.resetTimer();
commandExecuted = true; commandExecuted = true;
} }
// ADC values are ok, 5 seconds have elapsed // ADC values are ok, 5 seconds have elapsed
if(transitionOk and countdown.hasTimedOut()) { if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_DRO; state = States::ON_TRANS_DRO;
// Now start monitoring for negative voltages instead // Now start monitoring for negative voltages instead
monMode = MonitoringMode::NEGATIVE; monMode = MonitoringMode::NEGATIVE;
@ -49,13 +49,13 @@ void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
} }
} }
if (state == States::ON_TRANS_DRO) { if (state == States::ON_TRANS_DRO) {
if(not commandExecuted) { if (not commandExecuted) {
// Switch on DRO and start monitoring for negative voltagea // Switch on DRO and start monitoring for negative voltagea
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_DRO); gpioIF->pullHigh(gpioIds::PLPCDU_ENB_DRO);
commandExecuted = true; commandExecuted = true;
} }
// ADC values are ok, 5 seconds have elapsed // ADC values are ok, 5 seconds have elapsed
if(transitionOk and countdown.hasTimedOut()) { if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_X8; state = States::ON_TRANS_X8;
countdown.resetTimer(); countdown.resetTimer();
commandExecuted = false; commandExecuted = false;
@ -63,55 +63,55 @@ void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
} }
} }
if (state == States::ON_TRANS_X8) { if (state == States::ON_TRANS_X8) {
if(not commandExecuted) { if (not commandExecuted) {
// Switch on X8 // Switch on X8
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_X8); gpioIF->pullHigh(gpioIds::PLPCDU_ENB_X8);
commandExecuted = true; commandExecuted = true;
} }
// ADC values are ok, 5 seconds have elapsed // ADC values are ok, 5 seconds have elapsed
if(transitionOk and countdown.hasTimedOut()) { if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_TX; state = States::ON_TRANS_TX;
countdown.resetTimer(); countdown.resetTimer();
commandExecuted = false; commandExecuted = false;
transitionOk = false; transitionOk = false;
} }
} }
if(state == States::ON_TRANS_TX) { if (state == States::ON_TRANS_TX) {
if(not commandExecuted) { if (not commandExecuted) {
// Switch on TX // Switch on TX
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_TX); gpioIF->pullHigh(gpioIds::PLPCDU_ENB_TX);
commandExecuted = true; commandExecuted = true;
} }
// ADC values are ok, 5 seconds have elapsed // ADC values are ok, 5 seconds have elapsed
if(transitionOk and countdown.hasTimedOut()) { if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_MPA; state = States::ON_TRANS_MPA;
countdown.resetTimer(); countdown.resetTimer();
commandExecuted = false; commandExecuted = false;
transitionOk = false; transitionOk = false;
} }
} }
if(state == States::ON_TRANS_MPA) { if (state == States::ON_TRANS_MPA) {
if(not commandExecuted) { if (not commandExecuted) {
// Switch on MPA // Switch on MPA
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_MPA); gpioIF->pullHigh(gpioIds::PLPCDU_ENB_MPA);
commandExecuted = true; commandExecuted = true;
} }
// ADC values are ok, 5 seconds have elapsed // ADC values are ok, 5 seconds have elapsed
if(transitionOk and countdown.hasTimedOut()) { if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_HPA; state = States::ON_TRANS_HPA;
countdown.resetTimer(); countdown.resetTimer();
commandExecuted = false; commandExecuted = false;
transitionOk = false; transitionOk = false;
} }
} }
if(state == States::ON_TRANS_HPA) { if (state == States::ON_TRANS_HPA) {
if(not commandExecuted) { if (not commandExecuted) {
// Switch on HPA // Switch on HPA
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_HPA); gpioIF->pullHigh(gpioIds::PLPCDU_ENB_HPA);
commandExecuted = true; commandExecuted = true;
} }
// ADC values are ok, 5 seconds have elapsed // ADC values are ok, 5 seconds have elapsed
if(transitionOk and countdown.hasTimedOut()) { if (transitionOk and countdown.hasTimedOut()) {
state = States::PCDU_ON; state = States::PCDU_ON;
setMode(MODE_NORMAL); setMode(MODE_NORMAL);
countdown.resetTimer(); countdown.resetTimer();

View File

@ -46,11 +46,7 @@ class PayloadPcduHandler : DeviceHandlerBase {
PCDU_ON, PCDU_ON,
} state = States::PCDU_OFF; } state = States::PCDU_OFF;
enum class MonitoringMode { enum class MonitoringMode { NONE, CLOSE_TO_ZERO, NEGATIVE } monMode = MonitoringMode::NONE;
NONE,
CLOSE_TO_ZERO,
NEGATIVE
} monMode = MonitoringMode::NONE;
// This variable is tied to DRO +6 V voltage. Voltages, currents are monitored and the experiment // 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. // is shut down immediately if there is a negative voltage.