diff --git a/src/CHANGES.md b/src/CHANGES.md index a36e0769..472e3c8f 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -2,6 +2,7 @@ ## 0.8.18 - 2023-12-10 * copied even more from the original heuristic code #1259 +* added mDNS support #1262 ## 0.8.17 - 2023-12-10 * possible fix of NRF with opendtufusion (without ETH) diff --git a/src/eth/ahoyeth.cpp b/src/eth/ahoyeth.cpp index 48824429..be114cf1 100644 --- a/src/eth/ahoyeth.cpp +++ b/src/eth/ahoyeth.cpp @@ -10,6 +10,7 @@ #define F(sl) (sl) #endif #include "ahoyeth.h" +#include //----------------------------------------------------------------------------- ahoyeth::ahoyeth() @@ -170,6 +171,13 @@ void ahoyeth::onEthernetEvent(WiFiEvent_t event, arduino_event_info_t info) ESP32_W5500_eth_connected = true; mOnNetworkCB(true); } + if (!MDNS.begin(mConfig->sys.deviceName)) { + DPRINTLN(DBG_ERROR, F("Error setting up MDNS responder!")); + } else { + DBGPRINT(F("[WiFi] mDNS established: ")); + DBGPRINT(mConfig->sys.deviceName); + DBGPRINTLN(F(".local")); + } break; case ARDUINO_EVENT_ETH_DISCONNECTED: @@ -221,6 +229,13 @@ void ahoyeth::onEthernetEvent(WiFiEvent_t event, arduino_event_info_t info) ESP32_W5500_eth_connected = true; mOnNetworkCB(true); } + if (!MDNS.begin(mConfig->sys.deviceName)) { + DPRINTLN(DBG_ERROR, F("Error setting up MDNS responder!")); + } else { + DBGPRINT(F("[WiFi] mDNS established: ")); + DBGPRINT(mConfig->sys.deviceName); + DBGPRINTLN(F(".local")); + } break; case SYSTEM_EVENT_ETH_DISCONNECTED: diff --git a/src/wifi/ahoywifi.cpp b/src/wifi/ahoywifi.cpp index d58e3847..02f8d252 100644 --- a/src/wifi/ahoywifi.cpp +++ b/src/wifi/ahoywifi.cpp @@ -89,7 +89,9 @@ void ahoywifi::tickWifiLoop() { if (mGotDisconnect) { mStaConn = RESET; } + #if !defined(ESP32) MDNS.update(); + #endif return; case IN_AP_MODE: if (WiFi.softAPgetStationNum() == 0) {