Page 1 of 1

How do you share data between modules

Posted: Thu Dec 28, 2017 4:48 pm
by meneldor
Hello, this is my first post here.

I am in the middle of my ESP32 project where i mostly use Kolban's cpp libraries. All my different modules are almost done Web config using SPIFFS, Wifi, sensor readings, etc. Before trying to link them all i want to ask here how do you route the data from example sensor reading tasks to web client?
I am using WebSocketHandler in my code to read the WebSocket buffer in onMessage handle but WebSocketHandler class doesnt keep a reference to WebSocket or HttpServer classes. So either i should use static variables or queues between the different RTOS tasks.

Please give me some tips :)

Re: How do you share data between modules

Posted: Thu Dec 28, 2017 9:20 pm
by Gfast2

Re: How do you share data between modules

Posted: Thu Dec 28, 2017 9:52 pm
by meneldor
The queue is not universal solution. In my app_main i have an wifi object started softAP controlled in callbacks. Then HTTPServer using WebSocketHandler. My Web config interface is served by the web server from Spiffs and it uses WebSocket to transfer data and scan results for access points back and forth. I cannot block any of them waiting to read from queue.
May be a static instances of the modules for direct control can help in my case.

Re: How do you share data between modules

Posted: Fri Dec 29, 2017 10:12 am
by Gfast2
Hi meneldor,

https://www.freertos.org/a00118.html

This can do not block your code. Please read this API reference.

P.S.
If you wanna let the others understand your software structure even faster, you really wanna try to draw a chart. I use http://www.draw.io in case you do not have one. :lol:

cheers

Gfast2