What is the right way to pass parameters to the xTaskCreatePinnedToCore function

User avatar
fasani
Posts: 197
Joined: Wed Jan 30, 2019 12:00 pm
Location: Barcelona
Contact:

What is the right way to pass parameters to the xTaskCreatePinnedToCore function

Postby fasani » Sun Jul 07, 2019 8:43 pm

Hello there,

I wanted to know if someone here can provide a code example about passing a pointer to xTaskCreatePinnedToCore and using in the callback function.

A bit of background on this simple project. Udpx is a firmware that receives compressed JSON data using the UDP protocol to display animations in addressable LED stripes.
So basically after connecting to WiFi it just hears from incoming udp packets and whatever is coming, is stored in a compressed array at a global level, and then xTaskCreatePinnedToCore is calling the brTask that is decompressing it using Brotli and then sending it to the NeoPixel library.
That part, the compressed being stored at global level, I think would be cleaner and better if it would be passed as a parameter in xTaskCreatePinnedToCore. I googled and saw some examples but I was still not capable of making it work. Compressed is basically a uint_8 array:

uint8_t * compressed;

My questions are:

1 .- Would be any benefit of passing this from xTaskCreatePinnedToCore directly to the task without having to store it as a global variable?
2 .- This is running approx. at 30 frames per second, which makes the ESP32 kind of warm, is there any possibility to optimize it?
3 .- Do you think this can run more efficiently if I recode it using ESP-IDF instead of using Arduino framework?
4 .- Is there a possible way on a ESP32 without PSRAM to do an efficient 2-3 seconds of data to avoid seing the UDP traffic inconsistencies? That would be at least storing 90 frames of 50 compressed bytes each so about 450 bytes

The project is ready to be tested with examples and a basic Readme file. Please just ask if I can give any other details and thank you in advance for your interest!
epdiy collaborator | http://fasani.de Fan of Espressif MCUs and electronic design

Who is online

Users browsing this forum: No registered users and 79 guests