From 445e663ca0c4e7c97719293a68a13e5038bf30d0 Mon Sep 17 00:00:00 2001 From: Tobias Blum Date: Sun, 18 Mar 2018 01:47:13 +0100 Subject: [PATCH] Add ESP8266HTTPUpdateServer as alternative --- Arduino/McLighting/McLighting.ino | 10 +++++++++- Arduino/McLighting/definitions.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Arduino/McLighting/McLighting.ino b/Arduino/McLighting/McLighting.ino index e64a9a6..dcd44fd 100644 --- a/Arduino/McLighting/McLighting.ino +++ b/Arduino/McLighting/McLighting.ino @@ -42,6 +42,10 @@ ESP8266WebServer server(80); WebSocketsServer webSocket = WebSocketsServer(81); +#ifdef HTTP_OTA + #include + ESP8266HTTPUpdateServer httpUpdater; +#endif // *************************************************************************** // Load libraries / Instanciate WS2812FX library @@ -571,6 +575,10 @@ void setup() { mode = SET_MODE; getStatusJSON(); }); + + #ifdef HTTP_OTA + httpUpdater.setup(&server,"/update"); + #endif server.begin(); @@ -688,4 +696,4 @@ void loop() { EEPROM.commit(); } #endif -} +} diff --git a/Arduino/McLighting/definitions.h b/Arduino/McLighting/definitions.h index f9c1a54..e65dd62 100644 --- a/Arduino/McLighting/definitions.h +++ b/Arduino/McLighting/definitions.h @@ -6,6 +6,7 @@ const char HOSTNAME[] = "McLighting01"; // Friedly hostname +//#define HTTP_OTA // If defined, enable Added ESP8266HTTPUpdateServer #define ENABLE_OTA // If defined, enable Arduino OTA code. #define ENABLE_MQTT // If defined, enable MQTT client code, see: https://github.com/toblum/McLighting/wiki/MQTT-API #define ENABLE_HOMEASSISTANT // If defined, enable Homeassistant integration, ENABLE_MQTT must be active