From aded4fae1e4f8a8a325c49b8c0d4bb4d7408d676 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 4 Apr 2022 20:34:31 +0200 Subject: [PATCH 1/3] printout improvement --- src/fsfw/pus/Service3Housekeeping.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fsfw/pus/Service3Housekeeping.cpp b/src/fsfw/pus/Service3Housekeeping.cpp index 075747836..cce8fc913 100644 --- a/src/fsfw/pus/Service3Housekeeping.cpp +++ b/src/fsfw/pus/Service3Housekeeping.cpp @@ -214,11 +214,11 @@ ReturnValue_t Service3Housekeeping::handleReply(const CommandMessage* reply, default: #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::warning << "Service3Housekeeping::handleReply: Invalid reply with " - << "reply command " << command << "!" << std::endl; + << "reply command " << command << std::endl; #else sif::printWarning( "Service3Housekeeping::handleReply: Invalid reply with " - "reply command %hu!\n", + "reply command %hu\n", command); #endif return CommandingServiceBase::INVALID_REPLY; From 0677de39aa4c20e8ee1c066909818d2dfffcbc2a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 7 Apr 2022 00:15:42 +0200 Subject: [PATCH 2/3] make reporting setter public --- src/fsfw/datapoollocal/LocalPoolDataSetBase.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsfw/datapoollocal/LocalPoolDataSetBase.h b/src/fsfw/datapoollocal/LocalPoolDataSetBase.h index 17cf8be2e..9166cf34f 100644 --- a/src/fsfw/datapoollocal/LocalPoolDataSetBase.h +++ b/src/fsfw/datapoollocal/LocalPoolDataSetBase.h @@ -162,6 +162,7 @@ class LocalPoolDataSetBase : public PoolDataSetBase, public MarkChangedIF { object_id_t getCreatorObjectId(); bool getReportingEnabled() const; + void setReportingEnabled(bool enabled); /** * Returns the current periodic HK generation interval this set @@ -189,7 +190,6 @@ class LocalPoolDataSetBase : public PoolDataSetBase, public MarkChangedIF { * Used for periodic generation. */ bool reportingEnabled = false; - void setReportingEnabled(bool enabled); void initializePeriodicHelper(float collectionInterval, dur_millis_t minimumPeriodicInterval, uint8_t nonDiagIntervalFactor = 5); From e3ffcae3e09a9ef674383b9a93a101676b0f575e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 7 Apr 2022 11:01:39 +0200 Subject: [PATCH 3/3] emit warning in linux clock --- src/fsfw/osal/linux/Clock.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/fsfw/osal/linux/Clock.cpp b/src/fsfw/osal/linux/Clock.cpp index 61eb970ff..9b8fcb65c 100644 --- a/src/fsfw/osal/linux/Clock.cpp +++ b/src/fsfw/osal/linux/Clock.cpp @@ -1,4 +1,5 @@ #include "fsfw/timemanager/Clock.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include #include @@ -7,12 +8,13 @@ #include #include - -#include "fsfw/serviceinterface/ServiceInterface.h" +#include uint16_t Clock::leapSeconds = 0; MutexIF* Clock::timeMutex = NULL; +void handleClockError(); + uint32_t Clock::getTicksPerSecond(void) { uint32_t ticks = sysconf(_SC_CLK_TCK); return ticks; @@ -27,7 +29,7 @@ ReturnValue_t Clock::setClock(const TimeOfDay_t* time) { int status = clock_settime(CLOCK_REALTIME, &timeUnix); if (status != 0) { - // TODO errno + handleClockError(); return HasReturnvaluesIF::RETURN_FAILED; } return HasReturnvaluesIF::RETURN_OK; @@ -39,12 +41,23 @@ ReturnValue_t Clock::setClock(const timeval* time) { timeUnix.tv_nsec = (__syscall_slong_t)time->tv_usec * 1000; int status = clock_settime(CLOCK_REALTIME, &timeUnix); if (status != 0) { - // TODO errno + handleClockError(); return HasReturnvaluesIF::RETURN_FAILED; } return HasReturnvaluesIF::RETURN_OK; } +void handleClockError() { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "Clock::setClock: Failed with code " << errno << ": " << strerror(errno) + << std::endl; +#else + sif::printWarning("Clock::setClock: Failed with code %d: %s\n", errno, strerror(errno)); +#endif +#endif +} + ReturnValue_t Clock::getClock_timeval(timeval* time) { timespec timeUnix; int status = clock_gettime(CLOCK_REALTIME, &timeUnix);