ESP32 Support

See \ref esp32 for details on how to build lws as a component in an ESP-IDF project.

Lws provides a “factory” application

https://github.com/warmcat/lws-esp32-factory

and a test application which implements the generic lws server test apps

https://github.com/warmcat/lws-esp32-test-server-demos

The behaviours of the generic factory are are quite rich, and cover uploading SSL certs through factory and user configuration, AP selection and passphrase entry, and managing a switch to allow the user to force entry to user setup mode at boot subsequently.

The factory app comes with partitioning for a 1MB factory partition containing that app and data, and a single 2.9MB OTA partition containing the main app.

The factory app is able to do OTA updates for both the factory and OTA partition slots; updating the factory slot first writes the new image to the OTA slot and copies it into place at the next boot, after which the user can reload the OTA slot.

StateImageAP SSIDPortURLMode
Factory Reset or UninitializedFactoryAP: ESP_01234580http://192.168.4.1factory.html - to set certificates and serial
User configurationFactoryAP: config-model-serial443https://192.168.4.1index.html - user set up his AP information
OperationOTAStation only443https://model-serial.localOTA application

Basic Auth

The lws-esp32-test-server-demos app also demos basic auth.

On a normal platform this is done by binding a mount to a text file somewhere in the filesystem, which contains user:password information one per line.

On ESP32 there is not necessarily any generic VFS in use. So instead, the basic auth lookup is bound to a given nvs domain, where the username is the key and the password the value. main/main.c in the test demos app shows how to both make the mount use basic auth, and how to set a user:password combination using nvs.