From 69e9710bf17013f974188ee420279107b472e822 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Fri, 10 Apr 2020 17:06:06 +0200 Subject: [PATCH] added intial carriage return im preamble --- osal/FreeRTOS/BinarySemaphore.cpp | 6 ++---- serviceinterface/ServiceInterfaceBuffer.cpp | 9 +++++---- serviceinterface/ServiceInterfaceBuffer.h | 10 +++++----- serviceinterface/ServiceInterfaceStream.cpp | 4 ++-- serviceinterface/ServiceInterfaceStream.h | 4 ++-- tmtcservices/TmTcBridge.cpp | 4 ++-- 6 files changed, 18 insertions(+), 19 deletions(-) diff --git a/osal/FreeRTOS/BinarySemaphore.cpp b/osal/FreeRTOS/BinarySemaphore.cpp index 05c97ae2..e2cddacc 100644 --- a/osal/FreeRTOS/BinarySemaphore.cpp +++ b/osal/FreeRTOS/BinarySemaphore.cpp @@ -138,10 +138,8 @@ ReturnValue_t BinarySemaphore::giveBinarySemaphoreFromISR(SemaphoreHandle_t sema BaseType_t returncode = xSemaphoreGiveFromISR(semaphore, higherPriorityTaskWoken); if (returncode == pdPASS) { if(*higherPriorityTaskWoken == pdPASS) { - // Request context switch - // TODO: I don't know if this will ever happen but if it does, - // I want to to know in case this causes issues. If it doesn't - // we should remove this. + // Request context switch because unblocking the semaphore + // caused a high priority task unblock. TaskManagement::requestContextSwitch(CallContext::isr); } return HasReturnvaluesIF::RETURN_OK; diff --git a/serviceinterface/ServiceInterfaceBuffer.cpp b/serviceinterface/ServiceInterfaceBuffer.cpp index 6798b776..527db07b 100644 --- a/serviceinterface/ServiceInterfaceBuffer.cpp +++ b/serviceinterface/ServiceInterfaceBuffer.cpp @@ -27,8 +27,8 @@ int ServiceInterfaceBuffer::sync(void) { Clock::TimeOfDay_t loggerTime; Clock::getDateAndTime(&loggerTime); char preamble[96] = { 0 }; - sprintf(preamble, "%s: | %" PRIu32 ":%02" PRIu32 ":%02" PRIu32 ".%03" PRIu32 " | ", - this->log_message.c_str(), + sprintf(preamble, "\r%s: | %" PRIu32 ":%02" PRIu32 ":%02" PRIu32 + ".%03" PRIu32 " | ", this->log_message.c_str(), loggerTime.hour, loggerTime.minute, loggerTime.second, @@ -45,7 +45,8 @@ int ServiceInterfaceBuffer::sync(void) { #ifndef UT699 -ServiceInterfaceBuffer::ServiceInterfaceBuffer(std::string set_message, uint16_t port) { +ServiceInterfaceBuffer::ServiceInterfaceBuffer(std::string set_message, + uint16_t port) { this->log_message = set_message; this->isActive = true; setp( buf, buf + BUF_SIZE ); @@ -59,7 +60,7 @@ void ServiceInterfaceBuffer::putChars(char const* begin, char const* end) { } memcpy(array, begin, length); - for( ; begin != end; begin++){ + for(; begin != end; begin++){ printChar(begin); } diff --git a/serviceinterface/ServiceInterfaceBuffer.h b/serviceinterface/ServiceInterfaceBuffer.h index b42c8a19..b4756d41 100644 --- a/serviceinterface/ServiceInterfaceBuffer.h +++ b/serviceinterface/ServiceInterfaceBuffer.h @@ -7,8 +7,8 @@ #include #ifndef UT699 -class ServiceInterfaceBuffer: public std::basic_streambuf > { +class ServiceInterfaceBuffer: + public std::basic_streambuf> { friend class ServiceInterfaceStream; public: ServiceInterfaceBuffer(std::string set_message, uint16_t port); @@ -17,11 +17,11 @@ protected: // This is called when buffer becomes full. If // buffer is not used, then this is called every // time when characters are put to stream. - virtual int overflow(int c = Traits::eof()); + int overflow(int c = Traits::eof()) override; // This function is called when stream is flushed, // for example when std::endl is put to stream. - virtual int sync(void); + int sync(void) override; private: // For additional message information @@ -30,7 +30,7 @@ private: typedef std::char_traits Traits; // Work in buffer mode. It is also possible to work without buffer. - static size_t const BUF_SIZE = 128; + static size_t const BUF_SIZE = 150; char buf[BUF_SIZE]; // In this function, the characters are parsed. diff --git a/serviceinterface/ServiceInterfaceStream.cpp b/serviceinterface/ServiceInterfaceStream.cpp index c2979f36..f52413a4 100644 --- a/serviceinterface/ServiceInterfaceStream.cpp +++ b/serviceinterface/ServiceInterfaceStream.cpp @@ -6,6 +6,6 @@ void ServiceInterfaceStream::setActive( bool myActive) { ServiceInterfaceStream::ServiceInterfaceStream(std::string set_message, uint16_t port) : - std::basic_ostream >(&buf), buf( - set_message, port) { + std::basic_ostream>(&buf), + buf(set_message, port) { } diff --git a/serviceinterface/ServiceInterfaceStream.h b/serviceinterface/ServiceInterfaceStream.h index 44cf1168..4a5b709f 100644 --- a/serviceinterface/ServiceInterfaceStream.h +++ b/serviceinterface/ServiceInterfaceStream.h @@ -14,7 +14,8 @@ extern std::ostream info; extern std::ostream warning; extern std::ostream error; -class ServiceInterfaceStream : public std::basic_ostream< char, std::char_traits< char > > { +class ServiceInterfaceStream : + public std::basic_ostream> { protected: ServiceInterfaceBuffer buf; public: @@ -23,5 +24,4 @@ public: }; - #endif /* FRAMEWORK_SERVICEINTERFACE_SERVICEINTERFACESTREAM_H_ */ diff --git a/tmtcservices/TmTcBridge.cpp b/tmtcservices/TmTcBridge.cpp index 6b563f98..8450494a 100644 --- a/tmtcservices/TmTcBridge.cpp +++ b/tmtcservices/TmTcBridge.cpp @@ -104,7 +104,7 @@ ReturnValue_t TmTcBridge::readTmQueue() { ReturnValue_t TmTcBridge::storeDownlinkData(TmTcMessage *message) { info << "TMTC Bridge: Comm Link down. " - "Saving packet ID to be sent later " << std::endl; + "Saving packet ID to be sent later\r\n" << std::flush; store_address_t storeId; if(fifo.full()) { @@ -124,7 +124,7 @@ ReturnValue_t TmTcBridge::sendStoredTm() { ReturnValue_t result = RETURN_OK; while(!fifo.empty() && counter < MAX_STORED_DATA_SENT_PER_CYCLE) { info << "UDP Server: Sending stored TM data. There are " - << (int) fifo.size() << " left to send" << std::endl; + << (int) fifo.size() << " left to send\r\n" << std::flush; store_address_t storeId; const uint8_t* data = NULL; size_t size = 0;