Added unmounting of SPIFFS when using OTA. Added /formatspiffs URL
This commit is contained in:
parent
25a238ddad
commit
30220e3e58
2 changed files with 18 additions and 1 deletions
|
@ -110,6 +110,17 @@ void handleReset() {
|
||||||
wifiEnterConfigPortal(true, true, 3000);
|
wifiEnterConfigPortal(true, true, 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void handleFormat() {
|
||||||
|
server.send(200, "text/plain", "Formatting SPIFFS partition!");
|
||||||
|
DebugPort.println("Formatting SPIFFS partition");
|
||||||
|
delay(500);
|
||||||
|
SPIFFS.format();
|
||||||
|
//client.disconnect();
|
||||||
|
// wifi_station_disconnect();
|
||||||
|
// wm.disconnect();
|
||||||
|
// wm.resetSettings();
|
||||||
|
}
|
||||||
|
|
||||||
void handleBTCNotFound() {
|
void handleBTCNotFound() {
|
||||||
digitalWrite(led, 1);
|
digitalWrite(led, 1);
|
||||||
String message = "File Not Found\n\n";
|
String message = "File Not Found\n\n";
|
||||||
|
@ -138,6 +149,7 @@ void initWebServer(void) {
|
||||||
|
|
||||||
server.on("/wmconfig", handleWMConfig);
|
server.on("/wmconfig", handleWMConfig);
|
||||||
server.on("/resetwifi", handleReset);
|
server.on("/resetwifi", handleReset);
|
||||||
|
server.on("/formatspiffs", handleFormat);
|
||||||
#if USE_SPIFFS == 1
|
#if USE_SPIFFS == 1
|
||||||
// NOTE: this serves the default home page, and favicon.ico
|
// NOTE: this serves the default home page, and favicon.ico
|
||||||
server.onNotFound([]()
|
server.onNotFound([]()
|
||||||
|
|
|
@ -20,6 +20,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "BTCota.h"
|
#include "BTCota.h"
|
||||||
|
#include "../cfg/BTCConfig.h"
|
||||||
|
#if USE_SPIFFS == 1
|
||||||
|
#include <SPIFFS.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
void initOTA(){
|
void initOTA(){
|
||||||
// ArduinoOTA.setHostname("myesp32");
|
// ArduinoOTA.setHostname("myesp32");
|
||||||
|
@ -34,6 +38,7 @@ void initOTA(){
|
||||||
type = "filesystem";
|
type = "filesystem";
|
||||||
|
|
||||||
// NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
|
// NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
|
||||||
|
SPIFFS.end();
|
||||||
DebugPort.println("Start updating " + type);
|
DebugPort.println("Start updating " + type);
|
||||||
DebugPort.handle(); // keep telnet spy alive
|
DebugPort.handle(); // keep telnet spy alive
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue