diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 2daa907a..ecc88ede 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_TEST_IMTQ == 1 @@ -182,12 +183,14 @@ void ObjectFactory::produce(void* args) { #if OBSW_ADD_STAR_TRACKER == 1 UartCookie* starTrackerCookie = - new UartCookie(objects::STAR_TRACKER, q7s::UART_STAR_TRACKER_DEV, UartModes::NON_CANONICAL, - uart::STAR_TRACKER_BAUD, startracker::MAX_FRAME_SIZE * 2 + 2); + new UartCookie(objects::STAR_TRACKER, q7s::UART_STAR_TRACKER_DEV, uart::STAR_TRACKER_BAUD, + startracker::MAX_FRAME_SIZE * 2 + 2, UartModes::NON_CANONICAL); starTrackerCookie->setNoFixedSizeReply(); StrHelper* strHelper = new StrHelper(objects::STR_HELPER); - new StarTrackerHandler(objects::STAR_TRACKER, objects::UART_COM_IF, starTrackerCookie, strHelper, - pcduSwitches::PDU1_CH2_STAR_TRACKER_5V); + auto starTracker = + new StarTrackerHandler(objects::STAR_TRACKER, objects::UART_COM_IF, starTrackerCookie, + strHelper, pcdu::PDU1_CH2_STAR_TRACKER_5V); + starTracker->setPowerSwitcher(pwrSwitcher); #endif /* OBSW_ADD_STAR_TRACKER == 1 */ @@ -620,14 +623,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); + 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) { @@ -641,8 +645,8 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) { mpsocGpioCookie->addGpio(gpioIds::ENABLE_MPSOC_UART, gpioConfigMPSoC); gpioComIF->addGpios(mpsocGpioCookie); auto mpsocCookie = - new UartCookie(objects::PLOC_MPSOC_HANDLER, q7s::UART_PLOC_MPSOC_DEV, - UartModes::NON_CANONICAL, uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE); + new UartCookie(objects::PLOC_MPSOC_HANDLER, q7s::UART_PLOC_MPSOC_DEV, uart::PLOC_MPSOC_BAUD, + mpsoc::MAX_REPLY_SIZE, UartModes::NON_CANONICAL); mpsocCookie->setNoFixedSizeReply(); auto plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER); new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocCookie, @@ -658,12 +662,12 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) { supvGpioCookie->addGpio(gpioIds::ENABLE_SUPV_UART, gpioConfigSupv); gpioComIF->addGpios(supvGpioCookie); auto supervisorCookie = new UartCookie(objects::PLOC_SUPERVISOR_HANDLER, - q7s::UART_PLOC_SUPERVSIOR_DEV, UartModes::NON_CANONICAL, - uart::PLOC_SUPERVISOR_BAUD, supv::MAX_PACKET_SIZE * 20); + q7s::UART_PLOC_SUPERVSIOR_DEV, uart::PLOC_SUPERVISOR_BAUD, + supv::MAX_PACKET_SIZE * 20, UartModes::NON_CANONICAL); supervisorCookie->setNoFixedSizeReply(); new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF, supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF), - pcduSwitches::PDU1_CH6_PLOC_12V); + pcdu::PDU1_CH6_PLOC_12V); #endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */ static_cast(consumer); } 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/mission/devices/IMTQHandler.cpp b/mission/devices/IMTQHandler.cpp index 645a8aa7..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), @@ -118,7 +120,7 @@ ReturnValue_t IMTQHandler::buildCommandFromCommand(DeviceCommandId_t deviceComma case (IMTQ::START_ACTUATION_DIPOLE): { /* IMTQ expects low byte first */ commandBuffer[0] = IMTQ::CC::START_ACTUATION_DIPOLE; - if(commandData == nullptr) { + if (commandData == nullptr) { return DeviceHandlerIF::INVALID_COMMAND_PARAMETER; } commandBuffer[1] = commandData[1]; @@ -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; /** diff --git a/mission/system/AcsSubsystem.cpp b/mission/system/AcsSubsystem.cpp index 4d9fe841..37da0123 100644 --- a/mission/system/AcsSubsystem.cpp +++ b/mission/system/AcsSubsystem.cpp @@ -1 +1,5 @@ #include "AcsSubsystem.h" + +AcsSubsystem::AcsSubsystem(object_id_t setObjectId, object_id_t parent, + uint32_t maxNumberOfSequences, uint32_t maxNumberOfTables) + : Subsystem(setObjectId, parent, maxNumberOfSequences, maxNumberOfTables) {} diff --git a/mission/system/AcsSubsystem.h b/mission/system/AcsSubsystem.h index 39d1fca9..20fffdbe 100644 --- a/mission/system/AcsSubsystem.h +++ b/mission/system/AcsSubsystem.h @@ -1,4 +1,14 @@ #ifndef MISSION_SYSTEM_ACSSUBSYSTEM_H_ #define MISSION_SYSTEM_ACSSUBSYSTEM_H_ +#include + +class AcsSubsystem : public Subsystem { + public: + AcsSubsystem(object_id_t setObjectId, object_id_t parent, uint32_t maxNumberOfSequences, + uint32_t maxNumberOfTables); + + private: +}; + #endif /* MISSION_SYSTEM_ACSSUBSYSTEM_H_ */ diff --git a/mission/system/CMakeLists.txt b/mission/system/CMakeLists.txt index 27637339..59418a07 100644 --- a/mission/system/CMakeLists.txt +++ b/mission/system/CMakeLists.txt @@ -1,9 +1,11 @@ target_sources(${LIB_EIVE_MISSION} PRIVATE + EiveSystem.cpp + AcsSubsystem.cpp + ComSubsystem.cpp + PayloadSubsystem.cpp + AcsBoardAssembly.cpp SusAssembly.cpp - AcsSubsystem.cpp - EiveSystem.cpp - ComSubsystem.cpp DualLanePowerStateMachine.cpp PowerStateMachineBase.cpp DualLaneAssemblyBase.cpp diff --git a/mission/system/ComSubsystem.cpp b/mission/system/ComSubsystem.cpp index fe91daff..3308de8c 100644 --- a/mission/system/ComSubsystem.cpp +++ b/mission/system/ComSubsystem.cpp @@ -1 +1,5 @@ #include "ComSubsystem.h" + +ComSubsystem::ComSubsystem(object_id_t setObjectId, object_id_t parent, + uint32_t maxNumberOfSequences, uint32_t maxNumberOfTables) + : Subsystem(setObjectId, parent, maxNumberOfSequences, maxNumberOfTables) {} diff --git a/mission/system/ComSubsystem.h b/mission/system/ComSubsystem.h index a850c228..fc35438c 100644 --- a/mission/system/ComSubsystem.h +++ b/mission/system/ComSubsystem.h @@ -1,4 +1,14 @@ #ifndef MISSION_SYSTEM_COMSUBSYSTEM_H_ #define MISSION_SYSTEM_COMSUBSYSTEM_H_ +#include + +class ComSubsystem : public Subsystem { + public: + ComSubsystem(object_id_t setObjectId, object_id_t parent, uint32_t maxNumberOfSequences, + uint32_t maxNumberOfTables); + + private: +}; + #endif /* MISSION_SYSTEM_COMSUBSYSTEM_H_ */ diff --git a/mission/system/EiveSystem.cpp b/mission/system/EiveSystem.cpp index 1fcd9b0f..1be0152a 100644 --- a/mission/system/EiveSystem.cpp +++ b/mission/system/EiveSystem.cpp @@ -1 +1,5 @@ #include "EiveSystem.h" + +EiveSystem::EiveSystem(object_id_t setObjectId, object_id_t parent, uint32_t maxNumberOfSequences, + uint32_t maxNumberOfTables) + : Subsystem(setObjectId, parent, maxNumberOfSequences, maxNumberOfTables) {} diff --git a/mission/system/EiveSystem.h b/mission/system/EiveSystem.h index d4957787..671d47b6 100644 --- a/mission/system/EiveSystem.h +++ b/mission/system/EiveSystem.h @@ -1,4 +1,14 @@ #ifndef MISSION_SYSTEM_EIVESYSTEM_H_ #define MISSION_SYSTEM_EIVESYSTEM_H_ +#include + +class EiveSystem : public Subsystem { + public: + EiveSystem(object_id_t setObjectId, object_id_t parent, uint32_t maxNumberOfSequences, + uint32_t maxNumberOfTables); + + private: +}; + #endif /* MISSION_SYSTEM_EIVESYSTEM_H_ */ diff --git a/mission/system/PayloadSubsystem.cpp b/mission/system/PayloadSubsystem.cpp index a1f277e9..97008c2f 100644 --- a/mission/system/PayloadSubsystem.cpp +++ b/mission/system/PayloadSubsystem.cpp @@ -1 +1,5 @@ #include "PayloadSubsystem.h" + +PayloadSubsystem::PayloadSubsystem(object_id_t setObjectId, object_id_t parent, + uint32_t maxNumberOfSequences, uint32_t maxNumberOfTables) + : Subsystem(setObjectId, parent, maxNumberOfSequences, maxNumberOfTables) {} diff --git a/mission/system/PayloadSubsystem.h b/mission/system/PayloadSubsystem.h index 6725c02f..b25454f7 100644 --- a/mission/system/PayloadSubsystem.h +++ b/mission/system/PayloadSubsystem.h @@ -1,4 +1,14 @@ #ifndef MISSION_SYSTEM_PAYLOADSUBSYSTEM_H_ #define MISSION_SYSTEM_PAYLOADSUBSYSTEM_H_ +#include + +class PayloadSubsystem : public Subsystem { + public: + PayloadSubsystem(object_id_t setObjectId, object_id_t parent, uint32_t maxNumberOfSequences, + uint32_t maxNumberOfTables); + + private: +}; + #endif /* MISSION_SYSTEM_PAYLOADSUBSYSTEM_H_ */