From f307a86d9a972d29ee82234a415bf60a7ce4b6bc Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 11 Apr 2024 13:11:51 +0200 Subject: [PATCH 1/4] improve linux interface --- src/fsfw_hal/linux/serial/helper.cpp | 9 ++++----- src/fsfw_hal/linux/serial/helper.h | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/fsfw_hal/linux/serial/helper.cpp b/src/fsfw_hal/linux/serial/helper.cpp index c58689c0..af170757 100644 --- a/src/fsfw_hal/linux/serial/helper.cpp +++ b/src/fsfw_hal/linux/serial/helper.cpp @@ -1,8 +1,6 @@ #include #include -#include "fsfw/serviceinterface.h" - void serial::setMode(struct termios& options, UartModes mode) { if (mode == UartModes::NON_CANONICAL) { /* Disable canonical mode */ @@ -153,15 +151,16 @@ int serial::readCountersAndErrors(int serialPort, serial_icounter_struct& icount } void serial::setStopbits(struct termios& options, StopBits bits) { + // Regular case: One stop bit. + options.c_cflag &= ~CSTOPB; if (bits == StopBits::TWO_STOP_BITS) { // Use two stop bits options.c_cflag |= CSTOPB; - } else { - // Clear stop field, only one stop bit used in communication - options.c_cflag &= ~CSTOPB; } } void serial::flushRxBuf(int fd) { tcflush(fd, TCIFLUSH); } void serial::flushTxRxBuf(int fd) { tcflush(fd, TCIOFLUSH); } + +void serial::flushTxBuf(int fd) { tcflush(fd, TCOFLUSH); } diff --git a/src/fsfw_hal/linux/serial/helper.h b/src/fsfw_hal/linux/serial/helper.h index 623612ad..6b93ae91 100644 --- a/src/fsfw_hal/linux/serial/helper.h +++ b/src/fsfw_hal/linux/serial/helper.h @@ -65,6 +65,7 @@ void setParity(struct termios& options, Parity parity); void ignoreCtrlLines(struct termios& options); void flushRxBuf(int fd); +void flushTxBuf(int fd); void flushTxRxBuf(int fd); int readCountersAndErrors(int serialPort, serial_icounter_struct& icounter); From 3b0ee7ca3121a8d9e3e4d10a0c301ef5d1755102 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 17 Apr 2024 10:07:09 +0200 Subject: [PATCH 2/4] i forgot to push.. --- src/fsfw_hal/linux/serial/helper.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/fsfw_hal/linux/serial/helper.cpp b/src/fsfw_hal/linux/serial/helper.cpp index af170757..3a0dbb7a 100644 --- a/src/fsfw_hal/linux/serial/helper.cpp +++ b/src/fsfw_hal/linux/serial/helper.cpp @@ -1,5 +1,9 @@ #include #include +#include + +#include "FSFWConfig.h" +#include "fsfw/serviceinterface.h" void serial::setMode(struct termios& options, UartModes mode) { if (mode == UartModes::NON_CANONICAL) { @@ -106,7 +110,7 @@ void serial::setBaudrate(struct termios& options, UartBaudRate baud) { #endif // ! __APPLE__ default: #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "UartComIF::configureBaudrate: Baudrate not supported" << std::endl; + sif::warning << "serial::configureBaudrate: Baudrate not supported" << std::endl; #endif break; } @@ -161,6 +165,7 @@ void serial::setStopbits(struct termios& options, StopBits bits) { void serial::flushRxBuf(int fd) { tcflush(fd, TCIFLUSH); } +void serial::flushTxBuf(int fd) { tcflush(fd, TCOFLUSH); } + void serial::flushTxRxBuf(int fd) { tcflush(fd, TCIOFLUSH); } -void serial::flushTxBuf(int fd) { tcflush(fd, TCOFLUSH); } From 7c9b9e4cd8ee521da053688ec06bd1b8b93fe3a6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 17 Apr 2024 12:08:08 +0200 Subject: [PATCH 3/4] initialize FDIR component properly --- src/fsfw/devicehandlers/FreshDeviceHandlerBase.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fsfw/devicehandlers/FreshDeviceHandlerBase.cpp b/src/fsfw/devicehandlers/FreshDeviceHandlerBase.cpp index 2b4ab27b..1b463a37 100644 --- a/src/fsfw/devicehandlers/FreshDeviceHandlerBase.cpp +++ b/src/fsfw/devicehandlers/FreshDeviceHandlerBase.cpp @@ -11,6 +11,7 @@ FreshDeviceHandlerBase::FreshDeviceHandlerBase(DhbConfig config) healthHelper(this, getObjectId()), paramHelper(this), poolManager(this, nullptr), + fdirInstance(config.fdirInstance), defaultFdirParent(config.defaultFdirParent) { auto mqArgs = MqArgs(config.objectId, static_cast(this)); messageQueue = QueueFactory::instance()->createMessageQueue( From 0660457c92b4bc5a533e0821752b21c485e75fc7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 17 Apr 2024 12:11:07 +0200 Subject: [PATCH 4/4] check for FDIR failures --- src/fsfw/devicehandlers/FreshDeviceHandlerBase.cpp | 1 + src/fsfw/devicehandlers/FreshDeviceHandlerBase.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/fsfw/devicehandlers/FreshDeviceHandlerBase.cpp b/src/fsfw/devicehandlers/FreshDeviceHandlerBase.cpp index 1b463a37..1aa4431c 100644 --- a/src/fsfw/devicehandlers/FreshDeviceHandlerBase.cpp +++ b/src/fsfw/devicehandlers/FreshDeviceHandlerBase.cpp @@ -31,6 +31,7 @@ FreshDeviceHandlerBase::~FreshDeviceHandlerBase() { ReturnValue_t FreshDeviceHandlerBase::performOperation(uint8_t opCode) { performDeviceOperationPreQueueHandling(opCode); handleQueue(); + fdirInstance->checkForFailures(); performDeviceOperation(opCode); poolManager.performHkOperation(); return returnvalue::OK; diff --git a/src/fsfw/devicehandlers/FreshDeviceHandlerBase.h b/src/fsfw/devicehandlers/FreshDeviceHandlerBase.h index c911c1dd..8f2dd24f 100644 --- a/src/fsfw/devicehandlers/FreshDeviceHandlerBase.h +++ b/src/fsfw/devicehandlers/FreshDeviceHandlerBase.h @@ -129,7 +129,7 @@ class FreshDeviceHandlerBase : public SystemObject, ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, const uint8_t* data, size_t size) override = 0; // Executable overrides. - ReturnValue_t performOperation(uint8_t opCode) override; + virtual ReturnValue_t performOperation(uint8_t opCode) override; ReturnValue_t initializeAfterTaskCreation() override; /**