Merge pull request #10487 from BBBits/development

mDNS Performance Fix & mDNS ESP32 Support
This commit is contained in:
Theo Arends 2021-01-10 12:21:58 +01:00 committed by GitHub
commit 7102189572
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 9 deletions

View File

@ -1,4 +1,4 @@
// //
// Compat with ESP32 // Compat with ESP32
// //
#include <mDNS.h> #include <ESPmDNS.h>

View File

@ -78,12 +78,15 @@ void MdnsAddServiceHttp(void) {
} }
} }
#ifdef ESP8266 //Not needed with esp32 mdns
void MdnsUpdate(void) { void MdnsUpdate(void) {
if (2 == Mdns.begun) { if (2 == Mdns.begun) {
MDNS.update(); MDNS.update(); // this is basically passpacket like a webserver
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_MDNS "MDNS.update")); // being called in main loop so no logging
// AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_MDNS "MDNS.update"));
} }
} }
#endif // ESP8266
#endif // WEBSERVER_ADVERTISE #endif // WEBSERVER_ADVERTISE
#endif // USE_DISCOVERY #endif // USE_DISCOVERY

View File

@ -401,11 +401,6 @@ void WifiCheckIp(void)
memcpy((void*) &Settings.wifi_bssid, (void*) bssid, sizeof(Settings.wifi_bssid)); memcpy((void*) &Settings.wifi_bssid, (void*) bssid, sizeof(Settings.wifi_bssid));
} }
Wifi.status = WL_CONNECTED; Wifi.status = WL_CONNECTED;
#ifdef USE_DISCOVERY
#ifdef WEBSERVER_ADVERTISE
MdnsUpdate();
#endif // USE_DISCOVERY
#endif // WEBSERVER_ADVERTISE
} else { } else {
WifiSetState(0); WifiSetState(0);
uint8_t wifi_config_tool = Settings.sta_config; uint8_t wifi_config_tool = Settings.sta_config;

View File

@ -383,6 +383,17 @@ void SleepDelay(uint32_t mseconds) {
void loop(void) { void loop(void) {
uint32_t my_sleep = millis(); uint32_t my_sleep = millis();
// check LEAmDNS.h
// MDNS.update() needs to be called in main loop
#ifdef ESP8266 //Not needed with esp32 mdns
#ifdef USE_DISCOVERY
#ifdef WEBSERVER_ADVERTISE
// previously this was only called in WifiCheckIp() and that causes delays in responses to mdns
MdnsUpdate();
#endif // WEBSERVER_ADVERTISE
#endif // USE_DISCOVERY
#endif // ESP8266
XdrvCall(FUNC_LOOP); XdrvCall(FUNC_LOOP);
XsnsCall(FUNC_LOOP); XsnsCall(FUNC_LOOP);

View File

@ -123,7 +123,7 @@ String EthernetMacAddress(void);
#undef USE_RF_FLASH #undef USE_RF_FLASH
// Not ported (yet) // Not ported (yet)
#undef USE_DISCOVERY
#undef USE_MY92X1 #undef USE_MY92X1
#undef USE_TUYA_MCU #undef USE_TUYA_MCU
#undef USE_PS_16_DZ #undef USE_PS_16_DZ