Merge branch 'mueller/master' of https://egit.irs.uni-stuttgart.de/fsfw/fsfw into mueller/master

This commit is contained in:
Robin Müller 2021-01-05 16:44:52 +01:00
commit fbb063ceda
2 changed files with 23 additions and 10 deletions

View File

@ -37,15 +37,24 @@ ReturnValue_t Clock::setClock(const TimeOfDay_t* time) {
}
ReturnValue_t Clock::setClock(const timeval* time) {
//TODO This routine uses _TOD_Set which is not
timespec newTime;
newTime.tv_sec = time->tv_sec;
if(time->tv_usec < 0) {
// better returnvalue.
return HasReturnvaluesIF::RETURN_FAILED;
}
newTime.tv_nsec = time->tv_usec * TOD_NANOSECONDS_PER_MICROSECOND;
//SHOULDDO: Not sure if we need to protect this call somehow (by thread lock or something).
//Uli: rtems docu says you can call this from an ISR, not sure if this means no protetion needed
//TODO Second parameter is ISR_lock_Context
_TOD_Set(&newTime,nullptr);
return HasReturnvaluesIF::RETURN_OK;
ISR_lock_Context context;
_TOD_Lock();
_TOD_Acquire(&context);
Status_Control status = _TOD_Set(&newTime, &context);
_TOD_Unlock();
if(status == STATUS_SUCCESSFUL) {
return HasReturnvaluesIF::RETURN_OK;
}
// better returnvalue
return HasReturnvaluesIF::RETURN_FAILED;
}
ReturnValue_t Clock::getClock_timeval(timeval* time) {
@ -95,6 +104,7 @@ ReturnValue_t Clock::getClock_usecs(uint64_t* time) {
}
ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
// TIsn't this a bug? Are RTEMS ticks always microseconds?
rtems_time_of_day* timeRtems = reinterpret_cast<rtems_time_of_day*>(time);
rtems_status_code status = rtems_clock_get_tod(timeRtems);
switch (status) {

View File

@ -28,18 +28,21 @@ ServiceInterfaceBuffer::ServiceInterfaceBuffer(std::string setMessage,
}
#if FSFW_COLORED_OUTPUT == 1
if(setMessage.find("DEBUG")) {
if(setMessage.find("DEBUG") != std::string::npos) {
colorPrefix = fsfw::ANSI_COLOR_MAGENTA;
}
else if(setMessage.find("INFO")) {
else if(setMessage.find("INFO") != std::string::npos) {
colorPrefix = fsfw::ANSI_COLOR_GREEN;
}
else if(setMessage.find("WARNING")) {
else if(setMessage.find("WARNING") != std::string::npos) {
colorPrefix = fsfw::ANSI_COLOR_YELLOW;
}
else if(setMessage.find("ERROR")) {
else if(setMessage.find("ERROR") != std::string::npos) {
colorPrefix = fsfw::ANSI_COLOR_RED;
}
else {
colorPrefix = fsfw::ANSI_COLOR_RESET;
}
#ifdef WIN32
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);