mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-24 08:36:14 +01:00
Compare commits
No commits in common. "ba3d29e4b565c2e02f6d87bf5e0947a9129e299a" and "6f797b2e15db190597228115344f5669ab534247" have entirely different histories.
ba3d29e4b5
...
6f797b2e15
|
@ -50,10 +50,6 @@ void EthernetInterface::setup()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifdef IP_ADDRESS
|
|
||||||
static IPAddress myIP(IP_ADDRESS);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Aquire IP Address from DHCP and start server
|
* @brief Aquire IP Address from DHCP and start server
|
||||||
*
|
*
|
||||||
|
@ -75,32 +71,33 @@ EthernetInterface::EthernetInterface()
|
||||||
// Which seems more useful! We should propose the patch... so the following line actually works!
|
// Which seems more useful! We should propose the patch... so the following line actually works!
|
||||||
netif_set_hostname(&gnetif, WIFI_HOSTNAME); // Should probably be passed in the contructor...
|
netif_set_hostname(&gnetif, WIFI_HOSTNAME); // Should probably be passed in the contructor...
|
||||||
#ifdef IP_ADDRESS
|
#ifdef IP_ADDRESS
|
||||||
Ethernet.begin(myIP);
|
if (Ethernet.begin(IP_ADDRESS) == 0)
|
||||||
#else
|
#else
|
||||||
if (Ethernet.begin() == 0)
|
if (Ethernet.begin() == 0)
|
||||||
|
#endif // IP_ADDRESS
|
||||||
{
|
{
|
||||||
DIAG(F("Ethernet.begin FAILED"));
|
DIAG(F("Ethernet.begin FAILED"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif // IP_ADDRESS
|
|
||||||
#else // All other architectures
|
#else // All other architectures
|
||||||
byte mac[6]= { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
|
byte mac[6]= { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
|
||||||
DIAG(F("Ethernet attempting to get MAC address"));
|
DIAG(F("Ethernet attempting to get MAC address"));
|
||||||
DCCTimer::getSimulatedMacAddress(mac);
|
DCCTimer::getSimulatedMacAddress(mac);
|
||||||
DIAG(F("Ethernet got MAC address"));
|
DIAG(F("Ethernet got MAC address"));
|
||||||
#ifdef IP_ADDRESS
|
#ifdef IP_ADDRESS
|
||||||
Ethernet.begin(mac, myIP);
|
if (Ethernet.begin(mac, IP_ADDRESS) == 0)
|
||||||
#else
|
#else
|
||||||
if (Ethernet.begin(mac) == 0)
|
if (Ethernet.begin(mac) == 0)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
DIAG(F("Ethernet.begin FAILED"));
|
DIAG(F("Ethernet.begin FAILED"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif // IP_ADDRESS
|
|
||||||
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
|
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
|
||||||
DIAG(F("Ethernet shield not found or W5100"));
|
DIAG(F("Ethernet shield not found or W5100"));
|
||||||
}
|
}
|
||||||
#endif // STM32_ETHERNET
|
#endif
|
||||||
|
|
||||||
uint32_t startmilli = millis();
|
uint32_t startmilli = millis();
|
||||||
while ((millis() - startmilli) < 5500) { // Loop to give time to check for cable connection
|
while ((millis() - startmilli) < 5500) { // Loop to give time to check for cable connection
|
||||||
|
@ -166,9 +163,7 @@ bool EthernetInterface::checkLink() {
|
||||||
DIAG(F("Ethernet cable connected"));
|
DIAG(F("Ethernet cable connected"));
|
||||||
connected=true;
|
connected=true;
|
||||||
#ifdef IP_ADDRESS
|
#ifdef IP_ADDRESS
|
||||||
#ifndef STM32_ETHERNET
|
Ethernet.setLocalIP(IP_ADDRESS); // for static IP, set it again
|
||||||
Ethernet.setLocalIP(myIP); // for static IP, set it again
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
IPAddress ip = Ethernet.localIP(); // look what IP was obtained (dynamic or static)
|
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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user