@@ -37,6 +37,10 @@ It will provide a webpage for updating the firmware/filesystem of `ESP8266` or `
3737- Update credentials customization (default: ` No credentials ` )
3838 - Username
3939 - Password
40+ - Update Events:
41+ - onUpdateBegin
42+ - onUpdateEnd
43+ - Force Aborting Update using events
4044- FileSystem Options:
4145 - SPIFFS
4246 - LittleFS
@@ -60,25 +64,44 @@ This Library is available in `Arduino Library Repository` and `PIO` and you can
6064```
61652 . Create an object from ` ESPAsyncHTTPUpdateServer `
6266``` C++
63- ESPAsyncHTTPUpdateServer _updateServer ;
64- AsyncWebServer _server (80);
67+ ESPAsyncHTTPUpdateServer updateServer ;
68+ AsyncWebServer server (80);
6569```
66703. Setup the update server before starting the webServer
6771``` C++
68- _updateServer .setup(&_server );
69- _server .begin();
72+ updateServer .setup(&server );
73+ server .begin();
7074```
7175#### Custom Route
7276``` C++
73- _updateServer .setup(&_server , " /customroute" );
77+ updateServer .setup(&server , " /customroute" );
7478```
7579#### Credentials
7680``` C++
77- _updateServer .setup(&_server , " username" , " password" );
81+ updateServer .setup(&server , " username" , " password" );
7882```
7983or
8084``` C++
81- _updateServer.setup(&_server, " /customroute" , " username" , " password" );
85+ updateServer.setup(&server, " /customroute" , " username" , " password" );
86+ ```
87+ #### Events
88+ ``` c++
89+ updateServer.onUpdateBegin = [](const UpdateType type, int &result)
90+ {
91+ //...
92+ };
93+
94+ updateServer.onUpdateEnd = [ ] (const UpdateType type, int &result)
95+ {
96+ //...
97+ };
98+ ```
99+ #### Aborting the update
100+ ```c++
101+ updateServer.onUpdateBegin = [](const UpdateType type, int &result)
102+ {
103+ result = UpdateResult::UPDATE_ABORT;
104+ };
82105```
83106
84107### Styling and Customizing OTA Page
0 commit comments