420 Magazine Background

Arduinos In The Grow Room: My Project


Well-Known Member
that's the love and hate relationship i have with windows; the inevitable reload-it-to-make-it-faster cycle.

VS Code is a good alternative for Arduino development too, if you haven't tried it out. VStudio is pretty awesome already, so I wouldn't blame you for sticking with that.


Well-Known Member
I'll have a look, you haven't steered me wrong yet :) I am pretty comfortable in Visual Studio though, so we'll see.

Yeah, my computer is much better now, I hardly have time for a toke when I change folders, he he


Well-Known Member
I've got a new problem...

I ended up re-installing Windows, and now everything I compile for the ESP just throws it into an endless loop crashing and rebooting :( I have a full backup, I could restore my environment, but I'm not in a rush, everything is running well, so I don't need to recompile anything for the live system. I'll figure it out, then I can get back to the Switch Module and my new contactor relay for the lights :)

After scouring my code for anything that would cause the constant wdt reboots, I finally decided to compare the current version of the MySql Connector library against the backup I did before re-installing. When I re-installed Windows, I also downloaded and re-installed everything else, since I didn't want to restore stuff, that risked slowing things down again. Anyhow, I noticed a difference in file size in some of the .cpp files.


I backed up (renamed the folder) the new library I just installed, and then restored the version I was running before the re-install, and (knock on wood) so far, not a single reboot, but I've still got lots commented out. I'm sure this is the cause, once I confirm it, I can let the author know.



Well-Known Member
Looks like a change was made 8 days ago. This is the only change listed. It looks like lines 39 and 40 were added. I have no idea how or why it has caused the problem, but I think I can rest easy knowing that this is definitely the cause.



Well-Known Member
That's it folks, the admins have removed my signature and told me to stop posting links to my blog even though in my opinion, it does not conflict with this site. Unfortunately, this means no more posts here, as I'm not going to completely duplicate every post.

Thanks for all your interest in my DIY threads, hope you were inspired...


Well-Known Member
One final post, as it concludes my investigation into the problems I had with the MySQL Connector.

September 5, 2019

Happy, happy, happy... It's working again!

I'm so happy right now!

I finally found, and fixed, the problem with reading the sensor configurations when doing a sensor scan. If you've been following along, I had to close the database after each query or I was getting strange results. Generally it would load the first of two parts for the first sensor, and then all the rest would fail. By closing the database after each query, it all worked like magic.

In my investigations, which have been going on for a week now, I once noticed that when I did the query for part 2 of the config (there are too many fields to do it in one query due to memory) it would come back with a row, but none of my fields, and when I printed out the field names, they were left over from the part 1 query. I chalked this up to some sort of memory issue, something I must have done wrong, but it could be anywhere...

So, I started over again, I took the code from my rewrite of the switch module, because it was working, and had all the basic infrastructure., I only had to add the sensor module specific code, which for the most part, I just cut and paste. Each time I would add a tiny bit of code, compile it, upload it, and test it. Everything was fine until I added the code to read part 1 of the sensor config, which it did, the first time, then failed after that....

That's when I discovered the problem...

This sample query is not the one which caused the problem, this is just an example of a pretty standard sql query, and I've highlighted two lines I had intentionally removed from my query code when loading the sensor configuration. The do ... while loop loops through the resulting records from the query, however, like this query, I was only expecting a single record back so saw no reason to spend the extra time looping when there were no more records.

Once I added these two lines back into my queries (there were three altogether where I had removed them) I can remove the database close after each query, and everything is working again!

In retrospect, the fact I was seeing leftover field names from the previous query could have been a clue. I haven't looked at the library code enough to check, but it appears that a query returns at least one null row at the end of valid rows, the do while look ensures you have all the records.

By skipping the loop, and only grabbing the first record, somehow the next query first had to read the null row (with the field names from the first query) and this is what caused the problem? That's my working theory...

I'm going to leave it at that, I now know what I did wrong, every example for the library shows the do...while loop. I've gone back to my original rewrite code and fixed it, and I can move on, thankfully...

Because I don't have to close the database between queries, it runs much faster now too :)


Well-Known Member
Wow, it's been almost 2 1/2 months since I've updated things here... An awful lot has happened in that time. While I could never list all the changes here, and I'm not allowed to post links to my blog,I didn't want people to get the idea that I've given up, or stopped working on this project. I'm still plugging away full time, and having just as much fun as always.
Top Bottom