done
Some checks are pending
EIVE/eive-obsw/pipeline/head Build queued...
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2023-03-24 02:34:38 +01:00
parent e8e01cf198
commit 21159107d7
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
18 changed files with 41 additions and 38 deletions

View File

@ -19,6 +19,8 @@ will consitute of a breaking change warranting a new major release:
## Fixed
- STR: Fix weird issues on datalink layer data reception which sometimes occur.
- Syrlinks FDIR: Fully allow FDIR to do more recoveries. Assembly should take care of preventing
the switch to go off.
## Changed
@ -28,6 +30,10 @@ will consitute of a breaking change warranting a new major release:
- `StrHelper` renamed to `StrComHandler`, is now a `DeviceHandlerIF` directly and does not wrap
a separate UART COM interface anymore.
- TCS: Local pool variables are members now.
- Syrlinks: Create dedicated COM helper which uses a ring buffer to parse the Syrlinks datalinklayer
and should make communication more reliable even on high CPU loads.
- Syrlinks: Two communication cycles per PST.
- Fine-tuning of various task priorities.
# [v1.39.1] 2023-03-22

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 279 translations.
* @brief Auto-generated event translation file. Contains 278 translations.
* @details
* Generated on: 2023-03-24 01:19:39
* Generated on: 2023-03-24 02:13:12
*/
#include "translateEvents.h"

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file.
* @details
* Contains 169 translations.
* Generated on: 2023-03-24 01:19:39
* Generated on: 2023-03-24 02:13:12
*/
#include "translateObjects.h"

View File

@ -14,7 +14,6 @@
/*******************************************************************/
#define OBSW_ENABLE_PERIODIC_HK 0
#define OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT 0
// This switch will cause the SW to command the EIVE system object to safe mode. This will
// trigger a lot of events, so it can make sense to disable this for debugging purposes
#define OBSW_COMMAND_SAFE_MODE_AT_STARTUP 1

View File

@ -81,7 +81,7 @@ void scheduling::initTasks() {
#endif
PeriodicTaskIF* coreCtrlTask = factory->createPeriodicTask(
"CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
"CORE_CTRL", 55, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
result = coreCtrlTask->addComponent(objects::CORE_CONTROLLER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
@ -120,7 +120,7 @@ void scheduling::initTasks() {
#if OBSW_ADD_TCPIP_SERVERS == 1
#if OBSW_ADD_TMTC_UDP_SERVER == 1
PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask(
"UDP_TMTC_POLLING", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
"UDP_TMTC_POLLING", 55, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = udpPollingTask->addComponent(objects::UDP_TMTC_POLLING_TASK);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("UDP_POLLING", objects::UDP_TMTC_POLLING_TASK);
@ -128,7 +128,7 @@ void scheduling::initTasks() {
#endif
#if OBSW_ADD_TMTC_TCP_SERVER == 1
PeriodicTaskIF* tcpPollingTask = factory->createPeriodicTask(
"TCP_TMTC_POLLING", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
"TCP_TMTC_POLLING", 55, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = tcpPollingTask->addComponent(objects::TCP_TMTC_POLLING_TASK);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("UDP_POLLING", objects::TCP_TMTC_POLLING_TASK);
@ -309,7 +309,7 @@ void scheduling::initTasks() {
#if OBSW_ADD_SYRLINKS == 1
PeriodicTaskIF* syrlinksCom = factory->createPeriodicTask(
"SYRLINKS_COM", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
"SYRLINKS_COM", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
result = syrlinksCom->addComponent(objects::SYRLINKS_COM_HANDLER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("SYRLINKS_COM", objects::SYRLINKS_COM_HANDLER);
@ -487,7 +487,7 @@ void scheduling::createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction
/* Polling Sequence Table Default */
#if OBSW_ADD_SPI_TEST_CODE == 0
FixedTimeslotTaskIF* syrlinksPst = factory.createFixedTimeslotTask(
"SYRLINKS", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
"SYRLINKS", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
result = pst::pstSyrlinks(syrlinksPst);
if (result != returnvalue::OK) {
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {

View File

@ -239,7 +239,6 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
13630;0x353e;SUPV_UPDATE_PROGRESS;INFO;Will be triggered every 5 percent of the update progress. P1: First byte percent, third and fourth byte Sequence Count, P2: Bytes written;linux/devices/ploc/PlocSupvUartMan.h
13631;0x353f;HDLC_FRAME_REMOVAL_ERROR;INFO;No description;linux/devices/ploc/PlocSupvUartMan.h
13632;0x3540;HDLC_CRC_ERROR;INFO;No description;linux/devices/ploc/PlocSupvUartMan.h
13700;0x3584;FDIR_REACTION_IGNORED;MEDIUM;No description;mission/devices/devicedefinitions/SyrlinksDefinitions.h
13701;0x3585;TX_ON;INFO;Transmitter is on now. P1: Submode, P2: Current default datarate.;mission/devices/devicedefinitions/SyrlinksDefinitions.h
13702;0x3586;TX_OFF;INFO;Transmitter is off now.;mission/devices/devicedefinitions/SyrlinksDefinitions.h
13800;0x35e8;MISSING_PACKET;LOW;No description;mission/devices/devicedefinitions/ScexDefinitions.h

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
239 13630 0x353e SUPV_UPDATE_PROGRESS INFO Will be triggered every 5 percent of the update progress. P1: First byte percent, third and fourth byte Sequence Count, P2: Bytes written linux/devices/ploc/PlocSupvUartMan.h
240 13631 0x353f HDLC_FRAME_REMOVAL_ERROR INFO No description linux/devices/ploc/PlocSupvUartMan.h
241 13632 0x3540 HDLC_CRC_ERROR INFO No description linux/devices/ploc/PlocSupvUartMan.h
13700 0x3584 FDIR_REACTION_IGNORED MEDIUM No description mission/devices/devicedefinitions/SyrlinksDefinitions.h
242 13701 0x3585 TX_ON INFO Transmitter is on now. P1: Submode, P2: Current default datarate. mission/devices/devicedefinitions/SyrlinksDefinitions.h
243 13702 0x3586 TX_OFF INFO Transmitter is off now. mission/devices/devicedefinitions/SyrlinksDefinitions.h
244 13800 0x35e8 MISSING_PACKET LOW No description mission/devices/devicedefinitions/ScexDefinitions.h

View File

@ -239,7 +239,6 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
13630;0x353e;SUPV_UPDATE_PROGRESS;INFO;Will be triggered every 5 percent of the update progress. P1: First byte percent, third and fourth byte Sequence Count, P2: Bytes written;linux/devices/ploc/PlocSupvUartMan.h
13631;0x353f;HDLC_FRAME_REMOVAL_ERROR;INFO;No description;linux/devices/ploc/PlocSupvUartMan.h
13632;0x3540;HDLC_CRC_ERROR;INFO;No description;linux/devices/ploc/PlocSupvUartMan.h
13700;0x3584;FDIR_REACTION_IGNORED;MEDIUM;No description;mission/devices/devicedefinitions/SyrlinksDefinitions.h
13701;0x3585;TX_ON;INFO;Transmitter is on now. P1: Submode, P2: Current default datarate.;mission/devices/devicedefinitions/SyrlinksDefinitions.h
13702;0x3586;TX_OFF;INFO;Transmitter is off now.;mission/devices/devicedefinitions/SyrlinksDefinitions.h
13800;0x35e8;MISSING_PACKET;LOW;No description;mission/devices/devicedefinitions/ScexDefinitions.h

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
239 13630 0x353e SUPV_UPDATE_PROGRESS INFO Will be triggered every 5 percent of the update progress. P1: First byte percent, third and fourth byte Sequence Count, P2: Bytes written linux/devices/ploc/PlocSupvUartMan.h
240 13631 0x353f HDLC_FRAME_REMOVAL_ERROR INFO No description linux/devices/ploc/PlocSupvUartMan.h
241 13632 0x3540 HDLC_CRC_ERROR INFO No description linux/devices/ploc/PlocSupvUartMan.h
13700 0x3584 FDIR_REACTION_IGNORED MEDIUM No description mission/devices/devicedefinitions/SyrlinksDefinitions.h
242 13701 0x3585 TX_ON INFO Transmitter is on now. P1: Submode, P2: Current default datarate. mission/devices/devicedefinitions/SyrlinksDefinitions.h
243 13702 0x3586 TX_OFF INFO Transmitter is off now. mission/devices/devicedefinitions/SyrlinksDefinitions.h
244 13800 0x35e8 MISSING_PACKET LOW No description mission/devices/devicedefinitions/ScexDefinitions.h

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 279 translations.
* @brief Auto-generated event translation file. Contains 278 translations.
* @details
* Generated on: 2023-03-24 01:19:39
* Generated on: 2023-03-24 02:13:12
*/
#include "translateEvents.h"

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file.
* @details
* Contains 173 translations.
* Generated on: 2023-03-24 01:19:39
* Generated on: 2023-03-24 02:13:12
*/
#include "translateObjects.h"

View File

@ -4,6 +4,7 @@
#include <fsfw/ipc/MutexGuard.h>
#include <fsfw/tasks/SemaphoreFactory.h>
#include <fsfw/tasks/TaskFactory.h>
#include <fsfw/timemanager/Stopwatch.h>
#include <fsfw_hal/linux/serial/SerialCookie.h>
#include <fsfw_hal/linux/serial/helper.h>
#include <unistd.h>
@ -23,6 +24,7 @@ ReturnValue_t SyrlinksComHandler::performOperation(uint8_t opCode) {
state = State::SLEEPING;
lock->unlockMutex();
semaphore->acquire();
// Stopwatch watch;
readOneReply();
}
return returnvalue::OK;
@ -113,7 +115,7 @@ ReturnValue_t SyrlinksComHandler::handleSerialReception() {
<< std::endl;
return FAILED;
} else if (bytesRead > 0) {
// sif::info << "Received " << bytesRead << " bytes from the STR" << std::endl;
// sif::debug << "Received " << bytesRead << " bytes from the Syrlinks" << std::endl;
// arrayprinter::print(recBuf.data(), bytesRead);
ringBuf.writeData(recBuf.data(), bytesRead);
}
@ -164,7 +166,7 @@ ReturnValue_t SyrlinksComHandler::readOneReply() {
ReturnValue_t SyrlinksComHandler::tryReadingOneSyrlinksReply() {
size_t bytesToRead = ringBuf.getAvailableReadData();
if (bytesToRead == 0) {
return returnvalue::OK;
return NO_PACKET_FOUND;
}
bool startMarkerFound = false;
size_t startIdx = 0;
@ -184,7 +186,7 @@ ReturnValue_t SyrlinksComHandler::tryReadingOneSyrlinksReply() {
if (startMarkerFound) {
{
MutexGuard mg(lock);
replyLen = idx - startIdx;
replyLen = idx - startIdx + 1;
}
// Copy detected packet to IPC buffer so it can be passed back to the device handler.
if (replyLen > ipcBuf.size()) {
@ -192,13 +194,14 @@ ReturnValue_t SyrlinksComHandler::tryReadingOneSyrlinksReply() {
ringBuf.deleteData(idx);
return returnvalue::FAILED;
}
// sif::debug << "Detected Syrlinks reply with length " << replyLen << std::endl;
std::memcpy(ipcBuf.data(), recBuf.data() + startIdx, replyLen);
ringBuf.deleteData(idx);
ringBuf.deleteData(idx + 1);
return returnvalue::OK;
} else {
// Probably lost a packet. Discard broken packet.
sif::warning << "SyrlinksComHandler: Detected 2 consecutive end markers" << std::endl;
ringBuf.deleteData(idx);
ringBuf.deleteData(idx + 1);
}
}
}

View File

@ -28,7 +28,7 @@ class SyrlinksComHandler : public DeviceCommunicationIF,
SemaphoreIF *semaphore;
int serialPort = 0;
struct termios tty {};
Countdown replyTimeout{};
Countdown replyTimeout = Countdown(2000);
std::array<uint8_t, 2048> recBuf{};
SimpleRingBuffer ringBuf;
std::array<uint8_t, 1024> ipcBuf{};

View File

@ -8,7 +8,7 @@ ReturnValue_t ArcsecDatalinkLayer::checkRingBufForFrame(const uint8_t** decodedF
size_t& frameLen) {
size_t currentLen = decodeRingBuf.getAvailableReadData();
if (currentLen == 0) {
return returnvalue::OK;
return DEC_IN_PROGRESS;
}
decodeRingBuf.readData(rxAnalysisBuffer, currentLen);
for (size_t idx = 0; idx < currentLen; idx++) {

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 279 translations.
* @brief Auto-generated event translation file. Contains 278 translations.
* @details
* Generated on: 2023-03-24 01:19:39
* Generated on: 2023-03-24 02:13:12
*/
#include "translateEvents.h"

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file.
* @details
* Contains 173 translations.
* Generated on: 2023-03-24 01:19:39
* Generated on: 2023-03-24 02:13:12
*/
#include "translateObjects.h"

View File

@ -24,8 +24,12 @@ ReturnValue_t pst::pstSyrlinks(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.5, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.5, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.25, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.25, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.4, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.7, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.7, DeviceHandlerIF::GET_READ);
static_cast<void>(length);

View File

@ -10,7 +10,6 @@ enum class ParameterId : uint8_t { DATARATE = 0 };
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SYRLINKS;
static constexpr Event FDIR_REACTION_IGNORED = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
//! [EXPORT] : [COMMENT] Transmitter is on now. P1: Submode, P2: Current default datarate.
static constexpr Event TX_ON = event::makeEvent(SUBSYSTEM_ID, 1, severity::INFO);
//! [EXPORT] : [COMMENT] Transmitter is off now.

View File

@ -23,8 +23,7 @@ ReturnValue_t SyrlinksFdir::eventReceived(EventMessage* event) {
case DeviceHandlerIF::DEVICE_WANTS_HARD_REBOOT:
// We'll try a recovery as long as defined in MAX_REBOOT.
// Might cause some AssemblyBase cycles, so keep number low.
// handleRecovery(event->getEvent());
triggerEvent(syrlinks::FDIR_REACTION_IGNORED, event->getEvent(), 0);
handleRecovery(event->getEvent());
break;
case DeviceHandlerIF::DEVICE_INTERPRETING_REPLY_FAILED:
case DeviceHandlerIF::DEVICE_READING_REPLY_FAILED:
@ -33,8 +32,7 @@ ReturnValue_t SyrlinksFdir::eventReceived(EventMessage* event) {
case DeviceHandlerIF::DEVICE_BUILDING_COMMAND_FAILED:
// These faults all mean that there were stupid replies from a device.
if (strangeReplyCount.incrementAndCheck()) {
// handleRecovery(event->getEvent());
triggerEvent(syrlinks::FDIR_REACTION_IGNORED, event->getEvent(), 0);
handleRecovery(event->getEvent());
}
break;
case DeviceHandlerIF::DEVICE_SENDING_COMMAND_FAILED:
@ -48,7 +46,6 @@ ReturnValue_t SyrlinksFdir::eventReceived(EventMessage* event) {
// else
if (missedReplyCount.incrementAndCheck()) {
handleRecovery(event->getEvent());
// triggerEvent(syrlinks::FDIR_REACTION_IGNORED, event->getEvent(), 0);
}
break;
case StorageManagerIF::GET_DATA_FAILED:
@ -81,7 +78,6 @@ ReturnValue_t SyrlinksFdir::eventReceived(EventMessage* event) {
case Fuse::POWER_BELOW_LOW_LIMIT:
// Device might got stuck during boot, retry.
handleRecovery(event->getEvent());
triggerEvent(syrlinks::FDIR_REACTION_IGNORED, event->getEvent(), 0);
break;
//****Thermal*****
case ThermalComponentIF::COMPONENT_TEMP_LOW:
@ -113,14 +109,12 @@ void SyrlinksFdir::eventConfirmed(EventMessage* event) {
case DeviceHandlerIF::DEVICE_REQUESTING_REPLY_FAILED:
case DeviceHandlerIF::DEVICE_MISSED_REPLY:
if (missedReplyCount.incrementAndCheck()) {
// handleRecovery(event->getEvent());
triggerEvent(syrlinks::FDIR_REACTION_IGNORED, event->getEvent(), 0);
handleRecovery(event->getEvent());
}
break;
case PowerSwitchIF::SWITCH_WENT_OFF:
// This means the switch went off only for one device.
// handleRecovery(event->getEvent());
triggerEvent(syrlinks::FDIR_REACTION_IGNORED, event->getEvent(), 0);
handleRecovery(event->getEvent());
break;
default:
break;

2
tmtc

@ -1 +1 @@
Subproject commit b17c413e8f1d7a827b2fdd02b642a3bbebb2738c
Subproject commit 8115a39d66e219a7c6f5cdd1d4fd524ebcf6bd2d