Thread Tracing and Scheduling Update #379

Merged
muellerr merged 11 commits from thread_tracing into develop 2023-02-14 15:59:12 +01:00
28 changed files with 167 additions and 88 deletions

View File

@ -19,8 +19,17 @@ change warranting a new major release:
## Changed
- Remove 2 TCS threads.
- Move low level polling into ACS PST, move high level device handlers into TCS system task.
- Remove 2 TCS threads. Move low level polling into ACS PST, move high level device handlers into
TCS system task.
- Further reduce number of threads:
1. Remove PUS low priority task, move assigned threads to the generic system task
2. Group events and verification tasks into PUS high priority task
3. Group all other components into PUS medium priority task
4. Add SCEX device handler to PL task, remove dedicated thread
## Added
- Tracing supports which allows checking whether threads are running as usual.
## Removed

View File

@ -490,8 +490,8 @@ endif()
# ##############################################################################
# Add libraries
target_link_libraries(${LIB_EIVE_MISSION}
PUBLIC ${LIB_FSFW_NAME} ${LIB_OS_NAME})
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_FSFW_NAME}
${LIB_OS_NAME})
target_link_libraries(${LIB_DUMMIES} PUBLIC ${LIB_FSFW_NAME} ${LIB_JSON_NAME})

View File

@ -63,6 +63,9 @@ ReturnValue_t CoreController::handleCommandMessage(CommandMessage *message) {
}
void CoreController::performControlOperation() {
#if OBSW_THREAD_TRACING == 1
trace::threadTrace(opCounter, "CORE CTRL");
#endif
EventMessage event;
for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == returnvalue::OK;
result = eventQueue->receiveMessage(&event)) {

View File

@ -12,6 +12,7 @@
#include "events/subsystemIdRanges.h"
#include "fsfw/controller/ExtendedControllerBase.h"
#include "mission/devices/devicedefinitions/GPSDefinitions.h"
#include "mission/trace.h"
class Timer;
class SdCardManager;
@ -222,6 +223,9 @@ class CoreController : public ExtendedControllerBase {
std::string currMntPrefix;
bool performOneShotSdCardOpsSwitch = false;
uint8_t shortSdCardCdCounter = 0;
#if OBSW_THREAD_TRACING == 1
uint32_t opCounter;
#endif
Countdown sdCardCheckCd = Countdown(INIT_SD_CARD_CHECK_TIMEOUT);
/**

View File

@ -154,6 +154,14 @@ void scheduling::initTasks() {
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PL_SUBSYSTEM", objects::PL_SUBSYSTEM);
}
result = genericSysTask->addComponent(objects::INTERNAL_ERROR_REPORTER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("ERROR_REPORTER", objects::INTERNAL_ERROR_REPORTER);
}
result = genericSysTask->addComponent(objects::PUS_SERVICE_17_TEST);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS_17", objects::PUS_SERVICE_17_TEST);
}
#if OBSW_ADD_CCSDS_IP_CORES == 1
result = genericSysTask->addComponent(objects::CCSDS_HANDLER);
@ -266,14 +274,16 @@ void scheduling::initTasks() {
#endif /* OBSW_ADD_PLOC_SUPERVISOR */
PeriodicTaskIF* plTask = factory->createPeriodicTask(
"PL_TASK", 25, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
scheduling::addMpsocSupvHandlers(plTask);
"PL_TASK", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
plTask->addComponent(objects::CAM_SWITCHER);
scheduling::addMpsocSupvHandlers(plTask);
#if OBSW_ADD_SCEX_DEVICE == 1
scheduling::scheduleScexDev(plTask);
#endif
#if OBSW_ADD_SCEX_DEVICE == 1
PeriodicTaskIF* scexDevHandler;
PeriodicTaskIF* scexReaderTask;
scheduling::schedulingScex(*factory, scexDevHandler, scexReaderTask);
scheduling::scheduleScexReader(*factory, scexReaderTask);
#endif
std::vector<PeriodicTaskIF*> pusTasks;
@ -330,7 +340,6 @@ void scheduling::initTasks() {
taskStarter(pstTasks, "PST task vector");
taskStarter(pusTasks, "PUS task vector");
#if OBSW_ADD_SCEX_DEVICE == 1
scexDevHandler->startTask();
scexReaderTask->startTask();
#endif
@ -374,9 +383,9 @@ void scheduling::createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction
#else
static constexpr float acsPstPeriod = 0.8;
#endif
FixedTimeslotTaskIF* acsPst = factory.createFixedTimeslotTask(
"ACS_PST", 85, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, acsPstPeriod, missedDeadlineFunc);
result = pst::pstTcsAndAcs(acsPst, cfg);
FixedTimeslotTaskIF* acsTcsPst = factory.createFixedTimeslotTask(
"ACS_TCS_PST", 85, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, acsPstPeriod, missedDeadlineFunc);
result = pst::pstTcsAndAcs(acsTcsPst, cfg);
if (result != returnvalue::OK) {
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::warning << "scheduling::initTasks: ACS PST is empty" << std::endl;
@ -384,7 +393,7 @@ void scheduling::createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction
sif::error << "scheduling::initTasks: Creating ACS PST failed!" << std::endl;
}
} else {
taskVec.push_back(acsPst);
taskVec.push_back(acsTcsPst);
}
/* Polling Sequence Table Default */
@ -435,42 +444,28 @@ void scheduling::createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction
std::vector<PeriodicTaskIF*>& taskVec) {
ReturnValue_t result = returnvalue::OK;
/* PUS Services */
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
"PUS_HIGH_PRIO", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = pusHighPrio->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS_VERIF", objects::PUS_SERVICE_1_VERIFICATION);
}
taskVec.push_back(pusVerification);
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
result = pusHighPrio->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
}
result = pusEvents->addComponent(objects::EVENT_MANAGER);
result = pusHighPrio->addComponent(objects::EVENT_MANAGER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
}
taskVec.push_back(pusEvents);
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS_2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
}
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS_9", objects::PUS_SERVICE_9_TIME_MGMT);
}
taskVec.push_back(pusHighPrio);
PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS_3", objects::PUS_SERVICE_3_HOUSEKEEPING);
@ -495,20 +490,11 @@ void scheduling::createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS_201", objects::PUS_SERVICE_201_HEALTH);
}
// Used for connection tests, therefore use higher priority
result = pusMedPrio->addComponent(objects::PUS_SERVICE_17_TEST);
result = pusMedPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS_17", objects::PUS_SERVICE_17_TEST);
scheduling::printAddObjectError("PUS_2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
}
taskVec.push_back(pusMedPrio);
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("ERROR_REPORTER", objects::INTERNAL_ERROR_REPORTER);
}
taskVec.push_back(pusLowPrio);
}
void scheduling::createTestTasks(TaskFactory& factory,

2
fsfw

@ -1 +1 @@
Subproject commit d256ede8c1d8e7a746d3a56d45313d2b863e0b28
Subproject commit 9de6c4b3aa20ee63c28051d486be8a12df147f22

View File

@ -59,7 +59,7 @@ class UartTestClass : public TestTask {
DleEncoder dleEncoder = DleEncoder();
SerialCookie* uartCookie = nullptr;
size_t encodedLen = 0;
//lwgps_t gpsData = {};
// lwgps_t gpsData = {};
struct termios tty = {};
int serialPort = 0;
bool startFound = false;

View File

@ -102,6 +102,9 @@ ReturnValue_t GpsHyperionLinuxController::performOperation(uint8_t opCode) {
handleQueue();
poolManager.performHkOperation();
while (true) {
#if OBSW_THREAD_TRACING == 1
trace::threadTrace(opCounter, "GPS CTRL");
#endif
bool callAgainImmediately = readGpsDataFromGpsd();
if (not callAgainImmediately) {
handleQueue();

View File

@ -6,6 +6,7 @@
#include "fsfw/controller/ExtendedControllerBase.h"
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
#include "mission/devices/devicedefinitions/GPSDefinitions.h"
#include "mission/trace.h"
#ifdef FSFW_OSAL_LINUX
#include <gps.h>
@ -60,6 +61,9 @@ class GpsHyperionLinuxController : public ExtendedControllerBase {
Countdown maxTimeToReachFix = Countdown(MAX_SECONDS_TO_REACH_FIX * 1000);
bool modeCommanded = false;
bool timeInit = false;
#if OBSW_THREAD_TRACING == 1
uint32_t opCounter = 0;
#endif
struct OneShotSwitches {
void reset() {

View File

@ -3,7 +3,6 @@
#include <filesystem>
#include <fstream>
#include "OBSWConfig.h"
#ifdef XIPHOS_Q7S
#include "bsp_q7s/fs/FilesystemHelper.h"
#endif
@ -34,6 +33,9 @@ ReturnValue_t PlocMPSoCHelper::performOperation(uint8_t operationCode) {
ReturnValue_t result = returnvalue::OK;
semaphore.acquire();
while (true) {
#if OBSW_THREAD_TRACING == 1
trace::threadTrace(opCounter, "PLOC MPSOC Helper");
#endif
switch (internalState) {
case InternalState::IDLE: {
semaphore.acquire();

View File

@ -11,6 +11,7 @@
#include "fsfw/tmtcservices/SourceSequenceCounter.h"
#include "fsfw_hal/linux/serial/SerialComIF.h"
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
#include "mission/trace.h"
#ifdef XIPHOS_Q7S
#include "bsp_q7s/fs/SdCardManager.h"
#endif
@ -116,6 +117,10 @@ class PlocMPSoCHelper : public SystemObject, public ExecutableObjectIF {
struct FlashWrite flashWrite;
#if OBSW_THREAD_TRACING == 1
uint32_t opCounter = 0;
#endif
enum class InternalState { IDLE, FLASH_WRITE, FLASH_READ };
InternalState internalState = InternalState::IDLE;

View File

@ -101,6 +101,9 @@ ReturnValue_t PlocSupvUartManager::performOperation(uint8_t operationCode) {
lock->unlockMutex();
semaphore->acquire();
putTaskToSleep = false;
#if OBSW_THREAD_TRACING == 1
trace::threadTrace(opCounter, "PLOC SUPV Helper PST");
#endif
while (true) {
if (putTaskToSleep) {
performUartShutdown();

View File

@ -15,6 +15,7 @@
#include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw_hal/linux/serial/SerialComIF.h"
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
#include "mission/trace.h"
#include "tas/crc.h"
#ifdef XIPHOS_Q7S
@ -211,6 +212,9 @@ class PlocSupvUartManager : public DeviceCommunicationIF,
supv::TmBase tmReader;
int serialPort = 0;
struct termios tty = {};
#if OBSW_THREAD_TRACING == 1
uint32_t opCounter = 0;
#endif
struct EventBufferRequest {
std::string path = "";

View File

@ -5,6 +5,7 @@
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
#include "OBSWConfig.h"
#include "eive/definitions.h"
#include "mission/devices/devicedefinitions/Max31865Definitions.h"

View File

@ -8,8 +8,7 @@
#include "ObjectFactory.h"
#include "eive/objects.h"
void scheduling::schedulingScex(TaskFactory& factory, PeriodicTaskIF*& scexDevHandler,
PeriodicTaskIF*& scexReaderTask) {
void scheduling::scheduleScexReader(TaskFactory& factory, PeriodicTaskIF*& scexReaderTask) {
using namespace scheduling;
ReturnValue_t result = returnvalue::OK;
#if OBSW_PRINT_MISSED_DEADLINES == 1
@ -17,37 +16,6 @@ void scheduling::schedulingScex(TaskFactory& factory, PeriodicTaskIF*& scexDevHa
#else
void (*missedDeadlineFunc)(void) = nullptr;
#endif
scexDevHandler = factory.createPeriodicTask(
"SCEX_DEV", 35, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.5, missedDeadlineFunc);
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::PERFORM_OPERATION);
if (result != returnvalue::OK) {
printAddObjectError("SCEX_DEV", objects::SCEX);
}
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::SEND_WRITE);
if (result != returnvalue::OK) {
printAddObjectError("SCEX_DEV", objects::SCEX);
}
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::GET_WRITE);
if (result != returnvalue::OK) {
printAddObjectError("SCEX_DEV", objects::SCEX);
}
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::SEND_READ);
if (result != returnvalue::OK) {
printAddObjectError("SCEX_DEV", objects::SCEX);
}
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::GET_READ);
if (result != returnvalue::OK) {
printAddObjectError("SCEX_DEV", objects::SCEX);
}
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::SEND_READ);
if (result != returnvalue::OK) {
printAddObjectError("SCEX_DEV", objects::SCEX);
}
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::GET_READ);
if (result != returnvalue::OK) {
printAddObjectError("SCEX_DEV", objects::SCEX);
}
result = returnvalue::OK;
scexReaderTask = factory.createPeriodicTask(
@ -79,3 +47,35 @@ void scheduling::addMpsocSupvHandlers(PeriodicTaskIF* plTask) {
plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::GET_READ);
#endif
}
void scheduling::scheduleScexDev(PeriodicTaskIF*& scexDevHandler) {
ReturnValue_t result =
scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::PERFORM_OPERATION);
if (result != returnvalue::OK) {
printAddObjectError("SCEX_DEV", objects::SCEX);
}
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::SEND_WRITE);
if (result != returnvalue::OK) {
printAddObjectError("SCEX_DEV", objects::SCEX);
}
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::GET_WRITE);
if (result != returnvalue::OK) {
printAddObjectError("SCEX_DEV", objects::SCEX);
}
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::SEND_READ);
if (result != returnvalue::OK) {
printAddObjectError("SCEX_DEV", objects::SCEX);
}
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::GET_READ);
if (result != returnvalue::OK) {
printAddObjectError("SCEX_DEV", objects::SCEX);
}
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::SEND_READ);
if (result != returnvalue::OK) {
printAddObjectError("SCEX_DEV", objects::SCEX);
}
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::GET_READ);
if (result != returnvalue::OK) {
printAddObjectError("SCEX_DEV", objects::SCEX);
}
}

View File

@ -3,7 +3,7 @@
#include <fsfw/tasks/TaskFactory.h>
namespace scheduling {
void schedulingScex(TaskFactory& factory, PeriodicTaskIF*& scexDevHandler,
PeriodicTaskIF*& scexReaderTask);
void scheduleScexDev(PeriodicTaskIF*& scexDevHandler);
void scheduleScexReader(TaskFactory& factory, PeriodicTaskIF*& scexReaderTask);
void addMpsocSupvHandlers(PeriodicTaskIF* task);
} // namespace scheduling

View File

@ -9,4 +9,4 @@ add_subdirectory(csp)
add_subdirectory(cfdp)
add_subdirectory(config)
target_sources(${LIB_EIVE_MISSION} PRIVATE acsDefs.cpp)
target_sources(${LIB_EIVE_MISSION} PRIVATE acsDefs.cpp trace.cpp)

View File

@ -50,6 +50,9 @@ ReturnValue_t AcsController::getParameter(uint8_t domainId, uint8_t parameterId,
}
void AcsController::performControlOperation() {
#if OBSW_THREAD_TRACING == 1
trace::threadTrace(opCounter, "ACS & TCS PST");
#endif
switch (internalState) {
case InternalState::STARTUP: {
initialCountdown.resetTimer();

View File

@ -19,6 +19,7 @@
#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h"
#include "mission/devices/devicedefinitions/SusDefinitions.h"
#include "mission/devices/devicedefinitions/imtqHandlerDefinitions.h"
#include "mission/trace.h"
class AcsController : public ExtendedControllerBase, public ReceivesParameterMessagesIF {
public:
@ -51,6 +52,10 @@ class AcsController : public ExtendedControllerBase, public ReceivesParameterMes
ParameterHelper parameterHelper;
#if OBSW_THREAD_TRACING == 1
uint32_t opCounter = 0;
#endif
enum class InternalState { STARTUP, INITIAL_DELAY, READY };
InternalState internalState = InternalState::STARTUP;

View File

@ -72,6 +72,9 @@ ReturnValue_t ThermalController::handleCommandMessage(CommandMessage* message) {
}
void ThermalController::performControlOperation() {
#if OBSW_THREAD_TRACING == 1
trace::threadTrace(opCounter, "TCS Task");
#endif
switch (internalState) {
case InternalState::STARTUP: {
initialCountdown.resetTimer();

View File

@ -11,7 +11,8 @@
#include <list>
#include "../devices/HeaterHandler.h"
#include "mission/devices/HeaterHandler.h"
#include "mission/trace.h"
/**
* NOP Limit: Hard limit for device, usually from datasheet. Device damage is possible lif NOP limit
@ -152,6 +153,10 @@ class ThermalController : public ExtendedControllerBase {
// Initial delay to make sure all pool variables have been initialized their owners
Countdown initialCountdown = Countdown(DELAY);
#if OBSW_THREAD_TRACING == 1
uint32_t opCounter = 0;
#endif
std::array<std::pair<bool, double>, 5> sensors;
uint8_t numSensors = 0;

View File

@ -2,8 +2,6 @@
#include <fsfw/datapool/PoolReadGuard.h>
#include "OBSWConfig.h"
BpxBatteryHandler::BpxBatteryHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie)
: DeviceHandlerBase(objectId, comIF, comCookie), hkSet(this), cfgSet(this) {}
@ -280,3 +278,9 @@ void BpxBatteryHandler::setToGoToNormalMode(bool enable) {
}
void BpxBatteryHandler::setDebugMode(bool enable) { this->debugMode = enable; }
void BpxBatteryHandler::performOperationHook() {
#if OBSW_THREAD_TRACING == 1
trace::threadTrace(opCounter, "BPX BATT");
#endif
}

View File

@ -4,6 +4,7 @@
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include "devicedefinitions/BpxBatteryDefinitions.h"
#include "mission/trace.h"
class BpxBatteryHandler : public DeviceHandlerBase {
public:
@ -24,6 +25,10 @@ class BpxBatteryHandler : public DeviceHandlerBase {
bool debugMode = false;
bool goToNormalModeImmediately = false;
uint8_t sentPingByte = BpxBattery::DEFAULT_PING_SENT_BYTE;
#if OBSW_THREAD_TRACING == 1
uint32_t opCounter = 0;
#endif
BpxBatteryHk hkSet;
DeviceCommandId_t lastCmd = DeviceHandlerIF::NO_COMMAND_ID;
BpxBatteryCfg cfgSet;
@ -47,6 +52,7 @@ class BpxBatteryHandler : public DeviceHandlerBase {
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
void fillCommandAndReplyMap() override;
void performOperationHook() override;
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData,
size_t commandDataLen) override;
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,

View File

@ -11,6 +11,7 @@
#include "fsfw/ipc/QueueFactory.h"
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw_hal/common/gpio/GpioCookie.h"
#include "mission/trace.h"
static constexpr bool DEBUG_MODE = true;
@ -37,6 +38,9 @@ SolarArrayDeploymentHandler::~SolarArrayDeploymentHandler() = default;
ReturnValue_t SolarArrayDeploymentHandler::performOperation(uint8_t operationCode) {
using namespace std::filesystem;
#if OBSW_THREAD_TRACING == 1
trace::threadTrace(opCounter, "SA DEPL");
#endif
if (opDivider.checkAndIncrement()) {
auto activeSdc = sdcMan.getActiveSdCard();
if (activeSdc and activeSdc.value() == sd::SdCard::SLOT_0 and

View File

@ -19,6 +19,7 @@
#include "fsfw/timemanager/Countdown.h"
#include "fsfw_hal/common/gpio/GpioIF.h"
#include "mission/memory/SdCardMountedIF.h"
#include "mission/trace.h"
#include "returnvalues/classIds.h"
enum DeploymentChannels : uint8_t { SA_1 = 1, SA_2 = 2 };
@ -172,6 +173,9 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
bool firstAutonomousCycle = true;
ActionId_t activeCmd = HasActionsIF::INVALID_ACTION_ID;
std::optional<uint64_t> initUptime;
#if OBSW_THREAD_TRACING == 1
uint32_t opCounter = 0;
#endif
PeriodicOperationDivider opDivider = PeriodicOperationDivider(5);
uint8_t retryCounter = 3;

10
mission/trace.cpp Normal file
View File

@ -0,0 +1,10 @@
#include "trace.h"
#include "fsfw/serviceinterface.h"
void trace::threadTrace(uint32_t& counter, const char* name, unsigned div) {
counter++;
if (counter % div == 0) {
sif::debug << name << " running" << std::endl;
}
}

14
mission/trace.h Normal file
View File

@ -0,0 +1,14 @@
#ifndef MISSION_TRACE_H_
#define MISSION_TRACE_H_
#include <cstdint>
#define OBSW_THREAD_TRACING 0
namespace trace {
void threadTrace(uint32_t& counter, const char* name, unsigned div = 5);
}
#endif /* MISSION_TRACE_H_ */

View File

@ -42,10 +42,8 @@ ReturnValue_t EiveTestTask::performOperation(uint8_t operationCode) {
#include <etl/vector.h>
// #include <lwgps/lwgps.h>
/**
* @brief Dummy data from GPS receiver. Will be replaced witgh hyperion data later.
*/
@ -76,7 +74,6 @@ const char hyperion_gps_data[] =
"$GNVTG,040.7,T,,M,000.0,N,000.0,K,A*10\r\n"
"$GNZDA,173225.998892,27,02,2021,00,00*75\r\n";
ReturnValue_t EiveTestTask::performOneShotAction() {
#if OBSW_ADD_TEST_CODE == 1
// performLwgpsTest();