Add http request to reboot ESP
GPIO0 should be at 3.3v to boot correctly
This commit is contained in:
parent
ff178ce940
commit
b66769f9d6
@ -70,7 +70,7 @@ void handleSave() {
|
||||
}
|
||||
|
||||
server.send(200, "text/html", "<h1>Configuration Saved</h1><br/>"
|
||||
"You can reboot now");
|
||||
"<a href=\"/reboot\">Reboot</a><br/>");
|
||||
}
|
||||
|
||||
void handleOTA() {
|
||||
@ -95,12 +95,19 @@ void handleNotFound() {
|
||||
server.send(404, "text/plain", message);
|
||||
}
|
||||
|
||||
void handleReboot() {
|
||||
Serial.println("HTTP request to reboot");
|
||||
server.send(200, "text/html", "<h1>Device Reboot</h1><br/>");
|
||||
ESP.restart();
|
||||
}
|
||||
|
||||
void setupWebServer(int bootmode) {
|
||||
server.on("/", handleRoot);
|
||||
server.on("/setup", handleSetup);
|
||||
server.on("/save", handleSave);
|
||||
server.on("/gpio", handleGpio);
|
||||
server.on("/otamode", handleOTA);
|
||||
server.on("/reboot", handleReboot);
|
||||
|
||||
server.onNotFound(handleNotFound);
|
||||
server.begin();
|
||||
|
Loading…
Reference in New Issue
Block a user