From dc481a2f0cc1b73d74d2440cd07dc68d2566f99f Mon Sep 17 00:00:00 2001 From: Asbelos Date: Mon, 23 Sep 2024 09:34:26 +0100 Subject: [PATCH] EthernetInterface --- CommandStation-EX.ino | 21 +++++---------------- EthernetInterface.cpp | 15 +++------------ version.h | 3 ++- 3 files changed, 10 insertions(+), 29 deletions(-) diff --git a/CommandStation-EX.ino b/CommandStation-EX.ino index 31b3b21..3e601b1 100644 --- a/CommandStation-EX.ino +++ b/CommandStation-EX.ino @@ -141,6 +141,7 @@ void setup() CommandDistributor::broadcastPower(); } +/**************** for future reference void looptimer(unsigned long timeout, const FSH* message) { static unsigned long lasttimestamp = 0; @@ -156,58 +157,46 @@ void looptimer(unsigned long timeout, const FSH* message) } lasttimestamp = now; } - +*********************************************/ void loop() { // The main sketch has responsibilities during loop() // Responsibility 1: Handle DCC background processes // (loco reminders and power checks) - looptimer(0, F("")); DCC::loop(); - looptimer(5000, F("DCC")); // got warnings up to 3884 during prog track read - + // Responsibility 2: handle any incoming commands on USB connection SerialManager::loop(); - looptimer(2000, F("Serial")); // got warnings up to 1900 during start - + // Responsibility 3: Optionally handle any incoming WiFi traffic #ifndef ARDUINO_ARCH_ESP32 #if WIFI_ON WifiInterface::loop(); - looptimer(9000, F("Wifi")); // got warnings up to 8000 - + #endif //WIFI_ON #else //ARDUINO_ARCH_ESP32 #ifndef WIFI_TASK_ON_CORE0 WifiESP::loop(); - looptimer(1000, F("WifiESP")); - #endif #endif //ARDUINO_ARCH_ESP32 #if ETHERNET_ON EthernetInterface::loop(); - looptimer(10000, F("Ethernet")); #endif RMFT::loop(); // ignored if no automation - looptimer(1000, F("RMFT")); #if defined(LCN_SERIAL) LCN::loop(); - looptimer(1000, F("LCN")); #endif // Display refresh DisplayInterface::loop(); - looptimer(2000, F("Display")); // got warnings around 1150 // Handle/update IO devices. IODevice::loop(); - looptimer(1000, F("IODevice")); Sensor::checkAll(); // Update and print changes - looptimer(1000, F("Sensor")); // Report any decrease in memory (will automatically trigger on first call) static int ramLowWatermark = __INT_MAX__; // replaced on first loop diff --git a/EthernetInterface.cpp b/EthernetInterface.cpp index 4b83f6d..c88a766 100644 --- a/EthernetInterface.cpp +++ b/EthernetInterface.cpp @@ -36,9 +36,6 @@ MDNS mdns(udp); #endif - -extern void looptimer(unsigned long timeout, const FSH* message); - bool EthernetInterface::connected=false; EthernetServer * EthernetInterface::server= nullptr; EthernetClient EthernetInterface::clients[MAX_SOCK_NUM]; // accept up to MAX_SOCK_NUM client connections at the same time; This depends on the chipset used on the Shield @@ -127,8 +124,7 @@ void EthernetInterface::setup() // STM32 VERSION void EthernetInterface::loop() { if (!connected) return; - looptimer(5000, F("E.loop")); - + static bool warnedAboutLink=false; if (Ethernet.linkStatus() == LinkOFF){ if (warnedAboutLink) return; @@ -136,8 +132,7 @@ void EthernetInterface::loop() warnedAboutLink=true; return; } - looptimer(5000, F("E.loop warn")); - + // link status must be ok here if (warnedAboutLink) { DIAG(F("Ethernet link RESTORED")); @@ -147,8 +142,6 @@ void EthernetInterface::loop() #ifdef DO_MDNS // Always do this because we don't want traffic to intefere with being found! mdns.run(); - looptimer(5000, F("E.mdns")); - #endif // @@ -168,8 +161,7 @@ void EthernetInterface::loop() //DIAG(F("maintained")); break; } - looptimer(5000, F("E.maintain")); - + // get client from the server #if defined (STM32_ETHERNET) // STM32Ethernet doesn't use accept(), just available() @@ -224,7 +216,6 @@ void EthernetInterface::loop() if (Diag::ETHERNET) DIAG(F("Ethernet s=%d, c=%d b=:%e"), socket, count, buffer); // execute with data going directly back CommandDistributor::parse(socket,buffer,outboundRing); - //looptimer(5000, F("Ethloop2 parse")); return; // limit the amount of processing that takes place within 1 loop() cycle. } diff --git a/version.h b/version.h index 6ebe13e..36c07c7 100644 --- a/version.h +++ b/version.h @@ -3,7 +3,8 @@ #include "StringFormatter.h" -#define VERSION "5.2.79" +#define VERSION "5.2.80" +// 5.2.80 - EthernetInterface upgrade // 5.2.79 - serial manager loop that handles quoted strings // - WiFiESP32 reconfig // 5.2.78 - NeoPixel support.