From ac0b2e0dce75b841061cda8a8e30dce0937460b3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 3 May 2022 11:53:10 +0200 Subject: [PATCH] update object factory files --- bsp_q7s/em/CMakeLists.txt | 6 +-- ...{ObjectFactory.cpp => emObjectFactory.cpp} | 23 +------- bsp_q7s/fm/CMakeLists.txt | 2 +- ...{ObjectFactory.cpp => fmObjectFactory.cpp} | 54 ++++++++----------- 4 files changed, 26 insertions(+), 59 deletions(-) rename bsp_q7s/em/{ObjectFactory.cpp => emObjectFactory.cpp} (99%) rename bsp_q7s/fm/{ObjectFactory.cpp => fmObjectFactory.cpp} (97%) diff --git a/bsp_q7s/em/CMakeLists.txt b/bsp_q7s/em/CMakeLists.txt index cce9da77..066b807f 100644 --- a/bsp_q7s/em/CMakeLists.txt +++ b/bsp_q7s/em/CMakeLists.txt @@ -1,7 +1,3 @@ target_sources(${OBSW_NAME} PRIVATE - ObjectFactory.cpp -) - -target_sources(${SIMPLE_OBSW_NAME} PRIVATE - InitMission.cpp + emObjectFactory.cpp ) diff --git a/bsp_q7s/em/ObjectFactory.cpp b/bsp_q7s/em/emObjectFactory.cpp similarity index 99% rename from bsp_q7s/em/ObjectFactory.cpp rename to bsp_q7s/em/emObjectFactory.cpp index 03ccfce7..226be660 100644 --- a/bsp_q7s/em/ObjectFactory.cpp +++ b/bsp_q7s/em/emObjectFactory.cpp @@ -1,5 +1,3 @@ -#include "bsp_q7s/core/ObjectFactory.h" - #include #include @@ -10,6 +8,7 @@ #include "bsp_q7s/callbacks/q7sGpioCallbacks.h" #include "bsp_q7s/callbacks/rwSpiCallback.h" #include "bsp_q7s/core/CoreController.h" +#include "bsp_q7s/core/ObjectFactory.h" #include "bsp_q7s/memory/FileSystemHandler.h" #include "busConf.h" #include "ccsdsConfig.h" @@ -47,11 +46,9 @@ #include "mission/system/fdir/SusFdir.h" #include "tmtc/apid.h" #include "tmtc/pusIds.h" - #if OBSW_TEST_LIBGPIOD == 1 #include "linux/boardtest/LibgpiodTest.h" #endif - #include #include "fsfw/datapoollocal/LocalDataPoolManager.h" @@ -99,7 +96,6 @@ #include "mission/tmtc/CCSDSHandler.h" #include "mission/tmtc/VirtualChannel.h" #include "mission/utility/TmFunnel.h" - ResetArgs resetArgsGnss0; ResetArgs resetArgsGnss1; @@ -114,7 +110,6 @@ void Factory::setStaticFrameworkObjectIds() { DeviceHandlerBase::powerSwitcherId = objects::PCDU_HANDLER; // DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT; - #if OBSW_TM_TO_PTME == 1 TmFunnel::downlinkDestination = objects::CCSDS_HANDLER; #else @@ -150,7 +145,6 @@ void ObjectFactory::produce(void* args) { #if OBSW_ADD_ACS_BOARD == 1 createAcsBoardComponents(gpioComIF, uartComIF, pwrSwitcher); #endif - createHeaterComponents(); createSolarArrayDeploymentComponents(); createPlPcduComponents(gpioComIF, spiComIF, pwrSwitcher); @@ -187,7 +181,6 @@ void ObjectFactory::produce(void* args) { bpxHandler->setDebugMode(true); #endif #endif - new FileSystemHandler(objects::FILE_SYSTEM_HANDLER); #if OBSW_ADD_STAR_TRACKER == 1 @@ -202,16 +195,13 @@ void ObjectFactory::produce(void* args) { starTracker->setPowerSwitcher(pwrSwitcher); #endif /* OBSW_ADD_STAR_TRACKER == 1 */ - #if OBSW_USE_CCSDS_IP_CORE == 1 createCcsdsComponents(gpioComIF); #endif /* OBSW_USE_CCSDS_IP_CORE == 1 */ - /* Test Task */ #if OBSW_ADD_TEST_CODE == 1 createTestComponents(gpioComIF); #endif /* OBSW_ADD_TEST_CODE == 1 */ - new PlocUpdater(objects::PLOC_UPDATER); new PlocMemoryDumper(objects::PLOC_MEMORY_DUMPER); } @@ -439,7 +429,6 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI #if OBSW_DEBUG_ACS == 1 mgmLis3Handler->enablePeriodicPrintouts(true, 10); #endif - spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); @@ -456,7 +445,6 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI #if OBSW_DEBUG_ACS == 1 mgmRm3100Handler->enablePeriodicPrintouts(true, 10); #endif - spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); @@ -488,7 +476,6 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI #if OBSW_DEBUG_ACS == 1 mgmRm3100Handler->enablePeriodicPrintouts(true, 10); #endif - // Commented until ACS board V2 in in clean room again // Gyro 0 Side A spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev, @@ -507,7 +494,6 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI #if OBSW_DEBUG_ACS == 1 adisHandler->enablePeriodicPrintouts(true, 10); #endif - // Gyro 1 Side A spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE, @@ -525,7 +511,6 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI #if OBSW_DEBUG_ACS == 1 gyroL3gHandler->enablePeriodicPrintouts(true, 10); #endif - // Gyro 2 Side B spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev, ADIS1650X::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE, @@ -555,7 +540,6 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI #if OBSW_DEBUG_ACS == 1 gyroL3gHandler->enablePeriodicPrintouts(true, 10); #endif - bool debugGps = false; #if OBSW_DEBUG_GPS == 1 debugGps = true; @@ -681,7 +665,6 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) { plocMpsocHelper, Gpio(gpioIds::ENABLE_MPSOC_UART, gpioComIF), objects::PLOC_SUPERVISOR_HANDLER); #endif /* OBSW_ADD_PLOC_MPSOC == 1 */ - #if OBSW_ADD_PLOC_SUPERVISOR == 1 consumer << "0x" << std::hex << objects::PLOC_SUPERVISOR_HANDLER; auto gpioConfigSupv = new GpiodRegularByLineName(q7s::gpioNames::ENABLE_SUPV_UART, consumer.str(), @@ -765,7 +748,6 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { rwHandler1->setStartUpImmediately(); rwHandler1->setDebugMode(true); #endif - auto rwHandler2 = new RwHandler(objects::RW2, objects::SPI_COM_IF, rw2SpiCookie, gpioComIF, gpioIds::EN_RW2); rw2SpiCookie->setCallbackArgs(rwHandler2); @@ -773,7 +755,6 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { rwHandler2->setStartUpImmediately(); rwHandler2->setDebugMode(true); #endif - auto rwHandler3 = new RwHandler(objects::RW3, objects::SPI_COM_IF, rw3SpiCookie, gpioComIF, gpioIds::EN_RW3); rw3SpiCookie->setCallbackArgs(rwHandler3); @@ -781,7 +762,6 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { rwHandler3->setStartUpImmediately(); rwHandler3->setDebugMode(true); #endif - auto rwHandler4 = new RwHandler(objects::RW4, objects::SPI_COM_IF, rw4SpiCookie, gpioComIF, gpioIds::EN_RW4); rw4SpiCookie->setCallbackArgs(rwHandler4); @@ -789,7 +769,6 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { rwHandler4->setStartUpImmediately(); rwHandler4->setDebugMode(true); #endif - #endif /* OBSW_ADD_RW == 1 */ } diff --git a/bsp_q7s/fm/CMakeLists.txt b/bsp_q7s/fm/CMakeLists.txt index 6e97d7c7..5d20a118 100644 --- a/bsp_q7s/fm/CMakeLists.txt +++ b/bsp_q7s/fm/CMakeLists.txt @@ -1,3 +1,3 @@ target_sources(${OBSW_NAME} PRIVATE - ObjectFactory.cpp + fmObjectFactory.cpp ) diff --git a/bsp_q7s/fm/ObjectFactory.cpp b/bsp_q7s/fm/fmObjectFactory.cpp similarity index 97% rename from bsp_q7s/fm/ObjectFactory.cpp rename to bsp_q7s/fm/fmObjectFactory.cpp index 3942d20d..226be660 100644 --- a/bsp_q7s/fm/ObjectFactory.cpp +++ b/bsp_q7s/fm/fmObjectFactory.cpp @@ -1,4 +1,5 @@ -#include "bsp_q7s/core/ObjectFactory.h" +#include +#include #include "OBSWConfig.h" #include "bsp_q7s/boardtest/Q7STestTask.h" @@ -7,6 +8,7 @@ #include "bsp_q7s/callbacks/q7sGpioCallbacks.h" #include "bsp_q7s/callbacks/rwSpiCallback.h" #include "bsp_q7s/core/CoreController.h" +#include "bsp_q7s/core/ObjectFactory.h" #include "bsp_q7s/memory/FileSystemHandler.h" #include "busConf.h" #include "ccsdsConfig.h" @@ -37,18 +39,16 @@ #include "linux/obc/PdecHandler.h" #include "linux/obc/Ptme.h" #include "linux/obc/PtmeConfig.h" -#include "mission/system/AcsBoardFdir.h" -#include "mission/system/RtdFdir.h" #include "mission/system/SusAssembly.h" -#include "mission/system/SusFdir.h" #include "mission/system/TcsBoardAssembly.h" +#include "mission/system/fdir/AcsBoardFdir.h" +#include "mission/system/fdir/RtdFdir.h" +#include "mission/system/fdir/SusFdir.h" #include "tmtc/apid.h" #include "tmtc/pusIds.h" - #if OBSW_TEST_LIBGPIOD == 1 #include "linux/boardtest/LibgpiodTest.h" #endif - #include #include "fsfw/datapoollocal/LocalDataPoolManager.h" @@ -96,7 +96,6 @@ #include "mission/tmtc/CCSDSHandler.h" #include "mission/tmtc/VirtualChannel.h" #include "mission/utility/TmFunnel.h" - ResetArgs resetArgsGnss0; ResetArgs resetArgsGnss1; @@ -111,7 +110,6 @@ void Factory::setStaticFrameworkObjectIds() { DeviceHandlerBase::powerSwitcherId = objects::PCDU_HANDLER; // DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT; - #if OBSW_TM_TO_PTME == 1 TmFunnel::downlinkDestination = objects::CCSDS_HANDLER; #else @@ -147,7 +145,6 @@ void ObjectFactory::produce(void* args) { #if OBSW_ADD_ACS_BOARD == 1 createAcsBoardComponents(gpioComIF, uartComIF, pwrSwitcher); #endif - createHeaterComponents(); createSolarArrayDeploymentComponents(); createPlPcduComponents(gpioComIF, spiComIF, pwrSwitcher); @@ -184,7 +181,6 @@ void ObjectFactory::produce(void* args) { bpxHandler->setDebugMode(true); #endif #endif - new FileSystemHandler(objects::FILE_SYSTEM_HANDLER); #if OBSW_ADD_STAR_TRACKER == 1 @@ -199,16 +195,13 @@ void ObjectFactory::produce(void* args) { starTracker->setPowerSwitcher(pwrSwitcher); #endif /* OBSW_ADD_STAR_TRACKER == 1 */ - #if OBSW_USE_CCSDS_IP_CORE == 1 createCcsdsComponents(gpioComIF); #endif /* OBSW_USE_CCSDS_IP_CORE == 1 */ - /* Test Task */ #if OBSW_ADD_TEST_CODE == 1 createTestComponents(gpioComIF); #endif /* OBSW_ADD_TEST_CODE == 1 */ - new PlocUpdater(objects::PLOC_UPDATER); new PlocMemoryDumper(objects::PLOC_MEMORY_DUMPER); } @@ -251,14 +244,22 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU1); CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU2); CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_LENGTH, addresses::ACU); - /* Device Handler */ + + auto p60Fdir = new GomspacePowerFdir(objects::P60DOCK_HANDLER); P60DockHandler* p60dockhandler = - new P60DockHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF, p60DockCspCookie); + new P60DockHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF, p60DockCspCookie, p60Fdir); + + auto pdu1Fdir = new GomspacePowerFdir(objects::PDU1_HANDLER); PDU1Handler* pdu1handler = - new PDU1Handler(objects::PDU1_HANDLER, objects::CSP_COM_IF, pdu1CspCookie); + new PDU1Handler(objects::PDU1_HANDLER, objects::CSP_COM_IF, pdu1CspCookie, pdu1Fdir); + + auto pdu2Fdir = new GomspacePowerFdir(objects::PDU2_HANDLER); PDU2Handler* pdu2handler = - new PDU2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF, pdu2CspCookie); - ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie); + new PDU2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF, pdu2CspCookie, pdu2Fdir); + + auto acuFdir = new GomspacePowerFdir(objects::ACU_HANDLER); + ACUHandler* acuhandler = + new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie, acuFdir); auto pcduHandler = new PCDUHandler(objects::PCDU_HANDLER, 50); /** @@ -428,7 +429,6 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI #if OBSW_DEBUG_ACS == 1 mgmLis3Handler->enablePeriodicPrintouts(true, 10); #endif - spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); @@ -445,7 +445,6 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI #if OBSW_DEBUG_ACS == 1 mgmRm3100Handler->enablePeriodicPrintouts(true, 10); #endif - spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); @@ -477,7 +476,6 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI #if OBSW_DEBUG_ACS == 1 mgmRm3100Handler->enablePeriodicPrintouts(true, 10); #endif - // Commented until ACS board V2 in in clean room again // Gyro 0 Side A spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev, @@ -496,7 +494,6 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI #if OBSW_DEBUG_ACS == 1 adisHandler->enablePeriodicPrintouts(true, 10); #endif - // Gyro 1 Side A spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE, @@ -514,7 +511,6 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI #if OBSW_DEBUG_ACS == 1 gyroL3gHandler->enablePeriodicPrintouts(true, 10); #endif - // Gyro 2 Side B spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev, ADIS1650X::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE, @@ -544,7 +540,6 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI #if OBSW_DEBUG_ACS == 1 gyroL3gHandler->enablePeriodicPrintouts(true, 10); #endif - bool debugGps = false; #if OBSW_DEBUG_GPS == 1 debugGps = true; @@ -641,8 +636,10 @@ void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) { syrlinks::MAX_REPLY_SIZE, UartModes::NON_CANONICAL); syrlinksUartCookie->setParityEven(); - auto syrlinksHandler = new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, - syrlinksUartCookie, pcdu::PDU1_CH1_SYRLINKS_12V); + auto syrlinksFdir = new SyrlinksFdir(objects::SYRLINKS_HK_HANDLER); + auto syrlinksHandler = + new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, syrlinksUartCookie, + pcdu::PDU1_CH1_SYRLINKS_12V, syrlinksFdir); syrlinksHandler->setPowerSwitcher(pwrSwitcher); #if OBSW_DEBUG_SYRLINKS == 1 syrlinksHandler->setDebugMode(true); @@ -668,7 +665,6 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) { plocMpsocHelper, Gpio(gpioIds::ENABLE_MPSOC_UART, gpioComIF), objects::PLOC_SUPERVISOR_HANDLER); #endif /* OBSW_ADD_PLOC_MPSOC == 1 */ - #if OBSW_ADD_PLOC_SUPERVISOR == 1 consumer << "0x" << std::hex << objects::PLOC_SUPERVISOR_HANDLER; auto gpioConfigSupv = new GpiodRegularByLineName(q7s::gpioNames::ENABLE_SUPV_UART, consumer.str(), @@ -752,7 +748,6 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { rwHandler1->setStartUpImmediately(); rwHandler1->setDebugMode(true); #endif - auto rwHandler2 = new RwHandler(objects::RW2, objects::SPI_COM_IF, rw2SpiCookie, gpioComIF, gpioIds::EN_RW2); rw2SpiCookie->setCallbackArgs(rwHandler2); @@ -760,7 +755,6 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { rwHandler2->setStartUpImmediately(); rwHandler2->setDebugMode(true); #endif - auto rwHandler3 = new RwHandler(objects::RW3, objects::SPI_COM_IF, rw3SpiCookie, gpioComIF, gpioIds::EN_RW3); rw3SpiCookie->setCallbackArgs(rwHandler3); @@ -768,7 +762,6 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { rwHandler3->setStartUpImmediately(); rwHandler3->setDebugMode(true); #endif - auto rwHandler4 = new RwHandler(objects::RW4, objects::SPI_COM_IF, rw4SpiCookie, gpioComIF, gpioIds::EN_RW4); rw4SpiCookie->setCallbackArgs(rwHandler4); @@ -776,7 +769,6 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { rwHandler4->setStartUpImmediately(); rwHandler4->setDebugMode(true); #endif - #endif /* OBSW_ADD_RW == 1 */ }