WIP: somethings wrong.. #19
@ -138,10 +138,8 @@ ReturnValue_t BinarySemaphore::giveBinarySemaphoreFromISR(SemaphoreHandle_t sema
|
|||||||
BaseType_t returncode = xSemaphoreGiveFromISR(semaphore, higherPriorityTaskWoken);
|
BaseType_t returncode = xSemaphoreGiveFromISR(semaphore, higherPriorityTaskWoken);
|
||||||
if (returncode == pdPASS) {
|
if (returncode == pdPASS) {
|
||||||
if(*higherPriorityTaskWoken == pdPASS) {
|
if(*higherPriorityTaskWoken == pdPASS) {
|
||||||
// Request context switch
|
// Request context switch because unblocking the semaphore
|
||||||
// TODO: I don't know if this will ever happen but if it does,
|
// caused a high priority task unblock.
|
||||||
// I want to to know in case this causes issues. If it doesn't
|
|
||||||
// we should remove this.
|
|
||||||
TaskManagement::requestContextSwitch(CallContext::isr);
|
TaskManagement::requestContextSwitch(CallContext::isr);
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
@ -27,8 +27,8 @@ int ServiceInterfaceBuffer::sync(void) {
|
|||||||
Clock::TimeOfDay_t loggerTime;
|
Clock::TimeOfDay_t loggerTime;
|
||||||
Clock::getDateAndTime(&loggerTime);
|
Clock::getDateAndTime(&loggerTime);
|
||||||
char preamble[96] = { 0 };
|
char preamble[96] = { 0 };
|
||||||
sprintf(preamble, "%s: | %" PRIu32 ":%02" PRIu32 ":%02" PRIu32 ".%03" PRIu32 " | ",
|
sprintf(preamble, "\r%s: | %" PRIu32 ":%02" PRIu32 ":%02" PRIu32
|
||||||
this->log_message.c_str(),
|
".%03" PRIu32 " | ", this->log_message.c_str(),
|
||||||
loggerTime.hour,
|
loggerTime.hour,
|
||||||
loggerTime.minute,
|
loggerTime.minute,
|
||||||
loggerTime.second,
|
loggerTime.second,
|
||||||
@ -45,7 +45,8 @@ int ServiceInterfaceBuffer::sync(void) {
|
|||||||
|
|
||||||
#ifndef UT699
|
#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->log_message = set_message;
|
||||||
this->isActive = true;
|
this->isActive = true;
|
||||||
setp( buf, buf + BUF_SIZE );
|
setp( buf, buf + BUF_SIZE );
|
||||||
@ -59,7 +60,7 @@ void ServiceInterfaceBuffer::putChars(char const* begin, char const* end) {
|
|||||||
}
|
}
|
||||||
memcpy(array, begin, length);
|
memcpy(array, begin, length);
|
||||||
|
|
||||||
for( ; begin != end; begin++){
|
for(; begin != end; begin++){
|
||||||
printChar(begin);
|
printChar(begin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
#ifndef UT699
|
#ifndef UT699
|
||||||
class ServiceInterfaceBuffer: public std::basic_streambuf<char,
|
class ServiceInterfaceBuffer:
|
||||||
std::char_traits<char> > {
|
public std::basic_streambuf<char,std::char_traits<char>> {
|
||||||
friend class ServiceInterfaceStream;
|
friend class ServiceInterfaceStream;
|
||||||
public:
|
public:
|
||||||
ServiceInterfaceBuffer(std::string set_message, uint16_t port);
|
ServiceInterfaceBuffer(std::string set_message, uint16_t port);
|
||||||
@ -17,11 +17,11 @@ protected:
|
|||||||
// This is called when buffer becomes full. If
|
// This is called when buffer becomes full. If
|
||||||
// buffer is not used, then this is called every
|
// buffer is not used, then this is called every
|
||||||
// time when characters are put to stream.
|
// 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,
|
// This function is called when stream is flushed,
|
||||||
// for example when std::endl is put to stream.
|
// for example when std::endl is put to stream.
|
||||||
virtual int sync(void);
|
int sync(void) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// For additional message information
|
// For additional message information
|
||||||
@ -30,7 +30,7 @@ private:
|
|||||||
typedef std::char_traits<char> Traits;
|
typedef std::char_traits<char> Traits;
|
||||||
|
|
||||||
// Work in buffer mode. It is also possible to work without buffer.
|
// 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];
|
char buf[BUF_SIZE];
|
||||||
|
|
||||||
// In this function, the characters are parsed.
|
// In this function, the characters are parsed.
|
||||||
|
@ -6,6 +6,6 @@ void ServiceInterfaceStream::setActive( bool myActive) {
|
|||||||
|
|
||||||
ServiceInterfaceStream::ServiceInterfaceStream(std::string set_message,
|
ServiceInterfaceStream::ServiceInterfaceStream(std::string set_message,
|
||||||
uint16_t port) :
|
uint16_t port) :
|
||||||
std::basic_ostream<char, std::char_traits<char> >(&buf), buf(
|
std::basic_ostream<char, std::char_traits<char>>(&buf),
|
||||||
set_message, port) {
|
buf(set_message, port) {
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,8 @@ extern std::ostream info;
|
|||||||
extern std::ostream warning;
|
extern std::ostream warning;
|
||||||
extern std::ostream error;
|
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:
|
protected:
|
||||||
ServiceInterfaceBuffer buf;
|
ServiceInterfaceBuffer buf;
|
||||||
public:
|
public:
|
||||||
@ -23,5 +24,4 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* FRAMEWORK_SERVICEINTERFACE_SERVICEINTERFACESTREAM_H_ */
|
#endif /* FRAMEWORK_SERVICEINTERFACE_SERVICEINTERFACESTREAM_H_ */
|
||||||
|
@ -104,7 +104,7 @@ ReturnValue_t TmTcBridge::readTmQueue() {
|
|||||||
|
|
||||||
ReturnValue_t TmTcBridge::storeDownlinkData(TmTcMessage *message) {
|
ReturnValue_t TmTcBridge::storeDownlinkData(TmTcMessage *message) {
|
||||||
info << "TMTC Bridge: Comm Link down. "
|
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;
|
store_address_t storeId;
|
||||||
|
|
||||||
if(fifo.full()) {
|
if(fifo.full()) {
|
||||||
@ -124,7 +124,7 @@ ReturnValue_t TmTcBridge::sendStoredTm() {
|
|||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
while(!fifo.empty() && counter < MAX_STORED_DATA_SENT_PER_CYCLE) {
|
while(!fifo.empty() && counter < MAX_STORED_DATA_SENT_PER_CYCLE) {
|
||||||
info << "UDP Server: Sending stored TM data. There are "
|
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;
|
store_address_t storeId;
|
||||||
const uint8_t* data = NULL;
|
const uint8_t* data = NULL;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user