first sucessfull full transition
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit

This commit is contained in:
Robin Müller 2022-02-25 20:14:59 +01:00
parent 49e58b2365
commit 30f4beb5f6
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
5 changed files with 43 additions and 12 deletions

View File

@ -1170,15 +1170,6 @@ void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF*
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_DRO, consumer, gpio::DIR_OUT,
gpio::Levels::LOW);
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_DRO, gpio);
consumer = "PLPCDU_ENB_HPA";
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_HPA, consumer, gpio::DIR_OUT,
gpio::Levels::LOW);
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_HPA, gpio);
consumer = "PLPCDU_ENB_MPA";
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_MPA, consumer, gpio::DIR_OUT,
gpio::Levels::LOW);
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_MPA, gpio);
consumer = "PLPCDU_ENB_X8";
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_X8, consumer, gpio::DIR_OUT,
gpio::Levels::LOW);
@ -1187,6 +1178,14 @@ void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF*
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_TX, consumer, gpio::DIR_OUT,
gpio::Levels::LOW);
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_TX, gpio);
consumer = "PLPCDU_ENB_MPA";
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_MPA, consumer, gpio::DIR_OUT,
gpio::Levels::LOW);
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_MPA, gpio);
consumer = "PLPCDU_ENB_HPA";
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_HPA, consumer, gpio::DIR_OUT,
gpio::Levels::LOW);
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_HPA, gpio);
// Chip select pin is active low
consumer = "PLPCDU_ADC_CS";

View File

@ -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*>(&param), &dummy, 4,

View File

@ -33,6 +33,7 @@ class SpiCookie;
class PayloadPcduHandler : public DeviceHandlerBase {
public:
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PL_PCDU_HANDLER;
//! [EXPORT] : [COMMENT] Could not transition properly and went back to ALL OFF
static constexpr Event TRANSITION_BACK_TO_OFF =
event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
//! [EXPORT] : [COMMENT] P1: 0 -> too low, 1 -> too high P2: Float value
@ -139,6 +140,8 @@ class PayloadPcduHandler : public DeviceHandlerBase {
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override;
ReturnValue_t isModeCombinationValid(Mode_t mode, Submode_t submode) override;
void handleExtConvRead(const uint8_t* bufStart);
void handlePrintout();
void checkAdcValues();

View File

@ -83,8 +83,8 @@ static constexpr float SCALE_CURRENT_DRO = MAX122X_SCALE / (GAIN_INA169 * R_SHUN
// TODO: Make these configurable parameters using a JSON file
// Upper bound of currents in milliamperes [mA]
static constexpr double NEG_V_LOWER_BOUND = -6.0;
static constexpr double NEG_V_UPPER_BOUND = -3.3;
static constexpr double NEG_V_LOWER_BOUND = -6.5;
static constexpr double NEG_V_UPPER_BOUND = -2.7;
static constexpr double DRO_U_LOWER_BOUND = 5.0;
static constexpr double DRO_U_UPPER_BOUND = 7.0;

2
tmtc

@ -1 +1 @@
Subproject commit 7e24589184bb7bbd427c66ed55b3c29bbeba927f
Subproject commit 1238df03834b0b9ddbe2a59565de493661f5476e