From cdd020666b7b4d3ed75bbde57432ccbe4856b846 Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" Date: Sun, 14 Feb 2021 11:03:53 +0100 Subject: [PATCH] restructured objectfactory and init_mission for libgpio test on te0720 --- bsp_q7s/InitMission.cpp | 17 ++------- bsp_q7s/ObjectFactory.cpp | 38 +++++++++---------- etl | 2 +- fsfw | 2 +- fsfwconfig/OBSWConfig.h | 2 +- test/testtasks/CMakeLists.txt | 2 +- .../{LibgpioTest.cpp => LibgpiodTest.cpp} | 15 ++++---- .../{LibgpioTest.h => LibgpiodTest.h} | 12 +++--- tmtc | 2 +- 9 files changed, 40 insertions(+), 52 deletions(-) rename test/testtasks/{LibgpioTest.cpp => LibgpiodTest.cpp} (55%) rename test/testtasks/{LibgpioTest.h => LibgpiodTest.h} (54%) diff --git a/bsp_q7s/InitMission.cpp b/bsp_q7s/InitMission.cpp index fd4cde43..681d6b48 100644 --- a/bsp_q7s/InitMission.cpp +++ b/bsp_q7s/InitMission.cpp @@ -137,6 +137,7 @@ void InitMission::initTasks(){ << std::endl; } +#if TE0720 == 0 FixedTimeslotTaskIF* GomSpacePstTask = TaskFactory::instance()-> createFixedTimeslotTask("GS_PST_TASK", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE*8, 3.0, nullptr); @@ -144,19 +145,7 @@ void InitMission::initTasks(){ if(result != HasReturnvaluesIF::RETURN_OK) { sif::error << "InitMission::initTasks: GomSpace PST initialization " << "failed!" << std::endl; -} - - -#if OBSW_ADD_TEST_CODE == 1 -// FixedTimeslotTaskIF* TestTimeslotTask = TaskFactory::instance()-> -// createFixedTimeslotTask("PST_TEST_TASK", 10, -// PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr); -// result = pst::pollingSequenceTestFunction(TestTimeslotTask); -// if(result != HasReturnvaluesIF::RETURN_OK) { -// sif::error << "InitMission::createTasks: Test PST initialization " -// << "failed!" << std::endl; -// } - + } #endif #if TE0720 == 1 && TEST_LIBGPIOD == 1 @@ -175,7 +164,9 @@ void InitMission::initTasks(){ UdpBridgeTask->startTask(); UdpPollingTask->startTask(); +#if TE0720 == 0 GomSpacePstTask->startTask(); +#endif PollingSequenceTableTaskDefault->startTask(); PusVerification->startTask(); diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/ObjectFactory.cpp index 7ee93a2c..5dde01d3 100644 --- a/bsp_q7s/ObjectFactory.cpp +++ b/bsp_q7s/ObjectFactory.cpp @@ -34,7 +34,7 @@ #include # if TEST_LIBGPIOD == 1 -#include "LibgpioTest.h" +#include "LibgpiodTest.h" #endif void Factory::setStaticFrameworkObjectIds() { @@ -110,23 +110,9 @@ void ObjectFactory::produce(){ i2cCookieTmp1075tcs2); tmp1075Handler_2->setStartUpImmediately(); - /* Thermal objects */ GpioCookie* gpioCookie = new GpioCookie; -#if TE0720 == 1 - -#if TEST_LIBGPIOD == 1 - /* Configure MIO0 as input */ - GpioConfig_t gpioConfigMio0(std::string("gpiochip0"), 0, - std::string("MIO0"), Gpio::IN, 0); - gpioCookie->addGpio(gpioIds::Test_ID, gpioConfigMio0); -#else - // Configuration for MIO0 on TE0720-03-1CFA - GpioConfig_t gpioConfigForDummyHeater(std::string("gpiochip0"), 0, - std::string("Heater0"), Gpio::OUT, 0); - gpioCookie->addGpio(gpioIds::HEATER_0, gpioConfigForDummyHeater); -#endif - -#else + new LinuxLibgpioIF(objects::GPIO_IF); +#if TE0720 == 0 /* Pin H2-11 on stack connector */ GpioConfig_t gpioConfigHeater0(std::string("gpiochip7"), 18, std::string("Heater0"), Gpio::OUT, 0); @@ -162,10 +148,9 @@ void ObjectFactory::produce(){ std::string("Heater7"), Gpio::OUT, 0); gpioCookie->addGpio(gpioIds::HEATER_7, gpioConfigHeater7); + new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER, + pcduSwitches::TCS_BOARD_8V_HEATER_IN); #endif - new LinuxLibgpioIF(objects::GPIO_IF); - new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER, - pcduSwitches::TCS_BOARD_8V_HEATER_IN); new TmTcUnixUdpBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR, @@ -173,6 +158,17 @@ void ObjectFactory::produce(){ new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); #if TE0720 == 1 && TEST_LIBGPIOD == 1 - new LibgpioTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookie); + /* Configure MIO0 as input */ + GpioConfig_t gpioConfigMio0(std::string("gpiochip0"), 0, + std::string("MIO0"), Gpio::IN, 0); + gpioCookie->addGpio(gpioIds::Test_ID, gpioConfigMio0); + new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookie); +#elif TE0720 == 1 + // Configuration for MIO0 on TE0720-03-1CFA + GpioConfig_t gpioConfigForDummyHeater(std::string("gpiochip0"), 0, + std::string("Heater0"), Gpio::OUT, 0); + gpioCookie->addGpio(gpioIds::HEATER_0, gpioConfigForDummyHeater); + new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER, + pcduSwitches::TCS_BOARD_8V_HEATER_IN); #endif } diff --git a/etl b/etl index 1ac3b77e..ae06e641 160000 --- a/etl +++ b/etl @@ -1 +1 @@ -Subproject commit 1ac3b77ef40aa783024d15185ee8ff41ae04a73e +Subproject commit ae06e6417702b770c49289c9e7162cb3f4a5a217 diff --git a/fsfw b/fsfw index e994d81e..7d0916a4 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit e994d81e1862fade52b090311b3978fb59061966 +Subproject commit 7d0916a44e18c87b00998448333023186b3d85b1 diff --git a/fsfwconfig/OBSWConfig.h b/fsfwconfig/OBSWConfig.h index f5456b4d..6cdf0024 100644 --- a/fsfwconfig/OBSWConfig.h +++ b/fsfwconfig/OBSWConfig.h @@ -7,7 +7,7 @@ #define FSFWCONFIG_OBSWCONFIG_H_ #define TEST_LIBGPIOD 0 -#define ADD_TEST_TAST 1 +#define ADD_TEST_TAST 0 // These defines should be disabled for mission code but are useful for // debugging. diff --git a/test/testtasks/CMakeLists.txt b/test/testtasks/CMakeLists.txt index c1f6beb7..7c2df391 100644 --- a/test/testtasks/CMakeLists.txt +++ b/test/testtasks/CMakeLists.txt @@ -1,5 +1,5 @@ target_sources(${TARGET_NAME} PUBLIC - LibgpioTest.cpp + LibgpiodTest.cpp TestTask.cpp ) diff --git a/test/testtasks/LibgpioTest.cpp b/test/testtasks/LibgpiodTest.cpp similarity index 55% rename from test/testtasks/LibgpioTest.cpp rename to test/testtasks/LibgpiodTest.cpp index 01628f0e..3315f0f6 100644 --- a/test/testtasks/LibgpioTest.cpp +++ b/test/testtasks/LibgpiodTest.cpp @@ -1,33 +1,34 @@ -#include "LibgpioTest.h" +#include "LibgpiodTest.h" + #include "devices/gpioIds.h" #include #include -LibgpioTest::LibgpioTest(object_id_t objectId, object_id_t gpioIfobjectId, GpioCookie* gpioCookie) : +LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId, GpioCookie* gpioCookie) : TestTask(objectId) { gpioInterface = objectManager->get(gpioIfobjectId); if (gpioInterface == nullptr) { - sif::error << "LibgpioTest::LibgpioTest: Invalid Gpio interface." << std::endl; + sif::error << "LibgpiodTest::LibgpiodTest: Invalid Gpio interface." << std::endl; } gpioInterface->initialize(gpioCookie); } -LibgpioTest::~LibgpioTest() { +LibgpiodTest::~LibgpiodTest() { } -ReturnValue_t LibgpioTest::performPeriodicAction() { +ReturnValue_t LibgpiodTest::performPeriodicAction() { int gpioState; ReturnValue_t result; result = gpioInterface->readGpio(gpioIds::Test_ID, &gpioState); if (result != RETURN_OK) { - sif::debug << "LibgpioTest::performPeriodicAction: Failed to read gpio " + sif::debug << "LibgpiodTest::performPeriodicAction: Failed to read gpio " << std::endl; return RETURN_FAILED; } else { - sif::debug << "LibgpioTest::performPeriodicAction: MIO 0 state = " << gpioState + sif::debug << "LibgpiodTest::performPeriodicAction: MIO 0 state = " << gpioState << std::endl; } return RETURN_OK; diff --git a/test/testtasks/LibgpioTest.h b/test/testtasks/LibgpiodTest.h similarity index 54% rename from test/testtasks/LibgpioTest.h rename to test/testtasks/LibgpiodTest.h index 2d670149..c64f25a3 100644 --- a/test/testtasks/LibgpioTest.h +++ b/test/testtasks/LibgpiodTest.h @@ -1,5 +1,5 @@ -#ifndef TEST_TESTTASKS_LIBGPIOTEST_H_ -#define TEST_TESTTASKS_LIBGPIOTEST_H_ +#ifndef TEST_TESTTASKS_LIBGPIODTEST_H_ +#define TEST_TESTTASKS_LIBGPIODTEST_H_ #include "TestTask.h" #include "GpioIF.h" @@ -10,10 +10,10 @@ * @brief Test for the GPIO read implementation of the LinuxLibgpioIF. * @author J. Meier */ -class LibgpioTest: public TestTask { +class LibgpiodTest: public TestTask { public: - LibgpioTest(object_id_t objectId, object_id_t gpioIfobjectId, GpioCookie* gpioCookie); - virtual ~LibgpioTest(); + LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId, GpioCookie* gpioCookie); + virtual ~LibgpiodTest(); protected: virtual ReturnValue_t performPeriodicAction() override; @@ -22,4 +22,4 @@ private: GpioIF* gpioInterface; }; -#endif /* TEST_TESTTASKS_LIBGPIOTEST_H_ */ +#endif /* TEST_TESTTASKS_LIBGPIODTEST_H_ */ diff --git a/tmtc b/tmtc index 4433fb68..110ec964 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 4433fb68ac268ab72f763c2ef80b13d84600ad47 +Subproject commit 110ec9644a520af9c6f4cb7f2b5d47f3d34ba256