first sucessfull full transition
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
This commit is contained in:
@ -37,6 +37,7 @@ void PayloadPcduHandler::doStartUp() {
|
||||
// If necessary, check whether a certain amount of time has elapsed
|
||||
if (transitionOk) {
|
||||
transitionOk = false;
|
||||
state = States::ON_TRANS_ADC_CLOSE_ZERO;
|
||||
// We are now in ON mode
|
||||
startTransition(MODE_NORMAL, 0);
|
||||
adcCountdown.setTimeout(50);
|
||||
@ -92,6 +93,9 @@ void PayloadPcduHandler::stateMachineToNormal() {
|
||||
params.getValue(PlPcduParameter::DRO_TO_X8_WAIT_TIME_K, waitTime);
|
||||
countdown.setTimeout(std::round(waitTime * 1000));
|
||||
countdown.resetTimer();
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::info << "Enabling PL PCDU DRO module" << std::endl;
|
||||
#endif
|
||||
// Switch on DRO and start monitoring for negative voltages
|
||||
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_DRO);
|
||||
adcCountdown.setTimeout(100);
|
||||
@ -111,6 +115,9 @@ void PayloadPcduHandler::stateMachineToNormal() {
|
||||
params.getValue(PlPcduParameter::X8_TO_TX_WAIT_TIME_K, waitTime);
|
||||
countdown.setTimeout(std::round(waitTime * 1000));
|
||||
countdown.resetTimer();
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::info << "Enabling PL PCDU X8 module" << std::endl;
|
||||
#endif
|
||||
// Switch on X8
|
||||
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_X8);
|
||||
adcCountdown.setTimeout(100);
|
||||
@ -130,6 +137,9 @@ void PayloadPcduHandler::stateMachineToNormal() {
|
||||
params.getValue(PlPcduParameter::TX_TO_MPA_WAIT_TIME_K, waitTime);
|
||||
countdown.setTimeout(std::round(waitTime * 1000));
|
||||
countdown.resetTimer();
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::info << "Enabling PL PCDU TX module" << std::endl;
|
||||
#endif
|
||||
// Switch on TX
|
||||
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_TX);
|
||||
// Wait for 100 ms before checking ADC values
|
||||
@ -150,6 +160,9 @@ void PayloadPcduHandler::stateMachineToNormal() {
|
||||
params.getValue(PlPcduParameter::MPA_TO_HPA_WAIT_TIME_K, waitTime);
|
||||
countdown.setTimeout(std::round(waitTime * 1000));
|
||||
countdown.resetTimer();
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::info << "Enabling PL PCDU MPA module" << std::endl;
|
||||
#endif
|
||||
// Switch on MPA
|
||||
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_MPA);
|
||||
// Wait for 100 ms before checking ADC values
|
||||
@ -168,6 +181,9 @@ void PayloadPcduHandler::stateMachineToNormal() {
|
||||
if (not commandExecuted) {
|
||||
// Switch on HPA
|
||||
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_HPA);
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::info << "Enabling PL PCDU HPA module" << std::endl;
|
||||
#endif
|
||||
commandExecuted = true;
|
||||
}
|
||||
// ADC values are ok, 5 seconds have elapsed
|
||||
@ -212,6 +228,9 @@ ReturnValue_t PayloadPcduHandler::buildTransitionDeviceCommand(DeviceCommandId_t
|
||||
*id = plpcdu::SETUP_CMD;
|
||||
return buildCommandFromCommand(*id, nullptr, 0);
|
||||
}
|
||||
if (mode == _MODE_TO_NORMAL) {
|
||||
return buildNormalDeviceCommand(id);
|
||||
}
|
||||
return NOTHING_TO_SEND;
|
||||
}
|
||||
|
||||
@ -479,6 +498,7 @@ void PayloadPcduHandler::checkAdcValues() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
transitionOk = true;
|
||||
}
|
||||
|
||||
void PayloadPcduHandler::checkJsonFileInit() {
|
||||
@ -503,6 +523,7 @@ bool PayloadPcduHandler::checkVoltage(float val, float lowerBound, float upperBo
|
||||
uint32_t p2 = 0;
|
||||
serializeFloat(p2, val);
|
||||
triggerEvent(event, tooLarge, p2);
|
||||
transitionOk = false;
|
||||
transitionBackToOff();
|
||||
return false;
|
||||
}
|
||||
@ -514,12 +535,20 @@ bool PayloadPcduHandler::checkCurrent(float val, float upperBound, Event event)
|
||||
uint32_t p2 = 0;
|
||||
serializeFloat(p2, val);
|
||||
triggerEvent(event, true, p2);
|
||||
transitionOk = false;
|
||||
transitionBackToOff();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::isModeCombinationValid(Mode_t mode, Submode_t submode) {
|
||||
if (mode == MODE_NORMAL and submode <= 1) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
return DeviceHandlerBase::isModeCombinationValid(mode, submode);
|
||||
}
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::serializeFloat(uint32_t& param, float val) {
|
||||
size_t dummy = 0;
|
||||
return SerializeAdapter::serialize(&val, reinterpret_cast<uint8_t*>(¶m), &dummy, 4,
|
||||
|
Reference in New Issue
Block a user