-
Notifications
You must be signed in to change notification settings - Fork 180
Avoid portTICK_PERIOD_MS usage in library code #1242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
portTICK_PERIOD_MS evaluates to zero when configTICK_RATE_HZ > 1000, which (while uncommon) is a valid configuration (e.g., for stress testing). To ensure compatibility and robustness, this change replaces its usage with safer FreeRTOS-provided time conversion macros. Notably, the FreeRTOS kernel itself avoids using portTICK_PERIOD_MS.
Hi @StefanBalt, Thank you for this PR. I will ping someone from the team to take a look. Best, Jason Carroll |
Thanks for this PR @StefanBalt Do you wish to update the usage of Also could you please apply the |
I will replace some of the usages.
Yes, I will also format the code. |
Use safer pdMS_TO_TICKS() macro instead. Keep some portTICK_PERIOD_MS usages to test both implementations.
Avoid
portTICK_PERIOD_MS
usage in library codeDescription
portTICK_PERIOD_MS
evaluates to zero whenconfigTICK_RATE_HZ > 1000
, which (while uncommon) is a valid configuration (e.g., for stress testing).To ensure compatibility and robustness, this change replaces its usage with safer FreeRTOS-provided time conversion macros
pdMS_TO_TICKS()
andpdTICKS_TO_MS()
.Notably, the FreeRTOS kernel itself avoids using
portTICK_PERIOD_MS
.Some of the conversion code was fixed as a side effect:
source/FreeRTOS_DNS_Cache.c
theulCurrentTimeSeconds
was not correctly converted to seconds previously, ifportTICK_PERIOD_MS != 1
source/include/FreeRTOSIPConfigDefaults.h
theportMAX_DELAY
multiplication would typically overflow previously (depending on the architecure)Test Steps
Checklist:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.