better missed deadline handling

This commit is contained in:
2021-02-22 18:46:45 +01:00
committed by Robin Mueller
parent 430cf22973
commit 557a5fa45f
19 changed files with 136 additions and 227 deletions

View File

@ -8,14 +8,9 @@
#include <array>
#include <cstring>
bool TestTask::oneShotAction = true;
MutexIF* TestTask::testLock = nullptr;
TestTask::TestTask(object_id_t objectId_):
SystemObject(objectId_), testMode(testModes::A) {
if(testLock == nullptr) {
testLock = MutexFactory::instance()->createMutex();
}
IPCStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
}
@ -24,19 +19,17 @@ TestTask::~TestTask() {
ReturnValue_t TestTask::performOperation(uint8_t operationCode) {
ReturnValue_t result = RETURN_OK;
sif::info << "Hallo EIVE!" << std::endl;
testLock ->lockMutex(MutexIF::TimeoutType::WAITING, 20);
if(oneShotAction) {
// Add code here which should only be run once
/* Add code here which should only be run once */
performOneShotAction();
oneShotAction = false;
}
testLock->unlockMutex();
// Add code here which should only be run once per performOperation
/* Add code here which should only be run once per performOperation */
performPeriodicAction();
// Add code here which should only be run on alternating cycles.
/* Add code here which should only be run on alternating cycles. */
if(testMode == testModes::A) {
performActionA();
testMode = testModes::B;
@ -49,7 +42,7 @@ ReturnValue_t TestTask::performOperation(uint8_t operationCode) {
}
ReturnValue_t TestTask::performOneShotAction() {
// Everything here will only be performed once.
/* Everything here will only be performed once. */
return HasReturnvaluesIF::RETURN_OK;
}
@ -61,12 +54,12 @@ ReturnValue_t TestTask::performPeriodicAction() {
ReturnValue_t TestTask::performActionA() {
ReturnValue_t result = RETURN_OK;
// Add periodically executed code here
/* Add periodically executed code here */
return result;
}
ReturnValue_t TestTask::performActionB() {
ReturnValue_t result = RETURN_OK;
// Add periodically executed code here
/* Add periodically executed code here */
return result;
}