added logic for secondary TM handling
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2023-10-09 15:29:04 +02:00
parent 8fe4a85998
commit e65352818f
Signed by: muellerr
GPG Key ID: FCE0B2BD2195142F
2 changed files with 18 additions and 5 deletions

View File

@ -64,6 +64,8 @@ StarTrackerHandler::StarTrackerHandler(object_id_t objectId, object_id_t comIF,
sif::error << "StarTrackerHandler: Invalid str image loader" << std::endl;
}
eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
additionalRequestedTm.emplace(startracker::REQ_TEMPERATURE);
currentSecondaryTmIter = additionalRequestedTm.begin();
}
StarTrackerHandler::~StarTrackerHandler() {}
@ -311,13 +313,20 @@ ReturnValue_t StarTrackerHandler::buildNormalDeviceCommand(DeviceCommandId_t* id
return NOTHING_TO_SEND;
}
switch (normalState) {
case NormalState::TEMPERATURE_REQUEST:
*id = startracker::REQ_TEMPERATURE;
case NormalState::SECONDARY_REQUEST:
if (additionalRequestedTm.size() == 0) {
break;
}
*id = *currentSecondaryTmIter;
currentSecondaryTmIter++;
if (currentSecondaryTmIter == additionalRequestedTm.end()) {
currentSecondaryTmIter = additionalRequestedTm.begin();
}
normalState = NormalState::SOLUTION_REQUEST;
break;
case NormalState::SOLUTION_REQUEST:
*id = startracker::REQ_SOLUTION;
normalState = NormalState::TEMPERATURE_REQUEST;
normalState = NormalState::SECONDARY_REQUEST;
break;
default:
sif::debug << "StarTrackerHandler::buildNormalDeviceCommand: Invalid normal step"

View File

@ -8,6 +8,7 @@
#include <mission/acs/str/strJsonCommands.h>
#include <thirdparty/sagittactl/wire/common/genericstructs.h>
#include <set>
#include <thread>
#include "OBSWConfig.h"
@ -245,9 +246,9 @@ class StarTrackerHandler : public DeviceHandlerBase {
std::string paramJsonFile;
enum class NormalState { TEMPERATURE_REQUEST, SOLUTION_REQUEST };
enum class NormalState { SECONDARY_REQUEST, SOLUTION_REQUEST };
NormalState normalState = NormalState::TEMPERATURE_REQUEST;
NormalState normalState = NormalState::SECONDARY_REQUEST;
enum class StartupState {
IDLE,
@ -305,6 +306,9 @@ class StarTrackerHandler : public DeviceHandlerBase {
size_t fullPacketLen = 0;
std::set<DeviceCommandId_t> additionalRequestedTm{};
std::set<DeviceCommandId_t>::iterator currentSecondaryTmIter;
/**
* @brief Handles internal state
*/