use stack handler in PL PCDU component
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
This commit is contained in:
parent
c2d2848020
commit
268233551d
@ -830,7 +830,8 @@ ReturnValue_t ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF,
|
||||
}
|
||||
|
||||
void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
|
||||
PowerSwitchIF* pwrSwitcher) {
|
||||
PowerSwitchIF* pwrSwitcher,
|
||||
Stack5VHandler& stackHandler) {
|
||||
using namespace gpio;
|
||||
// Create all GPIO components first
|
||||
GpioCookie* plPcduGpios = new GpioCookie;
|
||||
@ -876,10 +877,9 @@ void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF*
|
||||
new SpiCookie(addresses::PLPCDU_ADC, gpioIds::PLPCDU_ADC_CS, plpcdu::MAX_ADC_REPLY_SIZE,
|
||||
spi::DEFAULT_MAX_1227_MODE, spi::PL_PCDU_MAX_1227_SPEED);
|
||||
// Create device handler components
|
||||
auto plPcduHandler = new PayloadPcduHandler(
|
||||
objects::PLPCDU_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie, gpioComIF,
|
||||
SdCardManager::instance(), pwrSwitcher, pcdu::Switches::PDU2_CH1_PL_PCDU_BATT_0_14V8,
|
||||
pcdu::Switches::PDU2_CH6_PL_PCDU_BATT_1_14V8, false);
|
||||
auto plPcduHandler =
|
||||
new PayloadPcduHandler(objects::PLPCDU_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie,
|
||||
gpioComIF, SdCardManager::instance(), stackHandler, false);
|
||||
spiCookie->setCallbackMode(PayloadPcduHandler::extConvAsTwoCallback, plPcduHandler);
|
||||
// plPcduHandler->enablePeriodicPrintout(true, 5);
|
||||
// static_cast<void>(plPcduHandler);
|
||||
|
@ -28,7 +28,7 @@ void createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, SerialComIF** uar
|
||||
SpiComIF** spiRwComIF);
|
||||
void createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher);
|
||||
void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
|
||||
PowerSwitchIF* pwrSwitcher);
|
||||
PowerSwitchIF* pwrSwitcher, Stack5VHandler& stackHandler);
|
||||
void createTmpComponents();
|
||||
ReturnValue_t createRadSensorComponent(LinuxLibgpioIF* gpioComIF, Stack5VHandler& handler);
|
||||
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, SerialComIF* uartComIF,
|
||||
|
@ -50,7 +50,7 @@ void ObjectFactory::produce(void* args) {
|
||||
createTmpComponents();
|
||||
#endif
|
||||
createSolarArrayDeploymentComponents(*pwrSwitcher, *gpioComIF);
|
||||
createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher);
|
||||
createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher, *stackHandler);
|
||||
#if OBSW_ADD_SYRLINKS == 1
|
||||
createSyrlinksComponents(pwrSwitcher);
|
||||
#endif /* OBSW_ADD_SYRLINKS == 1 */
|
||||
|
@ -16,27 +16,21 @@
|
||||
|
||||
PayloadPcduHandler::PayloadPcduHandler(object_id_t objectId, object_id_t comIF, CookieIF* cookie,
|
||||
GpioIF* gpioIF, SdCardMountedIF* sdcMan,
|
||||
PowerSwitchIF* pwrSwitcher, power::Switch_t switchA,
|
||||
power::Switch_t switchB, bool periodicPrintout)
|
||||
Stack5VHandler& stackHandler, bool periodicPrintout)
|
||||
: DeviceHandlerBase(objectId, comIF, cookie),
|
||||
adcSet(this),
|
||||
stackHandler(stackHandler),
|
||||
periodicPrintout(periodicPrintout),
|
||||
gpioIF(gpioIF),
|
||||
sdcMan(sdcMan),
|
||||
pwrStateMachine(switchA, switchB, pwrSwitcher) {}
|
||||
sdcMan(sdcMan) {}
|
||||
|
||||
void PayloadPcduHandler::doStartUp() {
|
||||
if ((state != States::PL_PCDU_OFF) and (state != States::ON_TRANS_SSR)) {
|
||||
// Config error
|
||||
sif::error << "PayloadPcduHandler::doStartUp: Invalid state" << std::endl;
|
||||
}
|
||||
if (pwrStateMachine.getState() == power::States::IDLE) {
|
||||
pwrStateMachine.start(MODE_ON, pwrSubmode);
|
||||
}
|
||||
clearSetOnOffFlag = true;
|
||||
auto opCode = pwrStateMachine.fsm();
|
||||
if (opCode == power::OpCodes::TO_NOT_OFF_DONE or opCode == power::OpCodes::TIMEOUT_OCCURED) {
|
||||
pwrStateMachine.reset();
|
||||
if (true) {
|
||||
quickTransitionAlreadyCalled = false;
|
||||
state = States::POWER_CHANNELS_ON;
|
||||
setMode(_MODE_TO_ON);
|
||||
@ -48,17 +42,12 @@ void PayloadPcduHandler::doShutDown() {
|
||||
quickTransitionBackToOff(false, false);
|
||||
quickTransitionAlreadyCalled = true;
|
||||
}
|
||||
if (pwrStateMachine.getState() == power::States::IDLE) {
|
||||
pwrStateMachine.start(MODE_OFF, 0);
|
||||
}
|
||||
if (clearSetOnOffFlag) {
|
||||
std::memset(adcSet.processed.value, 0, adcSet.processed.getSerializedSize());
|
||||
clearSetOnOffFlag = false;
|
||||
}
|
||||
|
||||
auto opCode = pwrStateMachine.fsm();
|
||||
if (opCode == power::OpCodes::TO_OFF_DONE or opCode == power::OpCodes::TIMEOUT_OCCURED) {
|
||||
pwrStateMachine.reset();
|
||||
if (true) {
|
||||
state = States::PL_PCDU_OFF;
|
||||
// No need to set mode _MODE_POWER_DOWN, power switching was already handled
|
||||
setMode(MODE_OFF);
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
||||
#include <fsfw/timemanager/Countdown.h>
|
||||
#include <mission/system/objects/Stack5VHandler.h>
|
||||
|
||||
#include "events/subsystemIdRanges.h"
|
||||
#include "fsfw/FSFW.h"
|
||||
@ -62,8 +63,7 @@ class PayloadPcduHandler : public DeviceHandlerBase {
|
||||
static constexpr Event I_HPA_OUT_OF_BOUNDS = event::makeEvent(SUBSYSTEM_ID, 11, severity::MEDIUM);
|
||||
|
||||
PayloadPcduHandler(object_id_t objectId, object_id_t comIF, CookieIF* cookie, GpioIF* gpioIF,
|
||||
SdCardMountedIF* sdcMan, PowerSwitchIF* pwrSwitcher, power::Switch_t switchCh0,
|
||||
power::Switch_t switchCh1, bool periodicPrintout);
|
||||
SdCardMountedIF* sdcMan, Stack5VHandler& stackHandler, bool periodicPrintout);
|
||||
|
||||
void setToGoToNormalModeImmediately(bool enable);
|
||||
void enablePeriodicPrintout(bool enable, uint8_t divider);
|
||||
@ -108,6 +108,7 @@ class PayloadPcduHandler : public DeviceHandlerBase {
|
||||
|
||||
bool goToNormalMode = false;
|
||||
plpcdu::PlPcduAdcSet adcSet;
|
||||
Stack5VHandler& stackHandler;
|
||||
std::array<uint8_t, plpcdu::MAX_ADC_REPLY_SIZE> cmdBuf = {};
|
||||
// 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.
|
||||
@ -140,7 +141,6 @@ class PayloadPcduHandler : public DeviceHandlerBase {
|
||||
PoolEntry<float> processedValues =
|
||||
PoolEntry<float>({0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0});
|
||||
PoolEntry<float> tempC = PoolEntry<float>({0.0});
|
||||
DualLanePowerStateMachine pwrStateMachine;
|
||||
|
||||
void updateSwitchGpio(gpioId_t id, gpio::Levels level);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user