mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-22 23:56:13 +01:00
mDNS restored on mega
This commit is contained in:
parent
06a353cfa0
commit
4ed2ee9adc
|
@ -31,13 +31,13 @@
|
||||||
#include "DCCTimer.h"
|
#include "DCCTimer.h"
|
||||||
#if __has_include ( "MDNS_Generic.h")
|
#if __has_include ( "MDNS_Generic.h")
|
||||||
#include "MDNS_Generic.h"
|
#include "MDNS_Generic.h"
|
||||||
// #define DO_MDNS !!!!!!!!!!!!! breaks mega
|
#define DO_MDNS
|
||||||
EthernetUDP udp;
|
EthernetUDP udp;
|
||||||
MDNS mdns(udp);
|
MDNS mdns(udp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//extern void looptimer(unsigned long timeout, const FSH* message);
|
extern void looptimer(unsigned long timeout, const FSH* message);
|
||||||
|
|
||||||
bool EthernetInterface::connected=false;
|
bool EthernetInterface::connected=false;
|
||||||
EthernetServer * EthernetInterface::server= nullptr;
|
EthernetServer * EthernetInterface::server= nullptr;
|
||||||
|
@ -52,7 +52,11 @@ RingStream * EthernetInterface::outboundRing = nullptr;
|
||||||
|
|
||||||
void EthernetInterface::setup() // STM32 VERSION
|
void EthernetInterface::setup() // STM32 VERSION
|
||||||
{
|
{
|
||||||
DIAG(F("Ethernet begin"));
|
DIAG(F("Ethernet begin"
|
||||||
|
#ifdef DO_MDNS
|
||||||
|
" with mDNS"
|
||||||
|
#endif
|
||||||
|
));
|
||||||
|
|
||||||
#ifdef STM32_ETHERNET
|
#ifdef STM32_ETHERNET
|
||||||
// Set a HOSTNAME for the DHCP request - a nice to have, but hard it seems on LWIP for STM32
|
// Set a HOSTNAME for the DHCP request - a nice to have, but hard it seems on LWIP for STM32
|
||||||
|
@ -126,7 +130,8 @@ void EthernetInterface::setup() // STM32 VERSION
|
||||||
void EthernetInterface::loop()
|
void EthernetInterface::loop()
|
||||||
{
|
{
|
||||||
if (!connected) return;
|
if (!connected) return;
|
||||||
|
looptimer(5000, F("E.loop"));
|
||||||
|
|
||||||
static bool warnedAboutLink=false;
|
static bool warnedAboutLink=false;
|
||||||
if (Ethernet.linkStatus() == LinkOFF){
|
if (Ethernet.linkStatus() == LinkOFF){
|
||||||
if (warnedAboutLink) return;
|
if (warnedAboutLink) return;
|
||||||
|
@ -134,7 +139,8 @@ void EthernetInterface::loop()
|
||||||
warnedAboutLink=true;
|
warnedAboutLink=true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
looptimer(5000, F("E.loop warn"));
|
||||||
|
|
||||||
// link status must be ok here
|
// link status must be ok here
|
||||||
if (warnedAboutLink) {
|
if (warnedAboutLink) {
|
||||||
DIAG(F("Ethernet link RESTORED"));
|
DIAG(F("Ethernet link RESTORED"));
|
||||||
|
@ -144,6 +150,8 @@ void EthernetInterface::loop()
|
||||||
#ifdef DO_MDNS
|
#ifdef DO_MDNS
|
||||||
// Always do this because we don't want traffic to intefere with being found!
|
// Always do this because we don't want traffic to intefere with being found!
|
||||||
mdns.run();
|
mdns.run();
|
||||||
|
looptimer(5000, F("E.mdns"));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -163,7 +171,8 @@ void EthernetInterface::loop()
|
||||||
//DIAG(F("maintained"));
|
//DIAG(F("maintained"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
looptimer(5000, F("E.maintain"));
|
||||||
|
|
||||||
// get client from the server
|
// get client from the server
|
||||||
#if defined (STM32_ETHERNET)
|
#if defined (STM32_ETHERNET)
|
||||||
// STM32Ethernet doesn't use accept(), just available()
|
// STM32Ethernet doesn't use accept(), just available()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user