added intial carriage return im preamble

This commit is contained in:
Robin Müller 2020-04-10 17:06:06 +02:00
parent 841b28b65d
commit 69e9710bf1
6 changed files with 18 additions and 19 deletions

View File

@ -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;

View File

@ -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);
}

View File

@ -7,8 +7,8 @@
#include <cstdio>
#ifndef UT699
class ServiceInterfaceBuffer: public std::basic_streambuf<char,
std::char_traits<char> > {
class ServiceInterfaceBuffer:
public std::basic_streambuf<char,std::char_traits<char>> {
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<char> 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.

View File

@ -6,6 +6,6 @@ void ServiceInterfaceStream::setActive( bool myActive) {
ServiceInterfaceStream::ServiceInterfaceStream(std::string set_message,
uint16_t port) :
std::basic_ostream<char, std::char_traits<char> >(&buf), buf(
set_message, port) {
std::basic_ostream<char, std::char_traits<char>>(&buf),
buf(set_message, port) {
}

View File

@ -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<char, std::char_traits<char>> {
protected:
ServiceInterfaceBuffer buf;
public:
@ -23,5 +24,4 @@ public:
};
#endif /* FRAMEWORK_SERVICEINTERFACE_SERVICEINTERFACESTREAM_H_ */

View File

@ -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;