mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-10 01:39:54 +03:00
Added extra backup for updates
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -15,19 +15,21 @@
|
||||
#include <ArduinoOTA.h>
|
||||
#include <AsyncMqttClient.h> // https://github.com/marvinroger/async-mqtt-client and for ESP32 see https://github.com/marvinroger/async-mqtt-client/issues/127
|
||||
#include <DNSServer.h>
|
||||
|
||||
#include <FS.h>
|
||||
#include <JustWifi.h> // https://github.com/xoseperez/justwifi
|
||||
#include <TelnetSpy.h> // modified from https://github.com/yasheena/telnetspy
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
//#include <ESPmDNS.h>
|
||||
#include <ESPmDNS.h>
|
||||
#include <SPIFFS.h> // added for ESP32
|
||||
#define ets_vsnprintf vsnprintf // added for ESP32
|
||||
#define OTA_PORT 8266
|
||||
#else
|
||||
//#include <ESP8266mDNS.h>
|
||||
#include <ESP8266HTTPUpdateServer.h>
|
||||
#include <ESP8266WebServer.h>
|
||||
#include <ESP8266mDNS.h>
|
||||
#include <ESPAsyncTCP.h>
|
||||
#define OTA_PORT 3232
|
||||
#define OTA_PORT 8266
|
||||
#endif
|
||||
|
||||
#define MYEMS_CONFIG_FILE "/config.json"
|
||||
|
||||
Reference in New Issue
Block a user