fishy-wifi icon indicating copy to clipboard operation
fishy-wifi copied to clipboard

Refactoring waterelf32

Open cgmcintyr opened this issue 6 years ago • 10 comments

Issue for refactoring https://github.com/hamishcunningham/fishy-wifi/blob/c7e3cb415f0ee15786c1d1fe610efdc433e5f889/ardesp/waterelf32/waterelf32.ino

cgmcintyr avatar Nov 15 '17 15:11 cgmcintyr

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...

layerzerolabs avatar Nov 17 '17 14:11 layerzerolabs

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.

Eroc33 avatar Nov 18 '17 15:11 Eroc33

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

hamishcunningham avatar Nov 20 '17 09:11 hamishcunningham

Going to look at this issue this weekend. See if i can make any changes by Tuesday (5th)

EWLewis avatar Dec 02 '17 12:12 EWLewis

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.

cgmcintyr avatar Dec 02 '17 14:12 cgmcintyr

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 avatar Dec 02 '17 14:12 Eroc33

@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.

cgmcintyr avatar Dec 02 '17 15:12 cgmcintyr

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?

Eroc33 avatar Dec 02 '17 15:12 Eroc33

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.

EWLewis avatar Dec 02 '17 17:12 EWLewis

OK - good luck and look forward to seeing the pull request & documentation!

layerzerolabs avatar Dec 02 '17 19:12 layerzerolabs