Team12-UofG / SmartGreenhouse

Advance your plant growing capability with the SmartGreenhouse using: real time sensor readings and historic data, and automated or manual watering, LED lighting and heating control.
http://192.168.1.186/index.html
GNU General Public License v3.0
31 stars 8 forks source link

Optimise the main code #15

Closed islasummer closed 5 years ago

islasummer commented 5 years ago

Thanks to the BME680 sensor requiring a large amount of time to read and process the temperature reading, the current code requires a large delay after the BME680 sensor has been fetched. This needs to be optimised. Consider:

islasummer commented 5 years ago

Current solution uses Bernd Porr's Cpp Timer Wrapper to upload values to the server at specific time intervals (every 10 seconds) in the main while loop which reads the sensors. Splitting up readings the sensors into a timing interval or separate thread is less efficient because of the initialising the BME680 structure and accessing it.

The next stage is making the watering system execute without blocking the rest of the main code.