August 2019 Update

While this site is still somewhat new, and still under construction, this project has been underway since roughly August 2018. Please excuse any unfinished pages, I'm still catching up!

New!
View the Feature Sheet by clicking HERE!

New to the site?

Project information can be found on the "Grow By Wire Site Links" panel. The right side of the screen consists of my blog posts, a window into my thought process as I work on the project.

Saturday, August 10, 2019

Down the rabbit hole!

Spent the day chasing bugs that weren't anywhere close to where I was looking :(

Everything was running great last night, all the data was being saved properly. I even added a comment to my blog post abouit the DHT22 fixes I did to reset them properly, saying that the reset worked every time it ran...

Almost immediately after posting that, it failed three times in about an hour, and Sensor Module 1 was loading either extra sensors (with duplicates) or not enough sensors, so I naturally assumed it was the new code I wrote for loading the sensors. I spent all day today analyzing, changing, adding debug logging, and pulling out what little hair I have left...  No luck, couldn't figure it out...

Then I decided to do the one thing I always do when something like this happens...

Dump the sql statement to the serial monitor, and copy and paste it into the MySql Workbench, and check the results...   yup, there's the duplicate records alright... 

It turns out that I had moved a couple plants from Veg into Flower, and the code somehow wrote two records to a database table (actuially, 2 tables, each had two copies of the relevant rtecord for the same sensor) Because of these duplicates, it cause the database view to return 4 copies of that record.

Removed the duplicate records, and everything seems to be running fine...
\
As for the DHT22, I added another reset in case the first one fails, hopefully that might help.

No comments:

Post a Comment