mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-23 16:16:13 +01:00
Fix Ethernet cable disconnect message
This commit is contained in:
parent
ad09360a54
commit
d1f558d64f
|
@ -1,4 +1,6 @@
|
||||||
/*
|
/*
|
||||||
|
* © 2024 Morten "Doc" Nielsen
|
||||||
|
* © 2023-2024 Paul M. Antoine
|
||||||
* © 2022 Bruno Sanches
|
* © 2022 Bruno Sanches
|
||||||
* © 2021 Fred Decker
|
* © 2021 Fred Decker
|
||||||
* © 2020-2022 Harald Barth
|
* © 2020-2022 Harald Barth
|
||||||
|
@ -174,9 +176,15 @@ bool EthernetInterface::checkLink() {
|
||||||
Ethernet.setLocalIP(myIP); // for static IP, set it again
|
Ethernet.setLocalIP(myIP); // for static IP, set it again
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
IPAddress ip = Ethernet.localIP(); // look what IP was obtained (dynamic or static)
|
|
||||||
server = new EthernetServer(IP_PORT); // Ethernet Server listening on default port IP_PORT
|
server = new EthernetServer(IP_PORT); // Ethernet Server listening on default port IP_PORT
|
||||||
server->begin();
|
server->begin();
|
||||||
|
IPAddress ip = Ethernet.localIP(); // look what IP was obtained (dynamic or static)
|
||||||
|
if (ip[0] == 0)
|
||||||
|
LCD(4,F("Awaiting DHCP..."));
|
||||||
|
while (ip[0] == 0) { // wait until we are given an IP address from the DHCP server
|
||||||
|
// LCD(4,F("."));
|
||||||
|
ip = Ethernet.localIP(); // look what IP was obtained (dynamic or static)
|
||||||
|
}
|
||||||
LCD(4,F("IP: %d.%d.%d.%d"), ip[0], ip[1], ip[2], ip[3]);
|
LCD(4,F("IP: %d.%d.%d.%d"), ip[0], ip[1], ip[2], ip[3]);
|
||||||
LCD(5,F("Port:%d"), IP_PORT);
|
LCD(5,F("Port:%d"), IP_PORT);
|
||||||
mdns.begin(Ethernet.localIP(), "dccex"); // hostname
|
mdns.begin(Ethernet.localIP(), "dccex"); // hostname
|
||||||
|
@ -187,7 +195,8 @@ bool EthernetInterface::checkLink() {
|
||||||
outboundRing=new RingStream(OUTBOUND_RING_SIZE);
|
outboundRing=new RingStream(OUTBOUND_RING_SIZE);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else { // connected
|
} else { // LinkOFF
|
||||||
|
if (connected) {
|
||||||
DIAG(F("Ethernet cable disconnected"));
|
DIAG(F("Ethernet cable disconnected"));
|
||||||
connected=false;
|
connected=false;
|
||||||
//clean up any client
|
//clean up any client
|
||||||
|
@ -200,6 +209,7 @@ bool EthernetInterface::checkLink() {
|
||||||
server = nullptr;
|
server = nullptr;
|
||||||
LCD(4,F("IP: None"));
|
LCD(4,F("IP: None"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "StringFormatter.h"
|
#include "StringFormatter.h"
|
||||||
|
|
||||||
#define VERSION "5.2.27stm32ECvfmdns"
|
#define VERSION "5.2.27stm32ECvfmdns"
|
||||||
|
// 5.2.XX - Fix Ethernet cable disconnected message, wait for DHCP
|
||||||
// 5.2.XX - MDNS Generic library integration for Ethernet
|
// 5.2.XX - MDNS Generic library integration for Ethernet
|
||||||
// 5.2.XX - Variable frequency for DC mode
|
// 5.2.XX - Variable frequency for DC mode
|
||||||
// 5.2.27 - Bugfix: IOExpander memory allocation
|
// 5.2.27 - Bugfix: IOExpander memory allocation
|
||||||
|
|
Loading…
Reference in New Issue
Block a user