diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index cdf995bf..c9c8e0e2 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -160,7 +160,8 @@ void ObjectFactory::produce(void* args) { #if OBSW_ADD_MGT == 1 I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE, q7s::I2C_DEFAULT_DEV); - auto imtqHandler = new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie); + auto imtqHandler = new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie, + pcdu::Switches::PDU1_CH3_MGT_5V); imtqHandler->setPowerSwitcher(pwrSwitcher); static_cast(imtqHandler); #if OBSW_DEBUG_IMTQ == 1 @@ -628,14 +629,15 @@ void ObjectFactory::createSolarArrayDeploymentComponents() { gpioIds::DEPLSA1, gpioIds::DEPLSA2, 1000); } -void ObjectFactory::createSyrlinksComponents() { +void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) { UartCookie* syrlinksUartCookie = new UartCookie(objects::SYRLINKS_HK_HANDLER, q7s::UART_SYRLINKS_DEV, uart::SYRLINKS_BAUD, syrlinks::MAX_REPLY_SIZE, UartModes::NON_CANONICAL); syrlinksUartCookie->setParityEven(); - new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, syrlinksUartCookie, - pcdu::PDU1_CH1_SYRLINKS_12V); + auto syrlinksHandler = new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, + syrlinksUartCookie, pcdu::PDU1_CH1_SYRLINKS_12V); + syrlinksHandler->setPowerSwitcher(pwrSwitcher); } void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) { diff --git a/bsp_q7s/core/ObjectFactory.h b/bsp_q7s/core/ObjectFactory.h index bfa045c1..a812be35 100644 --- a/bsp_q7s/core/ObjectFactory.h +++ b/bsp_q7s/core/ObjectFactory.h @@ -24,7 +24,7 @@ void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF, PowerSwitchIF* pwrSwitcher); void createHeaterComponents(); void createSolarArrayDeploymentComponents(); -void createSyrlinksComponents(); +void createSyrlinksComponents(PowerSwitchIF* pwrSwitcher); void createPayloadComponents(LinuxLibgpioIF* gpioComIF); void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF); void createCcsdsComponents(LinuxLibgpioIF* gpioComIF); diff --git a/fsfw b/fsfw index e949368b..186b3565 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit e949368b062e8703c35d2043ece8d7258cd2608b +Subproject commit 186b3565e0eb6ca10ec2203febdbc7eb7e7f7fe0 diff --git a/generators/fsfwgen b/generators/fsfwgen index 9a92c7de..5ad9fb94 160000 --- a/generators/fsfwgen +++ b/generators/fsfwgen @@ -1 +1 @@ -Subproject commit 9a92c7de0a2fedfcc638c0517e3edea123e977f8 +Subproject commit 5ad9fb94af3312d29863527106396395f7b808a5 diff --git a/mission/devices/IMTQHandler.cpp b/mission/devices/IMTQHandler.cpp index e9483d35..2b3ba240 100644 --- a/mission/devices/IMTQHandler.cpp +++ b/mission/devices/IMTQHandler.cpp @@ -7,8 +7,10 @@ #include "OBSWConfig.h" -IMTQHandler::IMTQHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie) +IMTQHandler::IMTQHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie, + power::Switch_t pwrSwitcher) : DeviceHandlerBase(objectId, comIF, comCookie), + switcher(pwrSwitcher), engHkDataset(this), calMtmMeasurementSet(this), rawMtmMeasurementSet(this), @@ -2178,3 +2180,12 @@ std::string IMTQHandler::makeStepString(const uint8_t step) { } return stepString; } + +ReturnValue_t IMTQHandler::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) { + if (switcher != power::NO_SWITCH) { + *numberOfSwitches = 1; + *switches = &switcher; + return RETURN_OK; + } + return DeviceHandlerBase::NO_SWITCH; +} diff --git a/mission/devices/IMTQHandler.h b/mission/devices/IMTQHandler.h index f54306f4..8a5695cd 100644 --- a/mission/devices/IMTQHandler.h +++ b/mission/devices/IMTQHandler.h @@ -12,7 +12,8 @@ */ class IMTQHandler : public DeviceHandlerBase { public: - IMTQHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie); + IMTQHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie, + power::Switch_t pwrSwitcher); virtual ~IMTQHandler(); /** @@ -36,6 +37,7 @@ class IMTQHandler : public DeviceHandlerBase { uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override; ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) override; + ReturnValue_t getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) override; private: static const uint8_t INTERFACE_ID = CLASS_ID::IMTQ_HANDLER; @@ -111,6 +113,7 @@ class IMTQHandler : public DeviceHandlerBase { StartupStep startupStep = StartupStep::COMMAND_SELF_TEST; + power::Switch_t switcher = power::NO_SWITCH; bool selfTestPerformed = false; /**