mueller_stopwatch #30

Merged
muellerr merged 18 commits from KSat/fsfw:mueller_stopwatch into master 2020-07-07 12:05:04 +02:00
Owner

Fixes #29 . Was tested with milliseconds and seconds output.

Fixes #29 . Was tested with milliseconds and seconds output.
Author
Owner

This is introduced in #29

This is introduced in #29
muellerr added the
feature
label 2020-04-30 22:01:34 +02:00
gaisser reviewed 2020-05-05 18:58:50 +02:00
gaisser left a comment
Owner

Added a few comments.I'm not an expert in the Timekeeper class, so i'm not sure why getTicks was added

Added a few comments.I'm not an expert in the Timekeeper class, so i'm not sure why getTicks was added
@ -1,20 +1,24 @@
#include "Timekeeper.h"
#include <FreeRTOSConfig.h>
/**
Owner

Where does this header comm from?

Where does this header comm from?
Author
Owner

I don't know. TickType_t is defined in partmacro.h (includes by FreeRTOS.h, just portmacro.h did not work I think) and xGetTickCount is part of task.h .

I don't know. TickType_t is defined in partmacro.h (includes by FreeRTOS.h, just portmacro.h did not work I think) and xGetTickCount is part of task.h .
Author
Owner

I now know where it comes from: The configTICK_RATE_HZ is used and is located
inside the FreeRTOSConfig.h file. This file needs to be in the include path in any case, but compiler/indexer warnings are always annoying, so I included it explicitely.

I now know where it comes from: The configTICK_RATE_HZ is used and is located inside the FreeRTOSConfig.h file. This file needs to be in the include path in any case, but compiler/indexer warnings are always annoying, so I included it explicitely.
@ -8,3 +8,3 @@
#include <framework/globalfunctions/timevalOperations.h>
typedef uint32_t millis_t;
Owner

Where are does types used?

Where are does types used?
Author
Owner

stopwatch. could also be used somewhere else, is more explicit in my opinion. maybe also use it instead of uint32_t for all milliseconds related stuff?

stopwatch. could also be used somewhere else, is more explicit in my opinion. maybe also use it instead of uint32_t for all milliseconds related stuff?
Owner

Hm I think we should stick with timeval and the types defined there. Someday this might be replaced by timespec and uint32_t will be to small anyway.

Hm I think we should stick with timeval and the types defined there. Someday this might be replaced by timespec and uint32_t will be to small anyway.
@ -9,2 +9,3 @@
typedef uint32_t millis_t;
typedef float seconds_t;
Owner

Seconds are converted to double in timevalOperations::toDouble(elapsedTime), this would not fit to the float type.

Seconds are converted to double in timevalOperations::toDouble(elapsedTime), this would not fit to the float type.
Author
Owner

second is double now

second is double now
@ -0,0 +24,4 @@
return elapsedTime.tv_sec * 1000 + elapsedTime.tv_usec / 1000;
}
seconds_t Stopwatch::stopSeconds() {
Owner

Here a float is returned but a double is calculated.

Here a float is returned but a double is calculated.
gaisser reviewed 2020-05-07 17:32:19 +02:00
@ -0,0 +30,4 @@
* object destruction
* @param displayMode Display format is either MS rounded or MS as double
* format
* @param outputPrecision If using double format, specify precision here.
Owner

The last part of the comment is outdated

The last part of the comment is outdated
Author
Owner

merged upstream master, doc corrected.

merged upstream master, doc corrected.
Author
Owner

UPDATE: The linux version does not compile because a static Clock.h function was not implemented in linux. Another problem is that the getUptime functions from Linux only provide seconds accuracy right now. Therefore, i will replace these calls by getClock_timeval() which should provide milliseconds accuracy for all systems.

UPDATE: The linux version does not compile because a static Clock.h function was not implemented in linux. Another problem is that the getUptime functions from Linux only provide seconds accuracy right now. Therefore, i will replace these calls by getClock_timeval() which should provide milliseconds accuracy for all systems.
muellerr reviewed 2020-05-29 17:53:57 +02:00
@ -65,6 +65,15 @@ ReturnValue_t Clock::getClock_usecs(uint64_t* time) {
return HasReturnvaluesIF::RETURN_OK;
}
timeval Clock::getUptime() {
Author
Owner

this static function was missing.

this static function was missing.
Owner

Ah great - That was quite a big bug.

Ah great - That was quite a big bug.
gaisser reviewed 2020-06-02 14:43:26 +02:00
Owner

I still don't think that those typedefs are a good idea. Maybe we should stick to the types timeval or timespec uses or even use the types C++11 uses in duration Link.

I still don't think that those typedefs are a good idea. Maybe we should stick to the types timeval or timespec uses or even use the types C++11 uses in duration [Link](https://www.cplusplus.com/reference/chrono/duration/).
muellerr reviewed 2020-06-02 20:52:46 +02:00
Author
Owner

Hmmm.. it just makes it a bit mor explicit. I guess you mean for example time_t ?

These typedefs were inteded to explicitely be used everywhere uint32_t is used to pass around millisecond values.

The new C++ types are a bit more complicated but the clock library will become more powerful soon anyway. I started to play around with the chrono library.
Maybe continue using uint32_t for now?

Hmmm.. it just makes it a bit mor explicit. I guess you mean for example time_t ? These typedefs were inteded to explicitely be used everywhere uint32_t is used to pass around millisecond values. The new C++ types are a bit more complicated but the clock library will become more powerful soon anyway. I started to play around with the chrono library. Maybe continue using uint32_t for now?
muellerr reviewed 2020-06-02 22:02:17 +02:00
Author
Owner

instead of writing something like uint32_t lockTimeout, I could write millis_t lockTimeout for example

instead of writing something like uint32_t lockTimeout, I could write millis_t lockTimeout for example
gaisser self-assigned this 2020-06-25 15:26:43 +02:00
muellerr closed this pull request 2020-07-07 12:05:04 +02:00
Sign in to join this conversation.
No description provided.