fishy-wifi
fishy-wifi copied to clipboard
Refactoring waterelf32
Issue for refactoring https://github.com/hamishcunningham/fishy-wifi/blob/c7e3cb415f0ee15786c1d1fe610efdc433e5f889/ardesp/waterelf32/waterelf32.ino
Less is more, this issue looks fine really, I'm just nit-picking; but I'd suggest that instead of 'issue for refactoring' saying just a few words about the actual issue e.g. Codebase has grown organically and would benefit from tidying up...
A suggestion I have that might fit into the vein of general refactoring is to turn on warnings (by default the arduino compiler suppresses all warnings, which imo is crazy) and fix them.
Good ideas.
Let's try and find some time, perhaps during the lecture slot today, to walk through the code a little? I vaguely remember several potential cleanups, but will need to study a little to bring them to mind...
Cheers, H
Going to look at this issue this weekend. See if i can make any changes by Tuesday (5th)
I was thinking of moving from Arduino IDE to the esp IoT development framework. This would help with breaking the waterelf32 into modular components.
Have a read through the esp-idf docs and let me know what you guys think.
There's a project template we could use. Though we might want to create a new branch to limit disruptions to the current waterelf32 code.
Just an fyi: you can use most of the esp-idf features in esp-arduino projects anyway as esp-arduino build on the IDF, and includes the IDF headers.
@Eroc33 I was thinking more the flexibility of a Makefile, sdkconfig, and seperate directories for components.
For example there could be a separate directory for everything related to the webserver/webpage, for streaming data, for setting up sensors, for joinme, etc. See esp-idf's example project.
One big problem I see with that is that we probably lose the ability to use several of the sensor libraries we're depending on. Also afaict it's possible to have subdirectories in an arduino sketch. As far as makefiles go I'm not really sure of the advantages or disadvantages that would bring?
I am going to take out the variable declarations that are above each function. Putting them into a header file, tidying up the code. Also look into putting the utility functions into a seperate file.
OK - good luck and look forward to seeing the pull request & documentation!