diff --git a/WifiControlSensor/WebServer.ino b/WifiControlSensor/WebServer.ino index 83b57a4..3910c6d 100644 --- a/WifiControlSensor/WebServer.ino +++ b/WifiControlSensor/WebServer.ino @@ -2,7 +2,7 @@ void handleRoot() { server.send(200, "text/html", "

You are connected


" "Current temperature " + String(temp, 2) + "C
" "Current pressure " + String(pressure, 2) + "mB
" - "MQTT Status :" + (MQTT_isConnected()? "Connected":"Disconnected") +"
" + "MQTT Status :" + (MQTT_isConnected() ? "Connected" : "Disconnected") + "
" "Setup
" "OTA mode
" "ON
" @@ -27,14 +27,14 @@ void handleSetup() { "Wifi configuration:" "
" "
" - "
" + "
" "" "
" "MQTT:" - "
" - "
" + "
" + "
" "
" - "
" + "
" "
" "
" ""); @@ -70,7 +70,7 @@ void handleSave() { } server.send(200, "text/html", "

Configuration Saved


" - "You can reboot now"); + "Reboot
"); } 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", "

Device Reboot


"); + 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();