mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-22 23:56:13 +01:00
Bugfix: Ethernet fixed IP start
This commit is contained in:
parent
796d5c4774
commit
9ab6b3d4ea
|
@ -47,6 +47,10 @@ void EthernetInterface::setup()
|
|||
};
|
||||
|
||||
|
||||
#ifdef IP_ADDRESS
|
||||
static IPAddress myIP(IP_ADDRESS);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Aquire IP Address from DHCP and start server
|
||||
*
|
||||
|
@ -60,14 +64,14 @@ EthernetInterface::EthernetInterface()
|
|||
connected=false;
|
||||
|
||||
#ifdef IP_ADDRESS
|
||||
if (Ethernet.begin(mac, IP_ADDRESS) == 0)
|
||||
Ethernet.begin(mac, myIP);
|
||||
#else
|
||||
if (Ethernet.begin(mac) == 0)
|
||||
#endif
|
||||
{
|
||||
DIAG(F("Ethernet.begin FAILED"));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
|
||||
DIAG(F("Ethernet shield not found or W5100"));
|
||||
}
|
||||
|
@ -136,7 +140,7 @@ bool EthernetInterface::checkLink() {
|
|||
DIAG(F("Ethernet cable connected"));
|
||||
connected=true;
|
||||
#ifdef IP_ADDRESS
|
||||
Ethernet.setLocalIP(IP_ADDRESS); // for static IP, set it again
|
||||
Ethernet.setLocalIP(myIP); // for static IP, set it again
|
||||
#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
|
||||
|
|
Loading…
Reference in New Issue
Block a user