Skip to content

RFC: Embedded resources#87

Merged
glynhudson merged 9 commits intoOpenEVSE:masterfrom
jeremypoulter:server_improvements
Sep 9, 2017
Merged

RFC: Embedded resources#87
glynhudson merged 9 commits intoOpenEVSE:masterfrom
jeremypoulter:server_improvements

Conversation

@jeremypoulter
Copy link
Copy Markdown
Collaborator

This is an extension to #83 to embed the web app resources into the firmware instead of SPIFFS.

Initially this was intended to enable directly streaming data from flash, however depending on lower levels of the TCP stack to to perform unaligned reads is not practical.

It however also offers some other benefits;

This is an initial version of code to combine and minify the HTML, CSS and JS.

The idea is that, when minified and combined, there will be less resources used on the ESP and lower memory usage.

This will also allow config.js to be split up in to multiple files and maybe allow conditional building to merge the code base with EmonESP, etc.

On the downside the HTML now has to be 'compiled' which can slow down development.

The minifying is done mostly in pure Python and intergrated in to the PlatformIO build process so no additional instilation steps are required.

The exception to this is the JS minification which is done using a web service (the Python minifyer is broken) so you need to be online when building.
This stops the files being built if nothing has changed.
Initially this was intended to enable directly straming data from flash, however depending on lowwere levels of the TCP stack to to perform unaligned reads is not practical.

It also offers some other benefits;
- Should be a bit faster, no file system to navigate
- Uses less memory
- All web server resources are in the firmware so no separate SPIFFS partition to update
- SPIFFS requires a large chunk of memory, which is not needed
@glynhudson
Copy link
Copy Markdown
Contributor

Wow, nice work. I've been testing for a few days and this has fixed #75 for me which is fantastic 👍

Also fixed #77 since SPIFFS upload is not required.

@glynhudson glynhudson merged commit ad86a43 into OpenEVSE:master Sep 9, 2017
@glynhudson
Copy link
Copy Markdown
Contributor

This is very clever. So do the web files in src/html get converted to .h files on platformio compile? Can src/data be removed now it's not used?

@jeremypoulter
Copy link
Copy Markdown
Collaborator Author

jeremypoulter commented Sep 10, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants