New API xTaskPeriodicDelay (#1349) - #1368
Conversation
25ed0e3 to
e1eb15a
Compare
|
|
Is this not solved by the timer task? |
Not sure what to answer here. This PR just implements |
|
@archigup this could be implemented with a signalling mechanism + a software timer task however that is more setup than simply calling this function. For that reason and because it avoids the runaway problem of |
e1eb15a to
5e7424f
Compare
|
I'm not particularly worried about the failing UTs as those will need to be added. |
4388bac to
61d6849
Compare
|
|
@kstribrnAmzn Many thanks for the review. I force-pushed before realizing you rebased, so I force-pushed again... sorry for the mess. Some issues you raised are still open though. In the specific, I don't know how to solve the |
New function to be used for periodic tasks to ensure a constant execution frequency. It is intended to supersede xTaskDelayUntil to overcome its shortcomings, that is: - avoid run away of pxPreviousWakeTime (FreeRTOS#1339) - catch up any skipped period immediately (and update pxPreviousWakeTime accordingly), notify the caller of the number of periods skipped (by returning them) and wait until the next period (it could be less than xTimeIncrement if we are close to the next period) - notify the caller when not enough ticks have been elapsed (by returning 0) and handle the situation gracefully (by properly waiting until the next wake time) Signed-off-by: Nicola Fontana <ntd@entidi.it>
61d6849 to
f55b216
Compare
The condition always evaluates to true.
|
I've applied the simplification from #1368 (comment). Otherwise this PR looks great! I'm going to run the checks now. The only one which should fail is the unit tests since you've introduced a new API. That's not a worry. This is easy enough to fix with a PR to FreeRTOS/FreeRTOS. I'll have this merge in by the end of the day. |
|



New function to be used for periodic tasks to ensure a constant execution frequency. It is intended to supersede xTaskDelayUntil to overcome its shortcomings, that is:
Description
Test Steps
I tested that function on my ESP-IDF setup, directly running the resulting binary on an ESP32-S3 evaluation board. I would be more than happy to provide a unit test but I simply don't know how to do it.
This is the code I used:
and here are the results:
Checklist:
Related Issue
#1349
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.