thebigpotatoe / Super-Simple-RGB-WiFi-Lamp

A project based on the ESP8266 and WS2812b
MIT License
66 stars 28 forks source link

Feature Request: Encapsulate settings / config in extra file #27

Open tristndev opened 4 years ago

tristndev commented 4 years ago

Hi all,

another idea that just came to my mind: Wouldn't it be good to move the configuration information (i.e., Wifi credentials, lamp setup (number of LEDs and their arrangement)) from the main code Super_Simple_RGB_WiFi_Lamp.ino into a separate file?

Maybe an according header file would do where you could define your variables.

Would make it a lot easier to keep your config when updating the code base, or also facilitate not including it in pushes to the repository.

What do you think?

thebigpotatoe commented 4 years ago

This is starting to sound like a library. Probably should start heading in that direction. But for now there is one reason why these variables are at the top of the main sketch; simplicity.

The project is meant for beginners. People who have never used Arduino or have an code experience, just a will to build the project.

So I wanted to reduce the number of steps it would take to set up the sketch and get it going. Adding another file may be confusing to navigate to and setup even if it was easier to read.

So maybe instead we can start pushing the code into a library instead where we can have header files and such for this reason. Would also allow us to build a nice API which would be human friendly and more verbose. What do you think

tristndev commented 4 years ago

In the long run, it probably makes sense to aim for a library.

But also in this state, excluding the config information would actually reduce complexity imho. Sure, it's one additional file, but therefore you have the config stuff isolated in there, i.e. the complexity of the rest is even more hidden.

Phantisy commented 4 years ago

Coming from 0 knowledge of Arduino, this project was the reason I bought one, and a very low lever beginner in coding, I personally would not find it hard to have a configuration library isolated. Just as long as the documentation is clear and easy to follow, I think it could work well. Many times I pushed my code and forgot that I needed to revert the config settings back to their original.

NemoN commented 4 years ago

Would also be an important feature for me (I had already started it in my fork).