rough but possible fix..
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2023-07-13 16:38:20 +02:00
parent d3f3a3efd0
commit 0cefef8a35
Signed by: muellerr
GPG Key ID: 407F9B00F858F270
7 changed files with 15 additions and 26 deletions

2
fsfw

@ -1 +1 @@
Subproject commit 88e8665280a0381c41b724ab035a8c3eff1a23c1 Subproject commit 42e74d22cc1b5d4060ce9923f674bdede0babaac

View File

@ -54,8 +54,8 @@ ReturnValue_t StrComHandler::performOperation(uint8_t operationCode) {
switch (state) { switch (state) {
case InternalState::POLL_ONE_REPLY: { case InternalState::POLL_ONE_REPLY: {
// Stopwatch watch; // Stopwatch watch;
replyTimeout.setTimeout(400); replyTimeout.setTimeout(200);
replyResult = readOneReply(static_cast<uint32_t>(state)); readOneReply(static_cast<uint32_t>(state));
{ {
MutexGuard mg(lock); MutexGuard mg(lock);
replyWasReceived = true; replyWasReceived = true;
@ -684,7 +684,7 @@ ReturnValue_t StrComHandler::sendMessage(CookieIF* cookie, const uint8_t* sendDa
size_t frameLen; size_t frameLen;
datalinkLayer.encodeFrame(sendData, sendLen, &txFrame, frameLen); datalinkLayer.encodeFrame(sendData, sendLen, &txFrame, frameLen);
if (PACKET_WIRETAPPING) { if (PACKET_WIRETAPPING) {
sif::debug << "Sendign STR frame" << std::endl; sif::debug << "Sending STR frame" << std::endl;
arrayprinter::print(txFrame, frameLen); arrayprinter::print(txFrame, frameLen);
} }
ssize_t bytesWritten = write(serialPort, txFrame, frameLen); ssize_t bytesWritten = write(serialPort, txFrame, frameLen);
@ -716,13 +716,11 @@ ReturnValue_t StrComHandler::requestReceiveMessage(CookieIF* cookie, size_t requ
} }
ReturnValue_t StrComHandler::readReceivedMessage(CookieIF* cookie, uint8_t** buffer, size_t* size) { ReturnValue_t StrComHandler::readReceivedMessage(CookieIF* cookie, uint8_t** buffer, size_t* size) {
// Consider it a configuration error if the task is not done with a command -> reply cycle
// in time.
bool replyWasReceived = false; bool replyWasReceived = false;
{ {
MutexGuard mg(lock); MutexGuard mg(lock);
if (state != InternalState::SLEEPING) { if (state != InternalState::SLEEPING) {
return BUSY; return returnvalue::OK;
} }
replyWasReceived = this->replyWasReceived; replyWasReceived = this->replyWasReceived;
} }
@ -735,7 +733,7 @@ ReturnValue_t StrComHandler::readReceivedMessage(CookieIF* cookie, uint8_t** buf
*size = replyLen; *size = replyLen;
} }
replyLen = 0; replyLen = 0;
return replyResult; return returnvalue::OK;
} }
ReturnValue_t StrComHandler::unlockAndEraseRegions(uint32_t from, uint32_t to) { ReturnValue_t StrComHandler::unlockAndEraseRegions(uint32_t from, uint32_t to) {

View File

@ -325,7 +325,7 @@ ReturnValue_t StarTrackerHandler::buildNormalDeviceCommand(DeviceCommandId_t* id
ReturnValue_t StarTrackerHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) { ReturnValue_t StarTrackerHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
switch (internalState) { switch (internalState) {
case InternalState::BOOT_FIRMWARE: { case InternalState::BOOT_FIRMWARE: {
if (bootState == FwBootState::WAIT_FOR_EXECUTION or bootState == FwBootState::VERIFY_BOOT) { if (bootState == FwBootState::VERIFY_BOOT or isAwaitingReply()) {
return NOTHING_TO_SEND; return NOTHING_TO_SEND;
} }
if (bootState == FwBootState::NONE) { if (bootState == FwBootState::NONE) {
@ -350,75 +350,61 @@ ReturnValue_t StarTrackerHandler::buildTransitionDeviceCommand(DeviceCommandId_t
return buildCommandFromCommand(*id, nullptr, 0); return buildCommandFromCommand(*id, nullptr, 0);
} }
case (FwBootState::SET_TIME): { case (FwBootState::SET_TIME): {
bootState = FwBootState::WAIT_FOR_EXECUTION;
*id = startracker::SET_TIME_FROM_SYS_TIME; *id = startracker::SET_TIME_FROM_SYS_TIME;
return buildCommandFromCommand(*id, nullptr, 0); return buildCommandFromCommand(*id, nullptr, 0);
} }
case (FwBootState::LOGLEVEL): { case (FwBootState::LOGLEVEL): {
bootState = FwBootState::WAIT_FOR_EXECUTION;
*id = startracker::LOGLEVEL; *id = startracker::LOGLEVEL;
return buildCommandFromCommand( return buildCommandFromCommand(
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size()); *id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
} }
case (FwBootState::LIMITS): { case (FwBootState::LIMITS): {
bootState = FwBootState::WAIT_FOR_EXECUTION;
*id = startracker::LIMITS; *id = startracker::LIMITS;
return buildCommandFromCommand( return buildCommandFromCommand(
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size()); *id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
} }
case (FwBootState::TRACKING): { case (FwBootState::TRACKING): {
bootState = FwBootState::WAIT_FOR_EXECUTION;
*id = startracker::TRACKING; *id = startracker::TRACKING;
return buildCommandFromCommand( return buildCommandFromCommand(
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size()); *id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
} }
case FwBootState::MOUNTING: case FwBootState::MOUNTING:
bootState = FwBootState::WAIT_FOR_EXECUTION;
*id = startracker::MOUNTING; *id = startracker::MOUNTING;
return buildCommandFromCommand( return buildCommandFromCommand(
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size()); *id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
case FwBootState::IMAGE_PROCESSOR: case FwBootState::IMAGE_PROCESSOR:
bootState = FwBootState::WAIT_FOR_EXECUTION;
*id = startracker::IMAGE_PROCESSOR; *id = startracker::IMAGE_PROCESSOR;
return buildCommandFromCommand( return buildCommandFromCommand(
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size()); *id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
case FwBootState::CAMERA: case FwBootState::CAMERA:
bootState = FwBootState::WAIT_FOR_EXECUTION;
*id = startracker::CAMERA; *id = startracker::CAMERA;
return buildCommandFromCommand( return buildCommandFromCommand(
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size()); *id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
case FwBootState::CENTROIDING: case FwBootState::CENTROIDING:
bootState = FwBootState::WAIT_FOR_EXECUTION;
*id = startracker::CENTROIDING; *id = startracker::CENTROIDING;
return buildCommandFromCommand( return buildCommandFromCommand(
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size()); *id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
case FwBootState::LISA: case FwBootState::LISA:
bootState = FwBootState::WAIT_FOR_EXECUTION;
*id = startracker::LISA; *id = startracker::LISA;
return buildCommandFromCommand( return buildCommandFromCommand(
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size()); *id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
case FwBootState::MATCHING: case FwBootState::MATCHING:
bootState = FwBootState::WAIT_FOR_EXECUTION;
*id = startracker::MATCHING; *id = startracker::MATCHING;
return buildCommandFromCommand( return buildCommandFromCommand(
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size()); *id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
case FwBootState::VALIDATION: case FwBootState::VALIDATION:
bootState = FwBootState::WAIT_FOR_EXECUTION;
*id = startracker::VALIDATION; *id = startracker::VALIDATION;
return buildCommandFromCommand( return buildCommandFromCommand(
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size()); *id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
case FwBootState::ALGO: case FwBootState::ALGO:
bootState = FwBootState::WAIT_FOR_EXECUTION;
*id = startracker::ALGO; *id = startracker::ALGO;
return buildCommandFromCommand( return buildCommandFromCommand(
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size()); *id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
case FwBootState::LOG_SUBSCRIPTION: case FwBootState::LOG_SUBSCRIPTION:
bootState = FwBootState::WAIT_FOR_EXECUTION;
*id = startracker::LOGSUBSCRIPTION; *id = startracker::LOGSUBSCRIPTION;
return buildCommandFromCommand( return buildCommandFromCommand(
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size()); *id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
case FwBootState::DEBUG_CAMERA: case FwBootState::DEBUG_CAMERA:
bootState = FwBootState::WAIT_FOR_EXECUTION;
*id = startracker::DEBUG_CAMERA; *id = startracker::DEBUG_CAMERA;
return buildCommandFromCommand( return buildCommandFromCommand(
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size()); *id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
@ -688,7 +674,7 @@ void StarTrackerHandler::fillCommandAndReplyMap() {
startracker::MAX_FRAME_SIZE * 2 + 2); startracker::MAX_FRAME_SIZE * 2 + 2);
this->insertInCommandAndReplyMap(startracker::CAMERA, 3, nullptr, this->insertInCommandAndReplyMap(startracker::CAMERA, 3, nullptr,
startracker::MAX_FRAME_SIZE * 2 + 2); startracker::MAX_FRAME_SIZE * 2 + 2);
this->insertInCommandAndReplyMap(startracker::CENTROIDING, 3, nullptr, this->insertInCommandAndReplyMap(startracker::CENTROIDING, 2, nullptr,
startracker::MAX_FRAME_SIZE * 2 + 2); startracker::MAX_FRAME_SIZE * 2 + 2);
this->insertInCommandAndReplyMap(startracker::LISA, 3, nullptr, this->insertInCommandAndReplyMap(startracker::LISA, 3, nullptr,
startracker::MAX_FRAME_SIZE * 2 + 2); startracker::MAX_FRAME_SIZE * 2 + 2);

View File

@ -281,6 +281,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
LOG_SUBSCRIPTION, LOG_SUBSCRIPTION,
DEBUG_CAMERA, DEBUG_CAMERA,
WAIT_FOR_EXECUTION, WAIT_FOR_EXECUTION,
RETRY_CFG_CMD
}; };
FwBootState bootState = FwBootState::NONE; FwBootState bootState = FwBootState::NONE;

View File

@ -341,6 +341,8 @@ ReturnValue_t pst::pstTcsAndAcs(FixedTimeslotTaskIF *thisSequence, AcsPstCfg cfg
DeviceHandlerIF::SEND_READ); DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::STAR_TRACKER, length * config::spiSched::SCHED_BLOCK_2_PERIOD, thisSequence->addSlot(objects::STAR_TRACKER, length * config::spiSched::SCHED_BLOCK_2_PERIOD,
DeviceHandlerIF::GET_READ); DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::STAR_TRACKER, length * config::spiSched::SCHED_BLOCK_2_PERIOD,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::STAR_TRACKER, length * config::spiSched::SCHED_BLOCK_2_PERIOD, thisSequence->addSlot(objects::STAR_TRACKER, length * config::spiSched::SCHED_BLOCK_2_PERIOD,
DeviceHandlerIF::SEND_WRITE); DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::STAR_TRACKER, length * config::spiSched::SCHED_BLOCK_2_PERIOD, thisSequence->addSlot(objects::STAR_TRACKER, length * config::spiSched::SCHED_BLOCK_2_PERIOD,

View File

@ -3,7 +3,9 @@
#include "mission/acs/defs.h" #include "mission/acs/defs.h"
StrFdir::StrFdir(object_id_t strObject) StrFdir::StrFdir(object_id_t strObject)
: DeviceHandlerFailureIsolation(strObject, objects::NO_OBJECT) {} : DeviceHandlerFailureIsolation(strObject, objects::NO_OBJECT) {
missedReplyCount.setFailureThreshold(30);
}
ReturnValue_t StrFdir::eventReceived(EventMessage* event) { ReturnValue_t StrFdir::eventReceived(EventMessage* event) {
if (event->getEvent() == acs::MEKF_INVALID_MODE_VIOLATION) { if (event->getEvent() == acs::MEKF_INVALID_MODE_VIOLATION) {

2
tmtc

@ -1 +1 @@
Subproject commit 62bd5356220bab1ce9f3ddaa7aaf75963b8bd596 Subproject commit 26cf112121782e730057cda0766d435ee2077b6d