How do you share data between modules

meneldor
Posts: 75
Joined: Mon Dec 25, 2017 7:28 am

How do you share data between modules

Postby meneldor » Thu Dec 28, 2017 4:48 pm

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 :)


meneldor
Posts: 75
Joined: Mon Dec 25, 2017 7:28 am

Re: How do you share data between modules

Postby meneldor » Thu Dec 28, 2017 9:52 pm

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.

User avatar
Gfast2
Posts: 182
Joined: Fri Aug 11, 2017 1:52 am

Re: How do you share data between modules

Postby Gfast2 » Fri Dec 29, 2017 10:12 am

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

Who is online

Users browsing this forum: No registered users and 140 guests