1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-26 09:36:13 +01:00

mDNS restored on mega

This commit is contained in:
Asbelos 2024-08-25 16:50:49 +01:00
parent 06a353cfa0
commit 4ed2ee9adc

View File

@ -31,13 +31,13 @@
#include "DCCTimer.h"
#if __has_include ( "MDNS_Generic.h")
#include "MDNS_Generic.h"
// #define DO_MDNS !!!!!!!!!!!!! breaks mega
#define DO_MDNS
EthernetUDP udp;
MDNS mdns(udp);
#endif
//extern void looptimer(unsigned long timeout, const FSH* message);
extern void looptimer(unsigned long timeout, const FSH* message);
bool EthernetInterface::connected=false;
EthernetServer * EthernetInterface::server= nullptr;
@ -52,7 +52,11 @@ RingStream * EthernetInterface::outboundRing = nullptr;
void EthernetInterface::setup() // STM32 VERSION
{
DIAG(F("Ethernet begin"));
DIAG(F("Ethernet begin"
#ifdef DO_MDNS
" with mDNS"
#endif
));
#ifdef STM32_ETHERNET
// Set a HOSTNAME for the DHCP request - a nice to have, but hard it seems on LWIP for STM32
@ -126,6 +130,7 @@ void EthernetInterface::setup() // STM32 VERSION
void EthernetInterface::loop()
{
if (!connected) return;
looptimer(5000, F("E.loop"));
static bool warnedAboutLink=false;
if (Ethernet.linkStatus() == LinkOFF){
@ -134,6 +139,7 @@ void EthernetInterface::loop()
warnedAboutLink=true;
return;
}
looptimer(5000, F("E.loop warn"));
// link status must be ok here
if (warnedAboutLink) {
@ -144,6 +150,8 @@ void EthernetInterface::loop()
#ifdef DO_MDNS
// Always do this because we don't want traffic to intefere with being found!
mdns.run();
looptimer(5000, F("E.mdns"));
#endif
//
@ -163,6 +171,7 @@ void EthernetInterface::loop()
//DIAG(F("maintained"));
break;
}
looptimer(5000, F("E.maintain"));
// get client from the server
#if defined (STM32_ETHERNET)