FreeRTOS / FreeRTOS-Kernel

FreeRTOS kernel files only, submoduled into https://github.com/FreeRTOS/FreeRTOS and various other repos.
https://www.FreeRTOS.org
MIT License
2.76k stars 1.12k forks source link

[Feature Request] Possible simplification of pdMS_TO_TICKS #889

Closed jputcu closed 11 months ago

jputcu commented 11 months ago

I've recently switched to using pdMS_TO_TICKS in my AVR code. Because the calculations where too heavy I've overruled it in my FreeRTOSConfig.h:

#define pdMS_TO_TICKS(ms) ((ms)/portTICK_PERIOD_MS)

Could this be a better alternative to the current implementation?

It actually only becomes expensive when the preprocessor can't calculate it e.g. on variables. A related issue even made it a bit heavier: #866.

RichardBarry commented 11 months ago

Thanks for your suggestion. Your proposed change reverts the macro to its original form, which had other issues. Hence, we made the macro overridable with a definition in FreeRTOSConfig.h, which it sounds like was useful in your case. For those reasons I will close this feature request. Grateful if you can post future ideas, which are very much welcome, to the support forum for discussion before opening tickets here. We ask this to keep the issues list in github as clean as possible - thanks.