mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-04 02:48:13 +10:00
Merge branch 'master' of https://github.com/tzapu/WiFiManager
This commit is contained in:
+6
-1
@@ -3772,6 +3772,11 @@ void WiFiManager::handleUpdating(){
|
|||||||
DEBUG_WM(DEBUG_VERBOSE,"Update file: ", upload.filename.c_str());
|
DEBUG_WM(DEBUG_VERBOSE,"Update file: ", upload.filename.c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Update.onProgress(THandlerFunction_Progress fn);
|
||||||
|
// Update.onProgress([](unsigned int progress, unsigned int total) {
|
||||||
|
// Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
|
||||||
|
// });
|
||||||
|
|
||||||
if (!Update.begin(maxSketchSpace)) { // start with max available size
|
if (!Update.begin(maxSketchSpace)) { // start with max available size
|
||||||
#ifdef WM_DEBUG_LEVEL
|
#ifdef WM_DEBUG_LEVEL
|
||||||
DEBUG_WM(DEBUG_ERROR,F("[ERROR] OTA Update ERROR"), Update.getError());
|
DEBUG_WM(DEBUG_ERROR,F("[ERROR] OTA Update ERROR"), Update.getError());
|
||||||
@@ -3782,7 +3787,7 @@ void WiFiManager::handleUpdating(){
|
|||||||
}
|
}
|
||||||
// UPLOAD WRITE
|
// UPLOAD WRITE
|
||||||
else if (upload.status == UPLOAD_FILE_WRITE) {
|
else if (upload.status == UPLOAD_FILE_WRITE) {
|
||||||
Serial.print(".");
|
// Serial.print(".");
|
||||||
if (Update.write(upload.buf, upload.currentSize) != upload.currentSize) {
|
if (Update.write(upload.buf, upload.currentSize) != upload.currentSize) {
|
||||||
#ifdef WM_DEBUG_LEVEL
|
#ifdef WM_DEBUG_LEVEL
|
||||||
DEBUG_WM(DEBUG_ERROR,F("[ERROR] OTA Update WRITE ERROR"), Update.getError());
|
DEBUG_WM(DEBUG_ERROR,F("[ERROR] OTA Update WRITE ERROR"), Update.getError());
|
||||||
|
|||||||
@@ -34,6 +34,21 @@ bool WMISBLOCKING = true; // use blocking or non blocking mode, non global pa
|
|||||||
// char ssid[] = "*************"; // your network SSID (name)
|
// char ssid[] = "*************"; // your network SSID (name)
|
||||||
// char pass[] = "********"; // your network password
|
// char pass[] = "********"; // your network password
|
||||||
|
|
||||||
|
// called after AP mode and config portal has started
|
||||||
|
// setAPCallback( std::function<void(WiFiManager*)> func );
|
||||||
|
// called after webserver has started
|
||||||
|
// setWebServerCallback( std::function<void()> func );
|
||||||
|
// called when settings reset have been triggered
|
||||||
|
// setConfigResetCallback( std::function<void()> func );
|
||||||
|
// called when wifi settings have been changed and connection was successful ( or setBreakAfterConfig(true) )
|
||||||
|
// setSaveConfigCallback( std::function<void()> func );
|
||||||
|
// called when saving either params-in-wifi or params page
|
||||||
|
// setSaveParamsCallback( std::function<void()> func );
|
||||||
|
// called when saving params-in-wifi or params before anything else happens (eg wifi)
|
||||||
|
// setPreSaveConfigCallback( std::function<void()> func );
|
||||||
|
// called just before doing OTA update
|
||||||
|
// setPreOtaUpdateCallback( std::function<void()> func );
|
||||||
|
|
||||||
void saveWifiCallback(){
|
void saveWifiCallback(){
|
||||||
Serial.println("[CALLBACK] saveCallback fired");
|
Serial.println("[CALLBACK] saveCallback fired");
|
||||||
}
|
}
|
||||||
@@ -64,6 +79,12 @@ void handleRoute(){
|
|||||||
wm.server->send(200, "text/plain", "hello from user code");
|
wm.server->send(200, "text/plain", "hello from user code");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void handlePreOtaUpdateCallback(){
|
||||||
|
Update.onProgress([](unsigned int progress, unsigned int total) {
|
||||||
|
Serial.printf("CUSTOM Progress: %u%%\r", (progress / (total / 100)));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP
|
// WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP
|
||||||
|
|
||||||
@@ -129,6 +150,7 @@ void setup() {
|
|||||||
wm.setWebServerCallback(bindServerCallback);
|
wm.setWebServerCallback(bindServerCallback);
|
||||||
wm.setSaveConfigCallback(saveWifiCallback);
|
wm.setSaveConfigCallback(saveWifiCallback);
|
||||||
wm.setSaveParamsCallback(saveParamCallback);
|
wm.setSaveParamsCallback(saveParamCallback);
|
||||||
|
wm.setPreOtaUpdateCallback(handlePreOtaUpdateCallback);
|
||||||
|
|
||||||
// add all your parameters here
|
// add all your parameters here
|
||||||
wm.addParameter(&custom_html);
|
wm.addParameter(&custom_html);
|
||||||
|
|||||||
Reference in New Issue
Block a user