diff --git a/config/commonSubsystemIds.h b/config/commonSubsystemIds.h index a26a03d..1c9d682 100644 --- a/config/commonSubsystemIds.h +++ b/config/commonSubsystemIds.h @@ -9,6 +9,7 @@ namespace SUBSYSTEM_ID { enum commonSubsystemId: uint8_t { COMMON_SUBSYSTEM_ID_START = FW_SUBSYSTEM_ID_RANGE, + TEST_TASK_ID = 105, COMMON_SUBSYSTEM_ID_END }; } diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index cd9ae5e..188a90f 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -76,10 +76,9 @@ void ObjectFactory::produceGenericObjects() { new FsfwExampleTask(objects::TEST_DUMMY_3); -#if OBSW_TASK_EXAMPLE_PRINTOUT == 1 - bool enablePrintout = true; -#else bool enablePrintout = false; +#if OBSW_TASK_EXAMPLE_PRINTOUT == 1 + enablePrintout = true; #endif new FsfwReaderTask(objects::TEST_DUMMY_4, enablePrintout); #endif /* OBSW_ADD_TASK_EXAMPLE == 1 */ diff --git a/test/TestTask.cpp b/test/TestTask.cpp index cb1a79d..c9910e9 100644 --- a/test/TestTask.cpp +++ b/test/TestTask.cpp @@ -6,9 +6,9 @@ bool TestTask::oneShotAction = true; MutexIF* TestTask::testLock = nullptr; -TestTask::TestTask(object_id_t objectId, bool periodicPrintout): +TestTask::TestTask(object_id_t objectId, bool periodicPrintout, bool periodicEvent): SystemObject(objectId), testMode(testModes::A), - periodicPrinout(periodicPrintout) { + periodicPrinout(periodicPrintout), periodicEvent(periodicEvent) { if(testLock == nullptr) { testLock = MutexFactory::instance()->createMutex(); } @@ -60,6 +60,9 @@ ReturnValue_t TestTask::performPeriodicAction() { sif::printInfo("TestTask::performPeriodicAction: Hello World!\n"); #endif } + if(periodicEvent) { + triggerEvent(TEST_EVENT, 0x1234, 0x4321); + } return result; } diff --git a/test/TestTask.h b/test/TestTask.h index 375c0d5..95f27be 100644 --- a/test/TestTask.h +++ b/test/TestTask.h @@ -5,6 +5,8 @@ #include #include +#include "fsfw/events/Event.h" +#include "events/subsystemIdRanges.h" /** * @brief Test class for general C++ testing and any other code which will not be part of the @@ -17,10 +19,13 @@ class TestTask : public ExecutableObjectIF, public HasReturnvaluesIF { public: - TestTask(object_id_t objectId, bool periodicPrintout); + TestTask(object_id_t objectId, bool periodicPrintout = false, bool periodicEvent = false); virtual ~TestTask(); virtual ReturnValue_t performOperation(uint8_t operationCode = 0); + static constexpr uint8_t subsystemId = SUBSYSTEM_ID::TEST_TASK_ID; + static constexpr Event TEST_EVENT = event::makeEvent(subsystemId, 0, severity::INFO); + protected: virtual ReturnValue_t performOneShotAction(); virtual ReturnValue_t performPeriodicAction(); @@ -34,6 +39,7 @@ protected: testModes testMode; bool periodicPrinout = false; + bool periodicEvent = false; bool testFlag = false; uint8_t counter { 1 };