diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index a35803e..56f17a2 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -52,7 +52,7 @@ const int HASH_KEYWORD_ETHERNET = -30767; const int HASH_KEYWORD_MAX = 16244; const int HASH_KEYWORD_MIN = 15978; -int DCCEXParser::stashP[MAX_PARAMS]; +int DCCEXParser::stashP[MAX_COMMAND_PARAMS]; bool DCCEXParser::stashBusy; Print *DCCEXParser::stashStream = NULL; @@ -102,7 +102,7 @@ void DCCEXParser::loop(Stream &stream) Sensor::checkAll(&stream); // Update and print changes } -int DCCEXParser::splitValues(int result[MAX_PARAMS], const byte *cmd) +int DCCEXParser::splitValues(int result[MAX_COMMAND_PARAMS], const byte *cmd) { byte state = 1; byte parameterCount = 0; @@ -111,10 +111,10 @@ int DCCEXParser::splitValues(int result[MAX_PARAMS], const byte *cmd) bool signNegative = false; // clear all parameters in case not enough found - for (int i = 0; i < MAX_PARAMS; i++) + for (int i = 0; i < MAX_COMMAND_PARAMS; i++) result[i] = 0; - while (parameterCount < MAX_PARAMS) + while (parameterCount < MAX_COMMAND_PARAMS) { byte hot = *remainingCmd; @@ -161,7 +161,7 @@ int DCCEXParser::splitValues(int result[MAX_PARAMS], const byte *cmd) return parameterCount; } -int DCCEXParser::splitHexValues(int result[MAX_PARAMS], const byte *cmd) +int DCCEXParser::splitHexValues(int result[MAX_COMMAND_PARAMS], const byte *cmd) { byte state = 1; byte parameterCount = 0; @@ -169,10 +169,10 @@ int DCCEXParser::splitHexValues(int result[MAX_PARAMS], const byte *cmd) const byte *remainingCmd = cmd + 1; // skips the opcode // clear all parameters in case not enough found - for (int i = 0; i < MAX_PARAMS; i++) + for (int i = 0; i < MAX_COMMAND_PARAMS; i++) result[i] = 0; - while (parameterCount < MAX_PARAMS) + while (parameterCount < MAX_COMMAND_PARAMS) { byte hot = *remainingCmd; @@ -251,7 +251,7 @@ void DCCEXParser::parse(Print *stream, byte *com, bool blocking) (void)EEPROM; // tell compiler not to warn this is unused if (Diag::CMD) DIAG(F("\nPARSING:%s\n"), com); - int p[MAX_PARAMS]; + int p[MAX_COMMAND_PARAMS]; while (com[0] == '<' || com[0] == ' ') com++; // strip off any number of < or spaces byte params = splitValues(p, com); @@ -770,13 +770,13 @@ bool DCCEXParser::parseD(Print *stream, int params, int p[]) } // CALLBACKS must be static -bool DCCEXParser::stashCallback(Print *stream, int p[MAX_PARAMS]) +bool DCCEXParser::stashCallback(Print *stream, int p[MAX_COMMAND_PARAMS]) { if (stashBusy ) return false; stashBusy = true; stashStream = stream; - memcpy(stashP, p, MAX_PARAMS * sizeof(p[0])); + memcpy(stashP, p, MAX_COMMAND_PARAMS * sizeof(p[0])); return true; } void DCCEXParser::callback_W(int result) diff --git a/DCCEXParser.h b/DCCEXParser.h index f0546b2..c1dfd13 100644 --- a/DCCEXParser.h +++ b/DCCEXParser.h @@ -34,7 +34,7 @@ struct DCCEXParser static void setFilter(FILTER_CALLBACK filter); static void setRMFTFilter(FILTER_CALLBACK filter); static void setAtCommandCallback(AT_COMMAND_CALLBACK filter); - static const int MAX_PARAMS=10; // Must not exceed this + static const int MAX_COMMAND_PARAMS=10; // Must not exceed this private: @@ -42,8 +42,8 @@ struct DCCEXParser byte bufferLength=0; bool inCommandPayload=false; byte buffer[MAX_BUFFER+2]; - int splitValues( int result[MAX_PARAMS], const byte * command); - int splitHexValues( int result[MAX_PARAMS], const byte * command); + int splitValues( int result[MAX_COMMAND_PARAMS], const byte * command); + int splitHexValues( int result[MAX_COMMAND_PARAMS], const byte * command); bool parseT(Print * stream, int params, int p[]); bool parseZ(Print * stream, int params, int p[]); @@ -55,8 +55,8 @@ struct DCCEXParser static bool stashBusy; static Print * stashStream; - static int stashP[MAX_PARAMS]; - bool stashCallback(Print * stream, int p[MAX_PARAMS]); + static int stashP[MAX_COMMAND_PARAMS]; + bool stashCallback(Print * stream, int p[MAX_COMMAND_PARAMS]); static void callback_W(int result); static void callback_B(int result); static void callback_R(int result); diff --git a/WifiInboundHandler.cpp b/WifiInboundHandler.cpp index 67f68e3..02d3e0a 100644 --- a/WifiInboundHandler.cpp +++ b/WifiInboundHandler.cpp @@ -17,6 +17,7 @@ * You should have received a copy of the GNU General Public License * along with CommandStation. If not, see . */ +#ifndef ARDUINO_AVR_UNO_WIFI_REV2 #include #include "WifiInboundHandler.h" #include "RingStream.h" @@ -247,3 +248,5 @@ void WifiInboundHandler::purgeCurrentCIPSEND() { pendingCipsend=false; clientPendingCIPSEND=-1; } + +#endif diff --git a/WifiInterface.cpp b/WifiInterface.cpp index 6735f1a..5b3a062 100644 --- a/WifiInterface.cpp +++ b/WifiInterface.cpp @@ -17,7 +17,8 @@ You should have received a copy of the GNU General Public License along with CommandStation. If not, see . */ - +#ifndef ARDUINO_AVR_UNO_WIFI_REV2 +// This code is NOT compiled on a unoWifiRev2 processor which uses a different architecture #include "WifiInterface.h" /* config.h included there */ #include #include "DIAG.h" @@ -288,7 +289,6 @@ wifiSerialState WifiInterface::setup2(const FSH* SSid, const FSH* password, const byte MAX_IP_LENGTH=15; char ipString[MAX_IP_LENGTH+1]; ipString[MAX_IP_LENGTH]='\0'; // protection against missing " character on end. - byte ipLen=0; for(byte ipLen=0;ipLenavailable()); int ipChar=wifiStream->read(); @@ -362,3 +362,5 @@ void WifiInterface::loop() { WifiInboundHandler::loop(); } } + +#endif