added periodic event

This commit is contained in:
Robin Müller 2021-06-30 09:59:55 +02:00
parent edaccc0dbd
commit 112adcbb64
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
4 changed files with 15 additions and 6 deletions

View File

@ -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
};
}

View File

@ -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 */

View File

@ -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;
}

View File

@ -5,6 +5,8 @@
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/storagemanager/StorageManagerIF.h>
#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 };