1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-22 23:56:13 +01:00

STM32 Ethernet fixed

This commit is contained in:
pmantoine 2024-08-30 11:52:27 +08:00
parent 4ed2ee9adc
commit 30236f9b36
2 changed files with 13 additions and 6 deletions

View File

@ -69,12 +69,11 @@ void EthernetInterface::setup() // STM32 VERSION
// #endif /* LWIP_NETIF_HOSTNAME */ // #endif /* LWIP_NETIF_HOSTNAME */
// 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...
#define _MAC_ MacAddressDefault() #endif
#else
byte mac[6]; byte mac[6];
DCCTimer::getSimulatedMacAddress(mac); DCCTimer::getSimulatedMacAddress(mac);
#define _MAC_ mac #define _MAC_ mac
#endif
#ifdef IP_ADDRESS #ifdef IP_ADDRESS
static IPAddress myIP(IP_ADDRESS); static IPAddress myIP(IP_ADDRESS);
@ -180,16 +179,16 @@ void EthernetInterface::loop()
if (client) { if (client) {
// check for new client // check for new client
byte socket; byte socket;
bool sockfound = false; bool sockFound = false;
for (socket = 0; socket < MAX_SOCK_NUM; socket++) for (socket = 0; socket < MAX_SOCK_NUM; socket++)
{ {
if (client == clients[socket]) if (client == clients[socket])
{ {
sockfound = true; sockFound = true;
break; break;
} }
} }
if (!sockfound) if (!sockFound)
{ // new client { // new client
for (socket = 0; socket < MAX_SOCK_NUM; socket++) for (socket = 0; socket < MAX_SOCK_NUM; socket++)
{ {

View File

@ -35,6 +35,14 @@
#if defined (ARDUINO_TEENSY41) #if defined (ARDUINO_TEENSY41)
#include <NativeEthernet.h> //TEENSY Ethernet Treiber #include <NativeEthernet.h> //TEENSY Ethernet Treiber
#include <NativeEthernetUdp.h> #include <NativeEthernetUdp.h>
#elif defined (ARDUINO_NUCLEO_F429ZI) || defined (ARDUINO_NUCLEO_F439ZI) || defined (ARDUINO_NUCLEO_F4X9ZI)
#include <LwIP.h>
// #include "STM32lwipopts.h"
#include <STM32Ethernet.h>
#include <lwip/netif.h>
extern "C" struct netif gnetif;
#define STM32_ETHERNET
#define MAX_SOCK_NUM 8
#else #else
#include "Ethernet.h" #include "Ethernet.h"
#endif #endif