Closed HpLightcorner closed 4 years ago
Ah, I see that there was already a similar issue - not sure if we can fix that one.
At least I would suggest that adding a specific remark in the manual (or I have overseen it?) would be a good idea regarding this topic.
Yes, Duplicate of #2 Fixed in the last commit. Thanks.
Issue: When initialising the OS in the standard-mode using floating points (eg. 0.001s as base-time, 1s as periodic-task time) the task becomes alive every 0.999s instead of exactly one second.
Problem: I tracked down the issue to be in the function qClock_t qClock_Convert2Clock(const qTime_t t) - where following conversion from floating point qTime_t to qClock_t is done in the return statement:
so, epochs might become something like 999.99999998 when diving for example 1over 0.001 in the given example. The correct rounding to unsigned int for qClock_t type should be 1000 mS - but instead the conversion ends up with 999 mS - causing the task-offset from 1 mS.
Solution: To correctly get back 1000 mS, one could add a round in the conversion - with adding a hint in the manual what is going to happen on fractional numbers of a periodic task and the Timing-Base:
What do you think? Kind regards.