From 45504db1ad84adffc53f192ef97e79cb1c9add70 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Wed, 26 Oct 2022 18:59:39 +0200 Subject: [PATCH 01/17] stacked motor shield example typo fix --- MotorDrivers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MotorDrivers.h b/MotorDrivers.h index a7d3bc5..328d5e6 100644 --- a/MotorDrivers.h +++ b/MotorDrivers.h @@ -183,6 +183,6 @@ new MotorDriver( 3, 12, UNUSED_PIN, 9, A0, 2.99, 1500, UNUSED_PIN), \ new MotorDriver(11, 13, UNUSED_PIN, 8, A1, 2.99, 1500, UNUSED_PIN), \ new MotorDriver( 2, 10, UNUSED_PIN, 7, A3, 2.99, 1500, UNUSED_PIN), \ - new MotorDriver(10, 4, UNUSED_PIN, 6, A4, 2.99, 1500, UNUSED_PIN) + new MotorDriver( 5, 4, UNUSED_PIN, 6, A4, 2.99, 1500, UNUSED_PIN) // #endif From 07f1d6fc20dd9505a54ca3a9b3ba215afbb6a9b2 Mon Sep 17 00:00:00 2001 From: peteGSX <97784652+peteGSX@users.noreply.github.com> Date: Sun, 23 Oct 2022 08:01:59 +1000 Subject: [PATCH 02/17] Updated .gitignore (#261) --- .gitignore | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 1f24578..c8e40c2 100644 --- a/.gitignore +++ b/.gitignore @@ -8,13 +8,14 @@ Release/* .vscode/ config.h .vscode/* -mySetup.h +# mySetup.h mySetup.cpp myHal.cpp -myAutomation.h +# myAutomation.h myFilter.cpp -myAutomation.h -myFilter.cpp -myLayout.h +# myAutomation.h +# myLayout.h +my*.h +!my*.example.h .vscode/extensions.json .vscode/extensions.json From eed1237b9f18518b4565234db3896502738999ed Mon Sep 17 00:00:00 2001 From: Asbelos Date: Thu, 27 Oct 2022 15:18:18 +0100 Subject: [PATCH 03/17] FIX Driveaway! --- WiThrottle.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/WiThrottle.cpp b/WiThrottle.cpp index 3df56db..cfc4a74 100644 --- a/WiThrottle.cpp +++ b/WiThrottle.cpp @@ -651,8 +651,9 @@ void WiThrottle::getLocoCallback(int16_t locoid) { itoa(locoid,addcmd+4,10); stashInstance->multithrottle(stashStream, (byte *)addcmd); TrackManager::setMainPower(POWERMODE::ON); + TrackManager::setProgPower(POWERMODE::ON); TrackManager::setJoin(true); // <1 JOIN> so we can drive loco away - //DIAG(F("LocoCallback commit success")); + DIAG(F("LocoCallback commit success")); stashStream->commit(); CommandDistributor::broadcastPower(); From 5e2b416c30cb528685f0e0f8aeb5e64b25b0aa74 Mon Sep 17 00:00:00 2001 From: Asbelos Date: Thu, 27 Oct 2022 18:27:23 +0100 Subject: [PATCH 04/17] roster list half error --- WiThrottle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WiThrottle.cpp b/WiThrottle.cpp index cfc4a74..6c427b7 100644 --- a/WiThrottle.cpp +++ b/WiThrottle.cpp @@ -298,7 +298,7 @@ void WiThrottle::parse(RingStream * stream, byte * cmdx) { #ifdef EXRAIL_ACTIVE StringFormatter::send(stream,F("RL%d"), RMFT2::rosterNameCount); for (int16_t r=0;r Date: Mon, 31 Oct 2022 19:43:55 +0100 Subject: [PATCH 05/17] devel version string update --- GITHUB_SHA.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GITHUB_SHA.h b/GITHUB_SHA.h index a025a4e..c163cae 100644 --- a/GITHUB_SHA.h +++ b/GITHUB_SHA.h @@ -1 +1 @@ -#define GITHUB_SHA "PORTX-HAL-cursense2-202210192255Z" +#define GITHUB_SHA "devel-202210311845Z" From 863c839563931f6e95e9170486264206279dffd3 Mon Sep 17 00:00:00 2001 From: pmantoine Date: Wed, 2 Nov 2022 13:46:16 +0800 Subject: [PATCH 06/17] Add Teensy ADCee class skeleton. --- DCCTimerTEENSY.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/DCCTimerTEENSY.cpp b/DCCTimerTEENSY.cpp index a8f97f1..0619e21 100644 --- a/DCCTimerTEENSY.cpp +++ b/DCCTimerTEENSY.cpp @@ -141,4 +141,31 @@ void DCCTimer::reset() { SCB_AIRCR = 0x05FA0004; } +int16_t ADCee::ADCmax() { + return 4095; +} + +int ADCee::init(uint8_t pin) { + return analogRead(pin); +} +/* + * Read function ADCee::read(pin) to get value instead of analogRead(pin) + */ +int ADCee::read(uint8_t pin, bool fromISR) { + int current; + if (!fromISR) noInterrupts(); + current = analogRead(pin); + if (!fromISR) interrupts(); + return current; +} +/* + * Scan function that is called from interrupt + */ +void ADCee::scan() { +} + +void ADCee::begin() { + noInterrupts(); + interrupts(); +} #endif From f939ea0768f30a90db26f6bb51241e7be0257fe4 Mon Sep 17 00:00:00 2001 From: pmantoine Date: Wed, 2 Nov 2022 13:55:10 +0800 Subject: [PATCH 07/17] Add MEGAAVR ADCeee skeleton. --- DCCTimerMEGAAVR.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/DCCTimerMEGAAVR.cpp b/DCCTimerMEGAAVR.cpp index be9248e..2b2bdab 100644 --- a/DCCTimerMEGAAVR.cpp +++ b/DCCTimerMEGAAVR.cpp @@ -1,4 +1,5 @@ /* + * © 2022 Paul M. Antoine * © 2021 Mike S * © 2021 Harald Barth * © 2021 Fred Decker @@ -124,5 +125,31 @@ void DCCTimer::reset() { while(true){} } +int16_t ADCee::ADCmax() { + return 4095; +} +int ADCee::init(uint8_t pin) { + return analogRead(pin); +} +/* + * Read function ADCee::read(pin) to get value instead of analogRead(pin) + */ +int ADCee::read(uint8_t pin, bool fromISR) { + int current; + if (!fromISR) noInterrupts(); + current = analogRead(pin); + if (!fromISR) interrupts(); + return current; +} +/* + * Scan function that is called from interrupt + */ +void ADCee::scan() { +} + +void ADCee::begin() { + noInterrupts(); + interrupts(); +} #endif From be2f3b0db74e6adc0758715a6096d8a3cc65b257 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Fri, 4 Nov 2022 16:08:43 +0100 Subject: [PATCH 08/17] Ethernet restructure --- EthernetInterface.cpp | 100 ++++++++++++++++++++++++++++-------------- EthernetInterface.h | 11 ++--- GITHUB_SHA.h | 2 +- version.h | 1 + 4 files changed, 76 insertions(+), 38 deletions(-) diff --git a/EthernetInterface.cpp b/EthernetInterface.cpp index f8c6146..a72f76c 100644 --- a/EthernetInterface.cpp +++ b/EthernetInterface.cpp @@ -1,6 +1,7 @@ /* + * © 2022 Bruno Sanches * © 2021 Fred Decker - * © 2020-2021 Harald Barth + * © 2020-2022 Harald Barth * © 2020-2021 Chris Harlow * © 2020 Gregor Baues * All rights reserved. @@ -36,8 +37,13 @@ EthernetInterface * EthernetInterface::singleton=NULL; */ void EthernetInterface::setup() { - singleton=new EthernetInterface(); - if (!singleton->connected) singleton=NULL; + if (singleton!=NULL) { + DIAG(F("Prog Error!")); + return; + } + if ((singleton=new EthernetInterface())) + return; + DIAG(F("Ethernet not initialized")); }; @@ -62,37 +68,34 @@ EthernetInterface::EthernetInterface() return; } #endif - DIAG(F("begin OK.")); - if (Ethernet.hardwareStatus() == EthernetNoHardware) { + if (Ethernet.hardwareStatus() == EthernetNoHardware) { DIAG(F("Ethernet shield not found")); return; } unsigned long 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 if (Ethernet.linkStatus() == LinkON) break; DIAG(F("Ethernet waiting for link (1sec) ")); delay(1000); } + // now we either do have link of we have a W5100 + // where we do not know if we have link. That's + // the reason to now run checkLink. + // CheckLinks sets up outboundRing if it does + // not exist yet as well. + checkLink(); +} - if (Ethernet.linkStatus() == LinkOFF) { - DIAG(F("Ethernet cable not connected")); - return; - } - - connected=true; - - IPAddress ip = Ethernet.localIP(); // reassign the obtained ip address - - server = new EthernetServer(IP_PORT); // Ethernet Server listening on default port IP_PORT - server->begin(); - - LCD(4,F("IP: %d.%d.%d.%d"), ip[0], ip[1], ip[2], ip[3]); - LCD(5,F("Port:%d"), IP_PORT); - - outboundRing=new RingStream(OUTBOUND_RING_SIZE); +/** + * @brief Cleanup any resources + * + * @return none + */ +EthernetInterface::~EthernetInterface() { + delete server; + delete outboundRing; } /** @@ -101,33 +104,66 @@ EthernetInterface::EthernetInterface() */ void EthernetInterface::loop() { - if (!singleton) return; + if (!singleton || (!singleton->checkLink())) + return; - switch (Ethernet.maintain()) - { + switch (Ethernet.maintain()) { case 1: //renewed fail DIAG(F("Ethernet Error: renewed fail")); singleton=NULL; return; - case 3: //rebind fail DIAG(F("Ethernet Error: rebind fail")); singleton=NULL; return; - default: //nothing happened break; } - singleton->loop2(); - } - void EthernetInterface::loop2() -{ +/** + * @brief Checks ethernet link cable status and detects when it connects / disconnects + * + * @return true when cable is connected, false otherwise + */ +bool EthernetInterface::checkLink() { + if (Ethernet.linkStatus() != LinkOFF) { // check for not linkOFF instead of linkON as the W5100 does return LinkUnknown + //if we are not connected yet, setup a new server + if(!connected) { + DIAG(F("Ethernet cable connected")); + connected=true; + IPAddress ip = Ethernet.localIP(); // reassign the obtained ip address + server = new EthernetServer(IP_PORT); // Ethernet Server listening on default port IP_PORT + server->begin(); + LCD(4,F("IP: %d.%d.%d.%d"), ip[0], ip[1], ip[2], ip[3]); + LCD(5,F("Port:%d"), IP_PORT); + // only create a outboundRing it none exists, this may happen if the cable + // gets disconnected and connected again + if(!outboundRing) + outboundRing=new RingStream(OUTBOUND_RING_SIZE); + } + return true; + } else { // connected + DIAG(F("Ethernet cable disconnected")); + connected=false; + //clean up any client + for (byte socket = 0; socket < MAX_SOCK_NUM; socket++) { + if(clients[socket].connected()) + clients[socket].stop(); + } + // tear down server + delete server; + server = nullptr; + LCD(4,F("IP: None")); + } + return false; +} + +void EthernetInterface::loop2() { // get client from the server EthernetClient client = server->accept(); diff --git a/EthernetInterface.h b/EthernetInterface.h index e79996d..ce4a2ef 100644 --- a/EthernetInterface.h +++ b/EthernetInterface.h @@ -56,15 +56,16 @@ class EthernetInterface { static void loop(); private: - static EthernetInterface * singleton; - bool connected; - EthernetInterface(); - void loop2(); + static EthernetInterface * singleton; + bool connected; + EthernetInterface(); + ~EthernetInterface(); + void loop2(); + bool checkLink(); EthernetServer * server; EthernetClient 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 uint8_t buffer[MAX_ETH_BUFFER+1]; // buffer used by TCP for the recv RingStream * outboundRing; - }; #endif diff --git a/GITHUB_SHA.h b/GITHUB_SHA.h index c163cae..93b77aa 100644 --- a/GITHUB_SHA.h +++ b/GITHUB_SHA.h @@ -1 +1 @@ -#define GITHUB_SHA "devel-202210311845Z" +#define GITHUB_SHA "devel-202211041507Z" diff --git a/version.h b/version.h index 7851c43..43e48e9 100644 --- a/version.h +++ b/version.h @@ -5,6 +5,7 @@ #define VERSION "4.2.4" +// Ethernet start improvement and link detection // 4.2.4 ESP32 experimental BT support // More DC configurations possible and lower frequency // Handle decoders that do not ack at write better From c0cb643cb56bd2282d282082315a4f3ca436a910 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Fri, 4 Nov 2022 23:15:29 +0100 Subject: [PATCH 09/17] When sending all turnouts, keep it short --- DCCEXParser.cpp | 10 +--------- GITHUB_SHA.h | 2 +- Turnouts.h | 9 +++++++-- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index 21a9d3d..f947db9 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -730,15 +730,7 @@ bool DCCEXParser::parseT(Print *stream, int16_t params, int16_t p[]) switch (params) { case 0: // list turnout definitions - { - bool gotOne = false; - for (Turnout *tt = Turnout::first(); tt != NULL; tt = tt->next()) - { - gotOne = true; - tt->print(stream); - } - return gotOne; // will if none found - } + return Turnout::printAll(stream); // will if none found case 1: // delete turnout if (!Turnout::remove(p[0])) diff --git a/GITHUB_SHA.h b/GITHUB_SHA.h index 93b77aa..d9d37b0 100644 --- a/GITHUB_SHA.h +++ b/GITHUB_SHA.h @@ -1 +1 @@ -#define GITHUB_SHA "devel-202211041507Z" +#define GITHUB_SHA "devel-202211042214Z" diff --git a/Turnouts.h b/Turnouts.h index b181709..7c40bde 100644 --- a/Turnouts.h +++ b/Turnouts.h @@ -171,9 +171,14 @@ public: // Save all turnout definitions static void store(); #endif - static void printAll(Print *stream) { + static bool printAll(Print *stream) { + bool gotOne=false; for (Turnout *tt = _firstTurnout; tt != 0; tt = tt->_nextTurnout) - if (!tt->isHidden()) StringFormatter::send(stream, F("\n"),tt->getId(), tt->isThrown()); + if (!tt->isHidden()) { + gotOne=true; + StringFormatter::send(stream, F("\n"),tt->getId(), tt->isThrown()); + } + return gotOne; } From a199de6d3e87f6cf4e1dd0954be6ac05ea0e0cb3 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Fri, 4 Nov 2022 23:43:26 +0100 Subject: [PATCH 10/17] Make return long config print --- DCCEXParser.cpp | 9 +++++++-- GITHUB_SHA.h | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index f947db9..ec207cd 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -751,8 +751,13 @@ bool DCCEXParser::parseT(Print *stream, int16_t params, int16_t p[]) case HASH_KEYWORD_T: state= false; break; - default: - return false; // Invalid parameter + default: // any other parameter prints the long status + Turnout *tt = Turnout::get(p[0]); + if (tt) { + tt->print(stream); + break; + } + return false; } if (!Turnout::setClosed(p[0], state)) return false; diff --git a/GITHUB_SHA.h b/GITHUB_SHA.h index d9d37b0..f08a8f1 100644 --- a/GITHUB_SHA.h +++ b/GITHUB_SHA.h @@ -1 +1 @@ -#define GITHUB_SHA "devel-202211042214Z" +#define GITHUB_SHA "devel-202211042235Z" From 2b3ba514b0916a0e26b6c42155354d9ef3c40a0e Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Sat, 5 Nov 2022 23:11:54 +0100 Subject: [PATCH 11/17] Use X as the questionmark sign in --- DCCEXParser.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index ec207cd..8e7cd33 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -73,6 +73,7 @@ const int16_t HASH_KEYWORD_A='A'; const int16_t HASH_KEYWORD_C='C'; const int16_t HASH_KEYWORD_R='R'; const int16_t HASH_KEYWORD_T='T'; +const int16_t HASH_KEYWORD_X='X'; const int16_t HASH_KEYWORD_LCN = 15137; const int16_t HASH_KEYWORD_HAL = 10853; const int16_t HASH_KEYWORD_SHOW = -21309; @@ -751,17 +752,19 @@ bool DCCEXParser::parseT(Print *stream, int16_t params, int16_t p[]) case HASH_KEYWORD_T: state= false; break; - default: // any other parameter prints the long status + case HASH_KEYWORD_X: + { Turnout *tt = Turnout::get(p[0]); if (tt) { tt->print(stream); - break; + return true; } return false; + } + default: // Invalid parameter + return false; } if (!Turnout::setClosed(p[0], state)) return false; - - return true; } From 4f19a60621e66a5fb09c26422312f64269d5e92c Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Sun, 6 Nov 2022 21:30:32 +0100 Subject: [PATCH 12/17] number of ADC inputs was reversed --- DCCTimerAVR.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DCCTimerAVR.cpp b/DCCTimerAVR.cpp index a8f8984..3e45ae8 100644 --- a/DCCTimerAVR.cpp +++ b/DCCTimerAVR.cpp @@ -120,9 +120,9 @@ void DCCTimer::reset() { } #if defined(ARDUINO_AVR_MEGA) || defined(ARDUINO_AVR_MEGA2560) -#define NUM_ADC_INPUTS 7 -#else #define NUM_ADC_INPUTS 15 +#else +#define NUM_ADC_INPUTS 7 #endif uint16_t ADCee::usedpins = 0; int * ADCee::analogvals = NULL; From f1d445e056054df604b136190c20837f8d1b67c0 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Sun, 6 Nov 2022 21:32:54 +0100 Subject: [PATCH 13/17] Do not abort ethernet startup on W5100 --- EthernetInterface.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/EthernetInterface.cpp b/EthernetInterface.cpp index a72f76c..2668ece 100644 --- a/EthernetInterface.cpp +++ b/EthernetInterface.cpp @@ -60,17 +60,16 @@ EthernetInterface::EthernetInterface() connected=false; #ifdef IP_ADDRESS - Ethernet.begin(mac, IP_ADDRESS); + if (Ethernet.begin(mac, IP_ADDRESS) == 0) #else if (Ethernet.begin(mac) == 0) + #endif { DIAG(F("Ethernet.begin FAILED")); return; } - #endif if (Ethernet.hardwareStatus() == EthernetNoHardware) { - DIAG(F("Ethernet shield not found")); - return; + DIAG(F("Ethernet shield not found or W5100")); } unsigned long startmilli = millis(); From eb0861959ca2f5e4b7116d14bb09d6d6fcc702c1 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Sun, 6 Nov 2022 21:33:40 +0100 Subject: [PATCH 14/17] version --- GITHUB_SHA.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GITHUB_SHA.h b/GITHUB_SHA.h index f08a8f1..4aee545 100644 --- a/GITHUB_SHA.h +++ b/GITHUB_SHA.h @@ -1 +1 @@ -#define GITHUB_SHA "devel-202211042235Z" +#define GITHUB_SHA "devel-202211062033Z" From 7f3d5475413bb51969d4ba9388701b0c3c7abc9e Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Mon, 7 Nov 2022 11:20:00 +0100 Subject: [PATCH 15/17] Initialize outboundRing properly to NULL --- EthernetInterface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EthernetInterface.h b/EthernetInterface.h index ce4a2ef..e9b6c60 100644 --- a/EthernetInterface.h +++ b/EthernetInterface.h @@ -65,7 +65,7 @@ class EthernetInterface { EthernetServer * server; EthernetClient 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 uint8_t buffer[MAX_ETH_BUFFER+1]; // buffer used by TCP for the recv - RingStream * outboundRing; + RingStream * outboundRing = NULL; }; #endif From b061c0b347b08476f620d220efe75c35356ec02e Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Mon, 7 Nov 2022 11:22:15 +0100 Subject: [PATCH 16/17] version --- GITHUB_SHA.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GITHUB_SHA.h b/GITHUB_SHA.h index 4aee545..e870d25 100644 --- a/GITHUB_SHA.h +++ b/GITHUB_SHA.h @@ -1 +1 @@ -#define GITHUB_SHA "devel-202211062033Z" +#define GITHUB_SHA "devel-202211071020Z" From 280e61e1fc4d602b9562e23e9ed1560cb9ccd97e Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Mon, 7 Nov 2022 11:53:56 +0100 Subject: [PATCH 17/17] Make EthernetInterface code more robust --- EthernetInterface.cpp | 8 +++++++- EthernetInterface.h | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/EthernetInterface.cpp b/EthernetInterface.cpp index 2668ece..8dd4d31 100644 --- a/EthernetInterface.cpp +++ b/EthernetInterface.cpp @@ -163,6 +163,10 @@ bool EthernetInterface::checkLink() { } void EthernetInterface::loop2() { + if (!outboundRing) { // no idea to call loop2() if we can't handle outgoing data in it + if (Diag::ETHERNET) DIAG(F("No outboundRing")); + return; + } // get client from the server EthernetClient client = server->accept(); @@ -217,7 +221,9 @@ void EthernetInterface::loop2() { // handle at most 1 outbound transmission int socketOut=outboundRing->read(); - if (socketOut>=0) { + if (socketOut >= MAX_SOCK_NUM) { + DIAG(F("Ethernet outboundRing socket=%d error"), socketOut); + } else if (socketOut >= 0) { int count=outboundRing->count(); if (Diag::ETHERNET) DIAG(F("Ethernet reply socket=%d, count=:%d"), socketOut,count); for(;count>0;count--) clients[socketOut].write(outboundRing->read()); diff --git a/EthernetInterface.h b/EthernetInterface.h index e9b6c60..8078c3f 100644 --- a/EthernetInterface.h +++ b/EthernetInterface.h @@ -62,7 +62,7 @@ class EthernetInterface { ~EthernetInterface(); void loop2(); bool checkLink(); - EthernetServer * server; + EthernetServer * server = NULL; EthernetClient 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 uint8_t buffer[MAX_ETH_BUFFER+1]; // buffer used by TCP for the recv RingStream * outboundRing = NULL;