esp8266_web_settings beta
|
An implementation of a Web Server supporting setting panels.
HTTPS is not supported. Minimal authentication - a single id/password - is supported for save, reboot, factory defaults, and upload.
The server supports the following pages or requests:
Save
, Reset Form
, Reboot
, Factory Defaults
, and Uplaod Firmware
.on_save
callback is invoked.on_restart
callback. Performs no other action. Unprotected.on_factory_reset
callback. Performs no other action. Unprotected.If the on_restart
or on_factory_reset
callbacks are not provided (i.e. are null), the associated URLs will not be registered. The '/upload' URL will also not be registered if the on_restart
callback is null.
The main page is written to storage (TinyFS) in the setup
method, and served directly from storage thereafter. Sufficient storage must be available for the complete main page.
A 404 handler is also installed. When SoftAP mode is detected, this will return a 302 response redirecting the page to the root page. This makes the server function as a captive portal in this mode. When the system is not in SoftAP mode, a simple 404 page is returned.
The on_save
callback should save and apply settings.
The on_reboot
callback should set a flag to indicate a reboot has been requested, and perform this in the main loop after a short delay (e.g. 100ms) by calling ESP.restart()
.
The on_factory_reset
callback should set a flag to indcate a factory reset has been requested, and perform this in the main loop after a short delay. To reset, the following operations should be performed: LittleFS.format()
and/or TinyFS.format()
, depending on which file systems are in use.
ESP.eraseConfig()
.ESP.reset()
.This uses the ESP Asynch Web Server to serve the page.