1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-23 12:51:24 +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 */
// 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...
#define _MAC_ MacAddressDefault()
#else
#endif
byte mac[6];
DCCTimer::getSimulatedMacAddress(mac);
#define _MAC_ mac
#endif
#ifdef IP_ADDRESS
static IPAddress myIP(IP_ADDRESS);
@ -180,16 +179,16 @@ void EthernetInterface::loop()
if (client) {
// check for new client
byte socket;
bool sockfound = false;
bool sockFound = false;
for (socket = 0; socket < MAX_SOCK_NUM; socket++)
{
if (client == clients[socket])
{
sockfound = true;
sockFound = true;
break;
}
}
if (!sockfound)
if (!sockFound)
{ // new client
for (socket = 0; socket < MAX_SOCK_NUM; socket++)
{

View File

@ -35,6 +35,14 @@
#if defined (ARDUINO_TEENSY41)
#include <NativeEthernet.h> //TEENSY Ethernet Treiber
#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
#include "Ethernet.h"
#endif