mueller_stopwatch #30
No reviewers
Labels
No Label
API Change
Breaking API Change
bug
build
cosmetics
Documentation
duplicate
feature
help wanted
hotfix
invalid
question
Refactor
Tests
wontfix
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: fsfw/fsfw#30
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "KSat/fsfw:mueller_stopwatch"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #29 . Was tested with milliseconds and seconds output.
This is introduced in #29
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>
/**
Where does this header comm from?
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 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;
Where are does types used?
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?
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;
Seconds are converted to double in timevalOperations::toDouble(elapsedTime), this would not fit to the float type.
second is double now
@ -0,0 +24,4 @@
return elapsedTime.tv_sec * 1000 + elapsedTime.tv_usec / 1000;
}
seconds_t Stopwatch::stopSeconds() {
Here a float is returned but a double is calculated.
@ -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.
The last part of the comment is outdated
merged upstream master, doc corrected.
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.
@ -65,6 +65,15 @@ ReturnValue_t Clock::getClock_usecs(uint64_t* time) {
return HasReturnvaluesIF::RETURN_OK;
}
timeval Clock::getUptime() {
this static function was missing.
Ah great - That was quite a big bug.
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.
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?
instead of writing something like uint32_t lockTimeout, I could write millis_t lockTimeout for example