diff --git a/WifiControlSensor/WebServer.ino b/WifiControlSensor/WebServer.ino index 09ed6cd..d23023c 100644 --- a/WifiControlSensor/WebServer.ino +++ b/WifiControlSensor/WebServer.ino @@ -1,5 +1,7 @@ #ifndef CONFIG_DISABLE_WEB +#include +ESP8266HTTPUpdateServer httpUpdater; String gpioControlHTML = ""; String pwmControlHTML = ""; @@ -44,6 +46,7 @@ void WebHandleRoot() { #ifdef CONFIG_ENABLE_BMP180 "BMP 180 (Temp+Pression) Status: " + (BMP180IsConnected() ? "Connected" : "Disconnected") + "
" #endif + "Update firmware
" "Wifi Strength: " + WiFi.RSSI() + "dBm
" "Free space: " + ESP.getFreeSketchSpace() + "
" "Free heap: " + ESP.getFreeHeap() + "
" @@ -293,6 +296,7 @@ void WebSetupServer(int ) { server.on("/wifiStatus", WebHandleWifiStatus); server.onNotFound(WebHandleNotFound); + httpUpdater.setup(&server, "/upload"); server.begin(); SKETCH_DEBUG_PRINTLN("HTTP server started"); } diff --git a/WifiControlSensor/WifiControlSensor.ino b/WifiControlSensor/WifiControlSensor.ino index 40fe6a1..155fc3a 100644 --- a/WifiControlSensor/WifiControlSensor.ino +++ b/WifiControlSensor/WifiControlSensor.ino @@ -129,6 +129,10 @@ void WifiSetup(productConfig conf) { SKETCH_DEBUG_PRINTLN("Error setting up MDNS responder!"); } else { SKETCH_DEBUG_PRINTLN("mDNS responder started"); +#ifndef CONFIG_DISABLE_WEB + //Needed for OTA by HTTP + MDNS.addService("http", "tcp", 80); +#endif } #endif myIP = WiFi.localIP();