From 30236f9b36629544febe02ef9723075b2d6d7046 Mon Sep 17 00:00:00 2001 From: pmantoine Date: Fri, 30 Aug 2024 11:52:27 +0800 Subject: [PATCH] STM32 Ethernet fixed --- EthernetInterface.cpp | 11 +++++------ EthernetInterface.h | 8 ++++++++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/EthernetInterface.cpp b/EthernetInterface.cpp index bea4162..8e84569 100644 --- a/EthernetInterface.cpp +++ b/EthernetInterface.cpp @@ -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++) { diff --git a/EthernetInterface.h b/EthernetInterface.h index 8440dde..9ea2718 100644 --- a/EthernetInterface.h +++ b/EthernetInterface.h @@ -35,6 +35,14 @@ #if defined (ARDUINO_TEENSY41) #include //TEENSY Ethernet Treiber #include +#elif defined (ARDUINO_NUCLEO_F429ZI) || defined (ARDUINO_NUCLEO_F439ZI) || defined (ARDUINO_NUCLEO_F4X9ZI) + #include +// #include "STM32lwipopts.h" + #include + #include + extern "C" struct netif gnetif; + #define STM32_ETHERNET + #define MAX_SOCK_NUM 8 #else #include "Ethernet.h" #endif