1
0
forked from fsfw/fsfw

Serial Buffer dapter changes reverted

CCSDS time bugfixes in separate section (for C98)
Serial buffer adapter 2 bugfixes
This commit is contained in:
2020-01-31 00:54:34 +01:00
parent 09144b18c4
commit 5190e4c16e
3 changed files with 16 additions and 12 deletions

View File

@ -1,6 +1,7 @@
#include <framework/timemanager/Clock.h>
#include <framework/serviceinterface/ServiceInterfaceBuffer.h>
#include <cstring>
#include <inttypes.h>
// to be implemented by bsp
extern "C" void printChar(const char*);
@ -21,18 +22,17 @@ int ServiceInterfaceBuffer::overflow(int c) {
return 0;
}
// custom stdio.c library for at91sam9g20 chip which does not support unsigned long
// So I cast (unsigned int) on loggerTimes
int ServiceInterfaceBuffer::sync(void) {
if (this->isActive) {
Clock::TimeOfDay_t loggerTime;
Clock::getDateAndTime(&loggerTime);
char preamble[96] = { 0 };
sprintf(preamble, "%s: | %u:%02u:%02u.%03u | ",
this->log_message.c_str(), (unsigned int) loggerTime.hour,
(unsigned int) loggerTime.minute,
(unsigned int) loggerTime.second,
(unsigned int) loggerTime.usecond /1000);
sprintf(preamble, "%s: | %" PRIu32 ":%02" PRIu32 ":%02" PRIu32 ".%03" PRIu32 " | ",
this->log_message.c_str(),
loggerTime.hour,
loggerTime.minute,
loggerTime.second,
loggerTime.usecond /1000);
// Write log_message and time
this->putChars(preamble, preamble + sizeof(preamble));
// Handle output