2020-12-29 13:59:31 +01:00
|
|
|
#include "InitMission.h"
|
|
|
|
#include "ObjectFactory.h"
|
2021-05-17 20:03:56 +02:00
|
|
|
#include "OBSWConfig.h"
|
|
|
|
#include "pollingsequence/pollingSequenceFactory.h"
|
2020-09-30 17:17:01 +02:00
|
|
|
|
2021-07-19 13:15:45 +02:00
|
|
|
#include "mission/utility/InitMission.h"
|
2021-03-05 12:57:42 +01:00
|
|
|
|
2021-07-19 13:15:45 +02:00
|
|
|
#include "fsfw/platform.h"
|
|
|
|
#include "fsfw/objectmanager/ObjectManagerIF.h"
|
|
|
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
|
|
|
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
|
|
|
|
#include "fsfw/objectmanager/ObjectManager.h"
|
|
|
|
#include "fsfw/tasks/FixedTimeslotTaskIF.h"
|
|
|
|
#include "fsfw/tasks/PeriodicTaskIF.h"
|
|
|
|
#include "fsfw/tasks/TaskFactory.h"
|
2021-05-17 20:03:56 +02:00
|
|
|
|
2020-09-30 17:17:01 +02:00
|
|
|
#include <iostream>
|
2021-07-19 13:15:45 +02:00
|
|
|
#include <vector>
|
2020-09-30 17:17:01 +02:00
|
|
|
|
2021-03-05 12:57:42 +01:00
|
|
|
/* This is configured for linux without CR */
|
2021-07-19 13:15:45 +02:00
|
|
|
#ifdef PLATFORM_UNIX
|
2020-09-30 21:07:30 +02:00
|
|
|
ServiceInterfaceStream sif::debug("DEBUG");
|
|
|
|
ServiceInterfaceStream sif::info("INFO");
|
|
|
|
ServiceInterfaceStream sif::warning("WARNING");
|
2020-09-30 17:17:01 +02:00
|
|
|
ServiceInterfaceStream sif::error("ERROR", false, false, true);
|
2020-09-30 21:07:30 +02:00
|
|
|
#else
|
|
|
|
ServiceInterfaceStream sif::debug("DEBUG", true);
|
|
|
|
ServiceInterfaceStream sif::info("INFO", true);
|
|
|
|
ServiceInterfaceStream sif::warning("WARNING", true);
|
|
|
|
ServiceInterfaceStream sif::error("ERROR", true, false, true);
|
|
|
|
#endif
|
2020-09-30 17:17:01 +02:00
|
|
|
|
|
|
|
ObjectManagerIF *objectManager = nullptr;
|
|
|
|
|
2021-03-05 12:57:42 +01:00
|
|
|
void initmission::initMission() {
|
2021-06-12 15:45:24 +02:00
|
|
|
|
2021-03-05 12:57:42 +01:00
|
|
|
sif::info << "Building global objects.." << std::endl;
|
|
|
|
/* Instantiate global object manager and also create all objects */
|
2021-06-08 16:45:25 +02:00
|
|
|
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
|
2020-09-30 17:17:01 +02:00
|
|
|
sif::info << "Initializing all objects.." << std::endl;
|
2021-06-08 16:45:25 +02:00
|
|
|
ObjectManager::instance()->initialize();
|
2020-09-30 17:17:01 +02:00
|
|
|
|
|
|
|
/* This function creates and starts all tasks */
|
|
|
|
initTasks();
|
|
|
|
}
|
|
|
|
|
2021-03-05 12:57:42 +01:00
|
|
|
void initmission::initTasks() {
|
|
|
|
TaskFactory* factory = TaskFactory::instance();
|
2021-07-08 12:11:24 +02:00
|
|
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
2021-03-05 12:57:42 +01:00
|
|
|
if(factory == nullptr) {
|
|
|
|
/* Should never happen ! */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#if OBSW_PRINT_MISSED_DEADLINES == 1
|
|
|
|
void (*missedDeadlineFunc) (void) = TaskFactory::printMissedDeadline;
|
|
|
|
#else
|
|
|
|
void (*missedDeadlineFunc) (void) = nullptr;
|
|
|
|
#endif
|
|
|
|
|
2021-08-17 16:14:23 +02:00
|
|
|
#if BOARD_TE0720 == 0
|
2021-07-08 12:11:24 +02:00
|
|
|
PeriodicTaskIF* coreController = factory->createPeriodicTask(
|
|
|
|
"CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
|
|
|
|
result = coreController->addComponent(objects::CORE_CONTROLLER);
|
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
initmission::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
|
|
|
|
}
|
2021-08-17 16:14:23 +02:00
|
|
|
#endif
|
2021-07-08 12:11:24 +02:00
|
|
|
|
2021-03-05 12:57:42 +01:00
|
|
|
/* TMTC Distribution */
|
|
|
|
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
|
|
|
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
2021-07-08 12:11:24 +02:00
|
|
|
result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
|
2021-03-05 12:57:42 +01:00
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
initmission::printAddObjectError("CCSDS_DISTRIB", objects::CCSDS_PACKET_DISTRIBUTOR);
|
|
|
|
}
|
|
|
|
result = tmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
initmission::printAddObjectError("PUS_PACKET_DISTRIB", objects::PUS_PACKET_DISTRIBUTOR);
|
|
|
|
}
|
|
|
|
result = tmTcDistributor->addComponent(objects::TM_FUNNEL);
|
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
initmission::printAddObjectError("TM_FUNNEL", objects::TM_FUNNEL);
|
|
|
|
}
|
|
|
|
|
2021-09-28 14:58:12 +02:00
|
|
|
#if OBSW_ADD_TCPIP_BRIDGE == 1
|
|
|
|
// TMTC bridge
|
2021-07-26 11:33:38 +02:00
|
|
|
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
2021-09-28 14:58:12 +02:00
|
|
|
"TCPIP_TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
2021-07-26 11:33:38 +02:00
|
|
|
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
2021-03-05 12:57:42 +01:00
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
2021-07-26 11:33:38 +02:00
|
|
|
initmission::printAddObjectError("UDP_BRIDGE", objects::TMTC_BRIDGE);
|
2021-03-05 12:57:42 +01:00
|
|
|
}
|
2021-07-26 11:33:38 +02:00
|
|
|
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
2021-09-28 14:58:12 +02:00
|
|
|
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
2021-07-26 11:33:38 +02:00
|
|
|
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
2021-03-05 12:57:42 +01:00
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
2021-07-26 11:33:38 +02:00
|
|
|
initmission::printAddObjectError("UDP_POLLING", objects::TMTC_POLLING_TASK);
|
2021-03-05 12:57:42 +01:00
|
|
|
}
|
2021-09-28 14:58:12 +02:00
|
|
|
#endif
|
2021-03-05 12:57:42 +01:00
|
|
|
|
2021-10-04 14:47:32 +02:00
|
|
|
#if OBSW_USE_CCSDS_IP_CORE == 1
|
2021-09-29 14:47:20 +02:00
|
|
|
PeriodicTaskIF* ccsdsHandlerTask = factory->createPeriodicTask(
|
2021-11-01 12:41:20 +01:00
|
|
|
"CCSDS_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
2021-09-29 14:47:20 +02:00
|
|
|
result = ccsdsHandlerTask->addComponent(objects::CCSDS_HANDLER);
|
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
initmission::printAddObjectError("CCSDS Handler", objects::CCSDS_HANDLER);
|
|
|
|
}
|
2021-11-01 12:41:20 +01:00
|
|
|
|
|
|
|
// Minimal distance between two received TCs amounts to 0.6 seconds
|
|
|
|
// If a command has not been read before the next one arrives, the old command will be
|
|
|
|
// overwritten by the PDEC.
|
|
|
|
PeriodicTaskIF* pdecHandlerTask = factory->createPeriodicTask(
|
2021-11-24 15:55:25 +01:00
|
|
|
"PDEC_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
|
2021-11-01 12:41:20 +01:00
|
|
|
result = pdecHandlerTask->addComponent(objects::PDEC_HANDLER);
|
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
initmission::printAddObjectError("PDEC Handler", objects::PDEC_HANDLER);
|
|
|
|
}
|
2021-10-04 14:47:32 +02:00
|
|
|
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
2021-09-29 14:47:20 +02:00
|
|
|
|
2021-08-17 16:14:23 +02:00
|
|
|
# if BOARD_TE0720 == 0
|
2021-07-19 14:02:17 +02:00
|
|
|
// FS task, task interval does not matter because it runs in permanent loop, priority low
|
|
|
|
// because it is a non-essential background task
|
|
|
|
PeriodicTaskIF* fsTask = factory->createPeriodicTask(
|
|
|
|
"FILE_SYSTEM_TASK", 25, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
|
|
|
|
result = fsTask->addComponent(objects::FILE_SYSTEM_HANDLER);
|
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::FILE_SYSTEM_HANDLER);
|
|
|
|
}
|
2021-12-06 19:36:21 +01:00
|
|
|
|
|
|
|
PeriodicTaskIF* strImgLoaderTask = factory->createPeriodicTask(
|
|
|
|
"FILE_SYSTEM_TASK", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
|
|
|
result = strImgLoaderTask->addComponent(objects::STR_IMG_LOADER);
|
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::STR_IMG_LOADER);
|
|
|
|
}
|
2021-08-17 16:14:23 +02:00
|
|
|
#endif /* BOARD_TE0720 */
|
2021-07-19 14:02:17 +02:00
|
|
|
|
2021-08-17 17:48:51 +02:00
|
|
|
#if OBSW_TEST_CCSDS_BRIDGE == 1
|
2021-05-16 19:22:04 +02:00
|
|
|
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
|
|
|
|
"PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
|
|
|
result = ptmeTestTask->addComponent(objects::CCSDS_IP_CORE_BRIDGE);
|
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
initmission::printAddObjectError("PTME_TEST", objects::CCSDS_IP_CORE_BRIDGE);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-07-19 13:15:45 +02:00
|
|
|
std::vector<PeriodicTaskIF*> pusTasks;
|
|
|
|
createPusTasks(*factory, missedDeadlineFunc, pusTasks);
|
|
|
|
std::vector<PeriodicTaskIF*> pstTasks;
|
|
|
|
createPstTasks(*factory, missedDeadlineFunc, pstTasks);
|
2021-08-20 14:48:22 +02:00
|
|
|
|
2021-09-13 18:07:07 +02:00
|
|
|
#if OBSW_ADD_TEST_CODE == 1
|
2021-07-19 13:15:45 +02:00
|
|
|
std::vector<PeriodicTaskIF*> testTasks;
|
|
|
|
createTestTasks(*factory, missedDeadlineFunc, testTasks);
|
2021-08-20 14:48:22 +02:00
|
|
|
#endif
|
2021-07-19 13:15:45 +02:00
|
|
|
|
|
|
|
auto taskStarter = [](std::vector<PeriodicTaskIF*>& taskVector, std::string name) {
|
|
|
|
for(const auto& task: taskVector) {
|
|
|
|
if(task != nullptr) {
|
|
|
|
task->startTask();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sif::error << "Task in vector " << name << " is invalid!" << std::endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
sif::info << "Starting tasks.." << std::endl;
|
|
|
|
tmTcDistributor->startTask();
|
2021-09-28 14:58:12 +02:00
|
|
|
|
|
|
|
#if OBSW_ADD_TCPIP_BRIDGE == 1
|
2021-07-26 11:33:38 +02:00
|
|
|
tmtcBridgeTask->startTask();
|
|
|
|
tmtcPollingTask->startTask();
|
2021-09-28 14:58:12 +02:00
|
|
|
#endif
|
2021-10-04 14:47:32 +02:00
|
|
|
|
|
|
|
#if OBSW_USE_CCSDS_IP_CORE == 1
|
2021-09-29 14:47:20 +02:00
|
|
|
ccsdsHandlerTask->startTask();
|
2021-11-01 12:41:20 +01:00
|
|
|
pdecHandlerTask->startTask();
|
2021-10-04 14:47:32 +02:00
|
|
|
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
|
|
|
|
2021-08-17 16:14:23 +02:00
|
|
|
#if BOARD_TE0720 == 0
|
2021-07-19 13:15:45 +02:00
|
|
|
coreController->startTask();
|
2021-08-17 16:14:23 +02:00
|
|
|
#endif
|
2021-07-19 13:15:45 +02:00
|
|
|
|
|
|
|
taskStarter(pstTasks, "PST task vector");
|
|
|
|
taskStarter(pusTasks, "PUS task vector");
|
2021-09-13 18:07:07 +02:00
|
|
|
#if OBSW_ADD_TEST_CODE == 1
|
2021-07-19 13:15:45 +02:00
|
|
|
taskStarter(testTasks, "Test task vector");
|
|
|
|
#endif
|
|
|
|
|
2021-08-17 17:48:51 +02:00
|
|
|
#if OBSW_TEST_CCSDS_BRIDGE == 1
|
2021-07-19 13:15:45 +02:00
|
|
|
ptmeTestTask->startTask();
|
|
|
|
#endif
|
2021-08-17 16:14:23 +02:00
|
|
|
|
|
|
|
#if BOARD_TE0720 == 0
|
2021-07-19 14:02:17 +02:00
|
|
|
fsTask->startTask();
|
2021-12-06 19:36:21 +01:00
|
|
|
strImgLoaderTask->startTask();
|
2021-08-17 16:14:23 +02:00
|
|
|
#endif
|
2021-07-19 14:02:17 +02:00
|
|
|
|
2021-07-19 13:15:45 +02:00
|
|
|
sif::info << "Tasks started.." << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void initmission::createPstTasks(TaskFactory& factory,
|
|
|
|
TaskDeadlineMissedFunction missedDeadlineFunc, std::vector<PeriodicTaskIF*> &taskVec) {
|
|
|
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
|
|
|
#if BOARD_TE0720 == 0
|
|
|
|
/* Polling Sequence Table Default */
|
2021-09-15 17:38:26 +02:00
|
|
|
#if OBSW_ADD_SPI_TEST_CODE == 0
|
2021-07-19 13:15:45 +02:00
|
|
|
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
|
|
|
"PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0,
|
|
|
|
missedDeadlineFunc);
|
|
|
|
result = pst::pstSpi(spiPst);
|
|
|
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
2021-09-23 17:34:01 +02:00
|
|
|
if(result != FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
|
|
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
taskVec.push_back(spiPst);
|
2021-07-19 13:15:45 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
FixedTimeslotTaskIF* uartPst = factory.createFixedTimeslotTask(
|
|
|
|
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc);
|
|
|
|
result = pst::pstUart(uartPst);
|
|
|
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
|
|
|
}
|
|
|
|
taskVec.push_back(uartPst);
|
|
|
|
FixedTimeslotTaskIF* gpioPst = factory.createFixedTimeslotTask(
|
|
|
|
"GPIO_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc);
|
|
|
|
result = pst::pstGpio(gpioPst);
|
|
|
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
|
|
|
}
|
|
|
|
taskVec.push_back(gpioPst);
|
|
|
|
FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask(
|
|
|
|
"I2C_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc);
|
|
|
|
result = pst::pstI2c(i2cPst);
|
|
|
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
FixedTimeslotTaskIF* gomSpacePstTask = factory.createFixedTimeslotTask(
|
|
|
|
"GS_PST_TASK", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
|
|
|
|
result = pst::pstGompaceCan(gomSpacePstTask);
|
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
sif::error << "InitMission::initTasks: GomSpace PST initialization failed!" << std::endl;
|
|
|
|
}
|
2021-08-17 11:59:32 +02:00
|
|
|
taskVec.push_back(gomSpacePstTask);
|
2021-07-19 13:15:45 +02:00
|
|
|
#else /* BOARD_TE7020 == 0 */
|
2021-08-17 16:14:23 +02:00
|
|
|
FixedTimeslotTaskIF * pollingSequenceTaskTE0720 = factory.createFixedTimeslotTask(
|
2021-07-19 13:15:45 +02:00
|
|
|
"PST_TASK_TE0720", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE * 8, 3.0,
|
|
|
|
missedDeadlineFunc);
|
|
|
|
result = pst::pollingSequenceTE0720(pollingSequenceTaskTE0720);
|
|
|
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
sif::error << "InitMission::initTasks: Creating TE0720 PST failed!" << std::endl;
|
|
|
|
}
|
|
|
|
taskVec.push_back(pollingSequenceTaskTE0720);
|
|
|
|
#endif /* BOARD_TE7020 == 1 */
|
|
|
|
}
|
|
|
|
|
|
|
|
void initmission::createPusTasks(TaskFactory &factory,
|
|
|
|
TaskDeadlineMissedFunction missedDeadlineFunc, std::vector<PeriodicTaskIF*> &taskVec) {
|
|
|
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
2021-03-05 12:57:42 +01:00
|
|
|
/* PUS Services */
|
2021-07-19 13:15:45 +02:00
|
|
|
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
2021-03-05 12:57:42 +01:00
|
|
|
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
|
|
|
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
initmission::printAddObjectError("PUS_VERIF", objects::PUS_SERVICE_1_VERIFICATION);
|
|
|
|
}
|
2021-07-19 13:15:45 +02:00
|
|
|
taskVec.push_back(pusVerification);
|
2021-03-05 12:57:42 +01:00
|
|
|
|
2021-07-19 13:15:45 +02:00
|
|
|
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
|
2021-03-05 12:57:42 +01:00
|
|
|
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
2021-06-29 16:09:32 +02:00
|
|
|
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
2021-03-05 12:57:42 +01:00
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
|
|
|
}
|
2021-06-29 16:09:32 +02:00
|
|
|
result = pusEvents->addComponent(objects::EVENT_MANAGER);
|
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
|
|
|
|
}
|
2021-07-19 13:15:45 +02:00
|
|
|
taskVec.push_back(pusEvents);
|
2021-03-05 12:57:42 +01:00
|
|
|
|
2021-07-19 13:15:45 +02:00
|
|
|
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
|
2021-03-05 12:57:42 +01:00
|
|
|
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
|
|
|
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
initmission::printAddObjectError("PUS_2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
|
|
|
}
|
|
|
|
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
|
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
initmission::printAddObjectError("PUS_9", objects::PUS_SERVICE_9_TIME_MGMT);
|
|
|
|
}
|
2021-07-19 13:15:45 +02:00
|
|
|
taskVec.push_back(pusHighPrio);
|
2021-03-05 12:57:42 +01:00
|
|
|
|
2021-07-19 13:15:45 +02:00
|
|
|
PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
|
2021-03-05 12:57:42 +01:00
|
|
|
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
|
|
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
initmission::printAddObjectError("PUS_8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
|
|
|
}
|
|
|
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
|
|
|
|
if(result!=HasReturnvaluesIF::RETURN_OK){
|
|
|
|
sif::error << "Object add component failed" << std::endl;
|
|
|
|
}
|
|
|
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
|
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
initmission::printAddObjectError("PUS_200", objects::PUS_SERVICE_200_MODE_MGMT);
|
|
|
|
}
|
|
|
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
initmission::printAddObjectError("PUS_20", objects::PUS_SERVICE_20_PARAMETERS);
|
|
|
|
}
|
2021-07-19 13:15:45 +02:00
|
|
|
taskVec.push_back(pusMedPrio);
|
2021-03-05 12:57:42 +01:00
|
|
|
|
2021-07-19 13:15:45 +02:00
|
|
|
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
|
2021-03-05 12:57:42 +01:00
|
|
|
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
|
|
|
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
initmission::printAddObjectError("PUS_17", objects::PUS_SERVICE_17_TEST);
|
|
|
|
}
|
2021-06-23 15:18:31 +02:00
|
|
|
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
|
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
initmission::printAddObjectError("ERROR_REPORTER", objects::INTERNAL_ERROR_REPORTER);
|
|
|
|
}
|
2021-07-19 13:15:45 +02:00
|
|
|
taskVec.push_back(pusLowPrio);
|
|
|
|
}
|
2021-03-05 12:57:42 +01:00
|
|
|
|
2021-07-19 13:15:45 +02:00
|
|
|
void initmission::createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
|
|
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
2021-09-20 18:46:48 +02:00
|
|
|
#if OBSW_ADD_TEST_TASK == 1 || OBSW_ADD_SPI_TEST_CODE == 1 || (BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1)
|
2021-07-19 13:15:45 +02:00
|
|
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
2021-09-20 18:46:48 +02:00
|
|
|
#endif
|
2021-07-19 13:15:45 +02:00
|
|
|
PeriodicTaskIF* testTask = factory.createPeriodicTask(
|
2021-04-02 15:14:08 +02:00
|
|
|
"TEST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc);
|
2021-09-20 16:30:50 +02:00
|
|
|
#if OBSW_ADD_TEST_TASK == 1
|
2021-03-05 12:57:42 +01:00
|
|
|
result = testTask->addComponent(objects::TEST_TASK);
|
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
|
|
|
}
|
2021-09-20 16:30:50 +02:00
|
|
|
#endif /* OBSW_ADD_TEST_TASK == 1 */
|
2021-04-02 15:14:08 +02:00
|
|
|
|
2021-09-15 17:38:26 +02:00
|
|
|
#if OBSW_ADD_SPI_TEST_CODE == 1
|
2021-04-02 15:14:08 +02:00
|
|
|
result = testTask->addComponent(objects::SPI_TEST);
|
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
|
|
|
|
}
|
|
|
|
#endif
|
2021-08-17 17:48:51 +02:00
|
|
|
#if BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1
|
2021-03-05 12:57:42 +01:00
|
|
|
result = testTask->addComponent(objects::LIBGPIOD_TEST);
|
|
|
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST);
|
2021-02-14 09:25:40 +01:00
|
|
|
}
|
2021-08-17 17:48:51 +02:00
|
|
|
#endif /* BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1 */
|
2021-07-19 13:15:45 +02:00
|
|
|
taskVec.push_back(testTask);
|
2020-09-30 17:17:01 +02:00
|
|
|
}
|