Added extra backup for updates

This commit is contained in:
Glenn Arens
2019-03-14 13:14:38 +01:00
parent 25bffb3b86
commit 822b01b129
5 changed files with 34 additions and 26 deletions

View File

@@ -322,13 +322,17 @@ void MyESP::_OTACallback() {
(_ota_callback)(); // call custom function to handle mqtt receives
}
}
ESP8266WebServer httpServer(80);
ESP8266HTTPUpdateServer httpUpdater;
// OTA Setup
void MyESP::_ota_setup() {
if (!_wifi_ssid) {
return;
}
MDNS.begin(_app_hostname);
httpUpdater.setup(&httpServer);
httpServer.begin();
MDNS.addService("http", "tcp", 80);
//ArduinoOTA.setPort(OTA_PORT);
ArduinoOTA.setHostname(_app_hostname);
@@ -1161,7 +1165,8 @@ void MyESP::begin(const char * app_hostname, const char * app_name, const char *
void MyESP::loop() {
_calculateLoad();
_telnetHandle(); // Telnet/Debugger
httpServer.handleClient();
MDNS.update();
jw.loop(); // WiFi
// do nothing else until we've got a wifi connection