mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-22 21:23:07 +03:00
Fix hardcoded dependency of ArduinoOTA on mDNS (#5768)
Fixes #4643 This is especially important when compiling for host mode, because ArduinoOTA is pulled in unconditionally by the Makefile in tests/host. Thus it breaks the build as soon as NO_GLOBAL_INSTANCES or NO_GLOBAL_MDNS is defined.
This commit is contained in:
parent
9ba89ebaf4
commit
e721089e60
@ -19,8 +19,10 @@ extern "C" {
|
||||
#include "lwip/igmp.h"
|
||||
#include "lwip/mem.h"
|
||||
#include "include/UdpContext.h"
|
||||
#include <ESP8266mDNS.h>
|
||||
|
||||
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_MDNS)
|
||||
#include <ESP8266mDNS.h>
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_ESP_OTA
|
||||
#ifdef DEBUG_ESP_PORT
|
||||
@ -131,6 +133,7 @@ void ArduinoOTAClass::begin(bool useMDNS) {
|
||||
return;
|
||||
_udp_ota->onRx(std::bind(&ArduinoOTAClass::_onRx, this));
|
||||
|
||||
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_MDNS)
|
||||
if(_useMDNS) {
|
||||
MDNS.begin(_hostname.c_str());
|
||||
|
||||
@ -140,6 +143,7 @@ void ArduinoOTAClass::begin(bool useMDNS) {
|
||||
MDNS.enableArduino(_port);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
_initialized = true;
|
||||
_state = OTA_IDLE;
|
||||
#ifdef OTA_DEBUG
|
||||
@ -361,8 +365,10 @@ void ArduinoOTAClass::handle() {
|
||||
_state = OTA_IDLE;
|
||||
}
|
||||
|
||||
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_MDNS)
|
||||
if(_useMDNS)
|
||||
MDNS.update(); //handle MDNS update as well, given that ArduinoOTA relies on it anyways
|
||||
#endif
|
||||
}
|
||||
|
||||
int ArduinoOTAClass::getCommand() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user