Comments (2)
You make some excellent points, both of which I am aware of myself. The problem is I have played around with many implementations of web pages on the ESP8266, and found that all methods had pro's and con's depending on what was trying to be implemented.
I haven't published how I make changes to the web page, but essentially, I have the website.html file which is packaged in this repo. In there is the exact copy of the website written into C found in the Web_Server.ino file.
What I do is make changes in the HTML file in something like visual studio code with a HTML editing add on. This allows me to make changes and debug it much faster as I can load the HTML file in a browser and make changes very quickly.
After editing I found the best way to get it onto the ESP was a couple of search and replace tricks leveraging REGEX inside the find and replace option in VS code. This at line 19 is in the Web_Server.ino file so I can remember it. Through copy and paste, it takes no time at all to just overwrite the html section of the Arduino code with the new updated webserver.
The reason I wrap each line instead of just copy and pasting the whole document into say flash or a .index file like you have linked, is that it reduces the amount of RAM used at one time. I am no expert on this, so I could be approaching this completely wrong, but when compiled the total amount of global RAM used is much less. Especially for a large website like this one. And from what I have found, the website still loads pretty quickly anyway.
There was the option of uploading it to the SPIFFS, but I wanted to avoid this extra step for beginners as it is just another possible step to fail on. Thus the website is copy pasted directly into code like I mentioned above.
As for the maintainability and user friendliness of adding new items, you are right, it's pretty awful even in a HTML editor. This was just due to the fact I wrote it in a week for the competition on Instructables. So there is definitely potential to improve how it is written and if it can possibly dynamically create itself.
Perhaps a move towards having a really basic HTML template which adds menu items dynamically and allows the main C++ program to send it HTML code written by users for their mode (like in b). This would allow users to write how their mode should look in a tab on the web page. Something along these line perhaps?
from super-simple-rgb-wifi-lamp.
Sounds good. I also believe that the best way would be to make the pages partly dynamic. Maybe I'll take a closer look when I'm working on the next animation. Thanks! Closing this for the moment.
from super-simple-rgb-wifi-lamp.
Related Issues (19)
- Super-Simple-RGB-WiFi-Lamp (Clock, Night rider and Bell curve error) HOT 3
- Unable to compile the sketch HOT 3
- Error in compiling HOT 3
- Feature Request: Create global brightness slider in UI HOT 7
- No web interface HOT 7
- Feature Request: Encapsulate settings / config in extra file HOT 4
- Fadetoblack gives one extra full light glimp HOT 12
- Flickering LEDs + Possible solution HOT 10
- Library Development Discussion
- Switching between config pages allways turns on the Lamp HOT 3
- Add support for Amazon Alexa HOT 4
- Webpage not loading format or responding to light strip interaction HOT 4
- Miss spelling in web page HOT 1
- SaturationFade error HOT 1
- Problem: SSID and Password is not permanent HOT 1
- OTA HOT 3
- OTA not working most of the time HOT 6
- Suggestion HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from super-simple-rgb-wifi-lamp.