Inter-task Communication: pass the same payload through more then two tasks
Posted: Fri Aug 11, 2017 2:17 am
Hi ESP32ers,
Recently I got some small problem about "Inter-task Communication".
The test set is: If I trigger a button (one of five). I need to track this event in one task, put message like the new state of the button, the number of the button and timestamp of this event as payload, and pass this payload to other tasks. The event queue has solve my problem pretty well. But if I'd like to have multiple receivers - say I'd like to display these infos by my "display_task", then write it down on a sd card by my "sdcard_task", then send it to thingspeak through my "internet_task". I think "EventGroups" and "Queues" are only part of the story.
I've solve this problem somehow by "chaining" these tasks through separately defined queues together.
Task1 ---- (task1_to_task2_queue)--->Task2---(task2_to_task3_queue)--->Task3 ...
For just one single event, I'd have to init TASK_SUM_NUM-1 queues in order to chaining them together (sync). It is a huge wast of memory and very error prone. Any suggestion on this point?
(This is a duplicated question which I asked pcbreflux in youtube comment session. He homebrewed a whole lot cool tutorials. Highly respect!)
Recently I got some small problem about "Inter-task Communication".
The test set is: If I trigger a button (one of five). I need to track this event in one task, put message like the new state of the button, the number of the button and timestamp of this event as payload, and pass this payload to other tasks. The event queue has solve my problem pretty well. But if I'd like to have multiple receivers - say I'd like to display these infos by my "display_task", then write it down on a sd card by my "sdcard_task", then send it to thingspeak through my "internet_task". I think "EventGroups" and "Queues" are only part of the story.
I've solve this problem somehow by "chaining" these tasks through separately defined queues together.
Task1 ---- (task1_to_task2_queue)--->Task2---(task2_to_task3_queue)--->Task3 ...
For just one single event, I'd have to init TASK_SUM_NUM-1 queues in order to chaining them together (sync). It is a huge wast of memory and very error prone. Any suggestion on this point?
(This is a duplicated question which I asked pcbreflux in youtube comment session. He homebrewed a whole lot cool tutorials. Highly respect!)