starter project - a question about implementation
Posted: Tue Jan 19, 2021 9:03 am
Hello.
I would like to ask a question about the implementation of a system that notifies the user of the temperature of a room and handles some other background tasks based on the temperature.
The scenario is the below:
A user can connect to a web server that will show a temperature real-time graph(this is based on the already implemented example on the github page).
The webserver will be hosted in the esp32 module.
The esp32 module will run a task that checks a DHT 22 module for the temperature of the room that it is located within.
The approach that i am facing my major problem with is how can i integrate the webserver and the task that checks the temperature and enable communication between them.
The idea is to have a controller within the webserver task that asks the other task, which checks the temperature.
I am required to implement it this way because, i dont know what might happen if i simply copy over the function that checks the temperature within the controller of the webserver and once a user is connected in order to view the graph the temperature questions that the ESP32 will ask the DHT will becomed doubled in the same amount of time.
That is why i wish to implement a path of communication between these two tasks so that the DHT task check the temperature/handles background logic and the Webserver task acts as a wrapper in order to get the data in the graph format.
I read about queues, but i am worried if i use the queues they simply hold data that are not requested by the webserver if no users are connected.
Can the above be implemented with message buffers? if so, can anyone share an example please?
Thanks for your time reading my starter post
I would like to ask a question about the implementation of a system that notifies the user of the temperature of a room and handles some other background tasks based on the temperature.
The scenario is the below:
A user can connect to a web server that will show a temperature real-time graph(this is based on the already implemented example on the github page).
The webserver will be hosted in the esp32 module.
The esp32 module will run a task that checks a DHT 22 module for the temperature of the room that it is located within.
The approach that i am facing my major problem with is how can i integrate the webserver and the task that checks the temperature and enable communication between them.
The idea is to have a controller within the webserver task that asks the other task, which checks the temperature.
I am required to implement it this way because, i dont know what might happen if i simply copy over the function that checks the temperature within the controller of the webserver and once a user is connected in order to view the graph the temperature questions that the ESP32 will ask the DHT will becomed doubled in the same amount of time.
That is why i wish to implement a path of communication between these two tasks so that the DHT task check the temperature/handles background logic and the Webserver task acts as a wrapper in order to get the data in the graph format.
I read about queues, but i am worried if i use the queues they simply hold data that are not requested by the webserver if no users are connected.
Can the above be implemented with message buffers? if so, can anyone share an example please?
Thanks for your time reading my starter post