restructured objectfactory and init_mission for libgpio test on te0720

This commit is contained in:
Jakob Meier 2021-02-14 11:03:53 +01:00
parent df0e1aa869
commit 88f62c5a11
9 changed files with 40 additions and 52 deletions

View File

@ -137,6 +137,7 @@ void InitMission::initTasks(){
<< std::endl; << std::endl;
} }
#if TE0720 == 0
FixedTimeslotTaskIF* GomSpacePstTask = TaskFactory::instance()-> FixedTimeslotTaskIF* GomSpacePstTask = TaskFactory::instance()->
createFixedTimeslotTask("GS_PST_TASK", 50, createFixedTimeslotTask("GS_PST_TASK", 50,
PeriodicTaskIF::MINIMUM_STACK_SIZE*8, 3.0, nullptr); PeriodicTaskIF::MINIMUM_STACK_SIZE*8, 3.0, nullptr);
@ -145,18 +146,6 @@ void InitMission::initTasks(){
sif::error << "InitMission::initTasks: GomSpace PST initialization " sif::error << "InitMission::initTasks: GomSpace PST initialization "
<< "failed!" << std::endl; << "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 #endif
#if TE0720 == 1 && TEST_LIBGPIOD == 1 #if TE0720 == 1 && TEST_LIBGPIOD == 1
@ -175,7 +164,9 @@ void InitMission::initTasks(){
UdpBridgeTask->startTask(); UdpBridgeTask->startTask();
UdpPollingTask->startTask(); UdpPollingTask->startTask();
#if TE0720 == 0
GomSpacePstTask->startTask(); GomSpacePstTask->startTask();
#endif
PollingSequenceTableTaskDefault->startTask(); PollingSequenceTableTaskDefault->startTask();
PusVerification->startTask(); PusVerification->startTask();

View File

@ -34,7 +34,7 @@
#include <bsp_q7s/gpio/cookies/GpioCookie.h> #include <bsp_q7s/gpio/cookies/GpioCookie.h>
# if TEST_LIBGPIOD == 1 # if TEST_LIBGPIOD == 1
#include "LibgpioTest.h" #include "LibgpiodTest.h"
#endif #endif
void Factory::setStaticFrameworkObjectIds() { void Factory::setStaticFrameworkObjectIds() {
@ -110,23 +110,9 @@ void ObjectFactory::produce(){
i2cCookieTmp1075tcs2); i2cCookieTmp1075tcs2);
tmp1075Handler_2->setStartUpImmediately(); tmp1075Handler_2->setStartUpImmediately();
/* Thermal objects */
GpioCookie* gpioCookie = new GpioCookie; GpioCookie* gpioCookie = new GpioCookie;
#if TE0720 == 1 new LinuxLibgpioIF(objects::GPIO_IF);
#if TE0720 == 0
#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
/* Pin H2-11 on stack connector */ /* Pin H2-11 on stack connector */
GpioConfig_t gpioConfigHeater0(std::string("gpiochip7"), 18, GpioConfig_t gpioConfigHeater0(std::string("gpiochip7"), 18,
std::string("Heater0"), Gpio::OUT, 0); std::string("Heater0"), Gpio::OUT, 0);
@ -162,10 +148,9 @@ void ObjectFactory::produce(){
std::string("Heater7"), Gpio::OUT, 0); std::string("Heater7"), Gpio::OUT, 0);
gpioCookie->addGpio(gpioIds::HEATER_7, gpioConfigHeater7); gpioCookie->addGpio(gpioIds::HEATER_7, gpioConfigHeater7);
#endif
new LinuxLibgpioIF(objects::GPIO_IF);
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER, new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER,
pcduSwitches::TCS_BOARD_8V_HEATER_IN); pcduSwitches::TCS_BOARD_8V_HEATER_IN);
#endif
new TmTcUnixUdpBridge(objects::UDP_BRIDGE, new TmTcUnixUdpBridge(objects::UDP_BRIDGE,
objects::CCSDS_PACKET_DISTRIBUTOR, objects::CCSDS_PACKET_DISTRIBUTOR,
@ -173,6 +158,17 @@ void ObjectFactory::produce(){
new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE);
#if TE0720 == 1 && TEST_LIBGPIOD == 1 #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 #endif
} }

2
etl

@ -1 +1 @@
Subproject commit 1ac3b77ef40aa783024d15185ee8ff41ae04a73e Subproject commit ae06e6417702b770c49289c9e7162cb3f4a5a217

2
fsfw

@ -1 +1 @@
Subproject commit e994d81e1862fade52b090311b3978fb59061966 Subproject commit 7d0916a44e18c87b00998448333023186b3d85b1

View File

@ -7,7 +7,7 @@
#define FSFWCONFIG_OBSWCONFIG_H_ #define FSFWCONFIG_OBSWCONFIG_H_
#define TEST_LIBGPIOD 0 #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 // These defines should be disabled for mission code but are useful for
// debugging. // debugging.

View File

@ -1,5 +1,5 @@
target_sources(${TARGET_NAME} PUBLIC target_sources(${TARGET_NAME} PUBLIC
LibgpioTest.cpp LibgpiodTest.cpp
TestTask.cpp TestTask.cpp
) )

View File

@ -1,33 +1,34 @@
#include "LibgpioTest.h" #include "LibgpiodTest.h"
#include "devices/gpioIds.h" #include "devices/gpioIds.h"
#include <fsfw/serviceinterface/ServiceInterfaceStream.h> #include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <fsfw/objectmanager/ObjectManagerIF.h> #include <fsfw/objectmanager/ObjectManagerIF.h>
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) { TestTask(objectId) {
gpioInterface = objectManager->get<GpioIF>(gpioIfobjectId); gpioInterface = objectManager->get<GpioIF>(gpioIfobjectId);
if (gpioInterface == nullptr) { if (gpioInterface == nullptr) {
sif::error << "LibgpioTest::LibgpioTest: Invalid Gpio interface." << std::endl; sif::error << "LibgpiodTest::LibgpiodTest: Invalid Gpio interface." << std::endl;
} }
gpioInterface->initialize(gpioCookie); gpioInterface->initialize(gpioCookie);
} }
LibgpioTest::~LibgpioTest() { LibgpiodTest::~LibgpiodTest() {
} }
ReturnValue_t LibgpioTest::performPeriodicAction() { ReturnValue_t LibgpiodTest::performPeriodicAction() {
int gpioState; int gpioState;
ReturnValue_t result; ReturnValue_t result;
result = gpioInterface->readGpio(gpioIds::Test_ID, &gpioState); result = gpioInterface->readGpio(gpioIds::Test_ID, &gpioState);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::debug << "LibgpioTest::performPeriodicAction: Failed to read gpio " sif::debug << "LibgpiodTest::performPeriodicAction: Failed to read gpio "
<< std::endl; << std::endl;
return RETURN_FAILED; return RETURN_FAILED;
} }
else { else {
sif::debug << "LibgpioTest::performPeriodicAction: MIO 0 state = " << gpioState sif::debug << "LibgpiodTest::performPeriodicAction: MIO 0 state = " << gpioState
<< std::endl; << std::endl;
} }
return RETURN_OK; return RETURN_OK;

View File

@ -1,5 +1,5 @@
#ifndef TEST_TESTTASKS_LIBGPIOTEST_H_ #ifndef TEST_TESTTASKS_LIBGPIODTEST_H_
#define TEST_TESTTASKS_LIBGPIOTEST_H_ #define TEST_TESTTASKS_LIBGPIODTEST_H_
#include "TestTask.h" #include "TestTask.h"
#include "GpioIF.h" #include "GpioIF.h"
@ -10,10 +10,10 @@
* @brief Test for the GPIO read implementation of the LinuxLibgpioIF. * @brief Test for the GPIO read implementation of the LinuxLibgpioIF.
* @author J. Meier * @author J. Meier
*/ */
class LibgpioTest: public TestTask { class LibgpiodTest: public TestTask {
public: public:
LibgpioTest(object_id_t objectId, object_id_t gpioIfobjectId, GpioCookie* gpioCookie); LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId, GpioCookie* gpioCookie);
virtual ~LibgpioTest(); virtual ~LibgpiodTest();
protected: protected:
virtual ReturnValue_t performPeriodicAction() override; virtual ReturnValue_t performPeriodicAction() override;
@ -22,4 +22,4 @@ private:
GpioIF* gpioInterface; GpioIF* gpioInterface;
}; };
#endif /* TEST_TESTTASKS_LIBGPIOTEST_H_ */ #endif /* TEST_TESTTASKS_LIBGPIODTEST_H_ */

2
tmtc

@ -1 +1 @@
Subproject commit 4433fb68ac268ab72f763c2ef80b13d84600ad47 Subproject commit 110ec9644a520af9c6f4cb7f2b5d47f3d34ba256