From 46d1f3e237b1a64e9fa2d7d65e872ae2b77cfafa Mon Sep 17 00:00:00 2001 From: Asbelos Date: Fri, 3 Jul 2020 17:35:02 +0100 Subject: [PATCH] Copyrights etc --- CVReader.ino | 21 ++++++++++++++++++++ DCC.cpp | 18 +++++++++++++++++ DCC.h | 18 +++++++++++++++++ DCCEXParser.cpp | 18 +++++++++++++++++ DCCEXParser.h | 18 +++++++++++++++++ DCCWaveform.cpp | 18 +++++++++++++++++ DCCWaveform.h | 18 +++++++++++++++++ DIAG.h | 18 +++++++++++++++++ EEStore.cpp | 2 +- EEStore.h | 2 +- HTTPParser.cpp | 18 +++++++++++++++++ HTTPParser.h | 18 +++++++++++++++++ Hardware.cpp | 18 +++++++++++++++++ Hardware.h | 18 +++++++++++++++++ Outputs.cpp | 18 +++++++++++++++++ Outputs.h | 18 +++++++++++++++++ Sensors.cpp | 18 +++++++++++++++++ Sensors.h | 18 +++++++++++++++++ StringFormatter.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++++ StringFormatter.h | 23 ++++++++++++++++++++-- Turnouts.cpp | 18 +++++++++++++++++ Turnouts.h | 18 +++++++++++++++++ WiThrottle.h | 18 +++++++++++++++++ WifiInterface.cpp | 28 ++++++++++++++++++++++----- WifiInterface.h | 18 +++++++++++++++++ 25 files changed, 456 insertions(+), 9 deletions(-) diff --git a/CVReader.ino b/CVReader.ino index 9ba6724..be69908 100644 --- a/CVReader.ino +++ b/CVReader.ino @@ -1,3 +1,24 @@ +/* + * © 2020, Chris Harlow. All rights reserved. + * + * This file is part of Asbelos DCC API + * + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * It is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation. If not, see . + */ + + + #include "DCC.h" #include "DIAG.h" #include "DCCEXParser.h" diff --git a/DCC.cpp b/DCC.cpp index 7f2f88e..7051d35 100644 --- a/DCC.cpp +++ b/DCC.cpp @@ -1,3 +1,21 @@ +/* + * © 2020, Chris Harlow. All rights reserved. + * + * This file is part of Asbelos DCC API + * + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * It is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation. If not, see . + */ #include "DCC.h" #include "DCCWaveform.h" #include "DIAG.h" diff --git a/DCC.h b/DCC.h index b7d1a9b..9089a5f 100644 --- a/DCC.h +++ b/DCC.h @@ -1,3 +1,21 @@ +/* + * © 2020, Chris Harlow. All rights reserved. + * + * This file is part of Asbelos DCC API + * + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * It is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation. If not, see . + */ #ifndef DCC_h #define DCC_h #include diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index b8bc54e..ff16c57 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -1,3 +1,21 @@ +/* + * © 2020, Chris Harlow. All rights reserved. + * + * This file is part of Asbelos DCC API + * + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * It is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation. If not, see . + */ #include "StringFormatter.h" #include "DCCEXParser.h" #include "DCC.h" diff --git a/DCCEXParser.h b/DCCEXParser.h index 9408de9..71d9cc8 100644 --- a/DCCEXParser.h +++ b/DCCEXParser.h @@ -1,3 +1,21 @@ +/* + * © 2020, Chris Harlow. All rights reserved. + * + * This file is part of Asbelos DCC API + * + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * It is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation. If not, see . + */ #ifndef DCCEXParser_h #define DCCEXParser_h #include diff --git a/DCCWaveform.cpp b/DCCWaveform.cpp index 77ef23a..519640c 100644 --- a/DCCWaveform.cpp +++ b/DCCWaveform.cpp @@ -1,3 +1,21 @@ +/* + * © 2020, Chris Harlow. All rights reserved. + * + * This file is part of Asbelos DCC API + * + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * It is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation. If not, see . + */ #include #include "Hardware.h" #include "DCCWaveform.h" diff --git a/DCCWaveform.h b/DCCWaveform.h index a42960a..12cd96c 100644 --- a/DCCWaveform.h +++ b/DCCWaveform.h @@ -1,3 +1,21 @@ +/* + * © 2020, Chris Harlow. All rights reserved. + * + * This file is part of Asbelos DCC API + * + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * It is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation. If not, see . + */ #ifndef DCCWaveform_h #define DCCWaveform_h #include "Config.h" diff --git a/DIAG.h b/DIAG.h index 9fe8fd3..a00217c 100644 --- a/DIAG.h +++ b/DIAG.h @@ -1,3 +1,21 @@ +/* + * © 2020, Chris Harlow. All rights reserved. + * + * This file is part of Asbelos DCC API + * + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * It is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation. If not, see . + */ #ifndef DIAG_h #define DIAG_h diff --git a/EEStore.cpp b/EEStore.cpp index fb052c9..f52d1a1 100644 --- a/EEStore.cpp +++ b/EEStore.cpp @@ -73,4 +73,4 @@ int EEStore::pointer(){ /////////////////////////////////////////////////////////////////////////////// EEStore *EEStore::eeStore=NULL; -int EEStore::eeAddress=0; \ No newline at end of file +int EEStore::eeAddress=0; diff --git a/EEStore.h b/EEStore.h index c08fa0f..250d3d7 100644 --- a/EEStore.h +++ b/EEStore.h @@ -31,4 +31,4 @@ struct EEStore{ static void clear(); }; -#endif \ No newline at end of file +#endif diff --git a/HTTPParser.cpp b/HTTPParser.cpp index c3b7617..2d732e8 100644 --- a/HTTPParser.cpp +++ b/HTTPParser.cpp @@ -1,3 +1,21 @@ +/* + * © 2020, Chris Harlow. All rights reserved. + * + * This file is part of Asbelos DCC API + * + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * It is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation. If not, see . + */ #include "HTTPParser.h" #include "StringFormatter.h" diff --git a/HTTPParser.h b/HTTPParser.h index 655b3ba..a1bfdbb 100644 --- a/HTTPParser.h +++ b/HTTPParser.h @@ -1,3 +1,21 @@ +/* + * © 2020, Chris Harlow. All rights reserved. + * + * This file is part of Asbelos DCC API + * + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * It is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation. If not, see . + */ #ifndef HTTPParser_h #define HTTPParser_h #include diff --git a/Hardware.cpp b/Hardware.cpp index 532240e..dc5b323 100644 --- a/Hardware.cpp +++ b/Hardware.cpp @@ -1,3 +1,21 @@ +/* + * © 2020, Chris Harlow. All rights reserved. + * + * This file is part of Asbelos DCC API + * + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * It is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation. If not, see . + */ #include #include // use IDE menu Tools..Manage Libraries to locate and install TimerOne #include "avdweb_AnalogReadFast.h" diff --git a/Hardware.h b/Hardware.h index 9f8bd0e..47a14d3 100644 --- a/Hardware.h +++ b/Hardware.h @@ -1,3 +1,21 @@ +/* + * © 2020, Chris Harlow. All rights reserved. + * + * This file is part of Asbelos DCC API + * + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * It is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation. If not, see . + */ #ifndef Hardware_h #define Hardware_h // Virtualised hardware Interface diff --git a/Outputs.cpp b/Outputs.cpp index 5675ae2..744b066 100644 --- a/Outputs.cpp +++ b/Outputs.cpp @@ -1,3 +1,21 @@ +/* + * © 2020, Chris Harlow. All rights reserved. + * + * This file is part of Asbelos DCC API + * + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * It is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation. If not, see . + */ /********************************************************************** DCC++ BASE STATION supports optional OUTPUT control of any unused Arduino Pins for custom purposes. diff --git a/Outputs.h b/Outputs.h index 1b538d8..f46c34e 100644 --- a/Outputs.h +++ b/Outputs.h @@ -1,3 +1,21 @@ +/* + * © 2020, Chris Harlow. All rights reserved. + * + * This file is part of Asbelos DCC API + * + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * It is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation. If not, see . + */ #ifndef Outputs_h #define Outputs_h diff --git a/Sensors.cpp b/Sensors.cpp index b406ea0..3423fbe 100644 --- a/Sensors.cpp +++ b/Sensors.cpp @@ -1,3 +1,21 @@ +/* + * © 2020, Chris Harlow. All rights reserved. + * + * This file is part of Asbelos DCC API + * + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * It is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation. If not, see . + */ /********************************************************************** DCC++ BASE STATION supports Sensor inputs that can be connected to any Arduino Pin diff --git a/Sensors.h b/Sensors.h index 8104876..8bb44fc 100644 --- a/Sensors.h +++ b/Sensors.h @@ -1,3 +1,21 @@ +/* + * © 2020, Chris Harlow. All rights reserved. + * + * This file is part of Asbelos DCC API + * + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * It is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation. If not, see . + */ #ifndef Sensor_h #define Sensor_h diff --git a/StringFormatter.cpp b/StringFormatter.cpp index cab55b5..29ae772 100644 --- a/StringFormatter.cpp +++ b/StringFormatter.cpp @@ -1,3 +1,21 @@ +/* + * © 2020, Chris Harlow. All rights reserved. + * + * This file is part of Asbelos DCC API + * + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * It is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation. If not, see . + */ #include "StringFormatter.h" #include @@ -29,6 +47,8 @@ void StringFormatter::send2(Print & stream,const __FlashStringHelper* format, va case '%': stream.print('%'); break; case 'c': stream.print((char) va_arg(args, int)); break; case 's': stream.print(va_arg(args, char*)); break; + case 'e': printEscapes(stream,va_arg(args, char*)); break; + case 'E': printEscapes(stream,(const __FlashStringHelper*)va_arg(args, char*)); break; case 'S': stream.print((const __FlashStringHelper*)va_arg(args, char*)); break; case 'd': stream.print(va_arg(args, int), DEC); break; case 'b': stream.print(va_arg(args, int), BIN); break; @@ -39,3 +59,30 @@ void StringFormatter::send2(Print & stream,const __FlashStringHelper* format, va } va_end(args); } + +void StringFormatter::printEscapes(Print & stream, char * input) { + for(int i=0; ; ++i) { + char c=input[i]; + printEscape(stream,c); + if (c=='\0') return; + } +} +void StringFormatter::printEscapes(Print & stream, const __FlashStringHelper* input) { + char* flash=(char*)input; + for(int i=0; ; ++i) { + char c=pgm_read_byte_near(flash+i); + printEscape(stream,c); + if (c=='\0') return; + } +} +void StringFormatter::printEscape(Print & stream, char c) { + switch(c) { + case '\n': stream.print(F("\\n")); break; + case '\r': stream.print(F("\\r")); break; + case '\0': stream.print(F("\\0")); return; + case '\t': stream.print(F("\\t")); break; + case '\\': stream.print(F("\\")); break; + default: stream.print(c); + } + } + diff --git a/StringFormatter.h b/StringFormatter.h index 76dd605..888eca9 100644 --- a/StringFormatter.h +++ b/StringFormatter.h @@ -1,15 +1,34 @@ +/* + * © 2020, Chris Harlow. All rights reserved. + * + * This file is part of Asbelos DCC API + * + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * It is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation. If not, see . + */ #ifndef StringFormatter_h #define StringFormatter_h #include class StringFormatter { public: - static int parse(const char * com, int result[], byte maxResults); static void print( const __FlashStringHelper* input...); static void send(Print & serial, const __FlashStringHelper* input...); + static void printEscapes(Print & stream, char * input); + static void printEscapes(Print & stream, const __FlashStringHelper* input); + static void printEscape(Print & stream, char c); private: static void send2(Print & serial, const __FlashStringHelper* input,va_list args); - }; #endif diff --git a/Turnouts.cpp b/Turnouts.cpp index 3d6fd29..f280f86 100644 --- a/Turnouts.cpp +++ b/Turnouts.cpp @@ -1,3 +1,21 @@ +/* + * © 2020, Chris Harlow. All rights reserved. + * + * This file is part of Asbelos DCC API + * + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * It is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation. If not, see . + */ #include "Turnouts.h" #include "EEStore.h" #include "StringFormatter.h" diff --git a/Turnouts.h b/Turnouts.h index 28fd528..7fbbbe0 100644 --- a/Turnouts.h +++ b/Turnouts.h @@ -1,3 +1,21 @@ +/* + * © 2020, Chris Harlow. All rights reserved. + * + * This file is part of Asbelos DCC API + * + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * It is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation. If not, see . + */ #ifndef Turnouts_h #define Turnouts_h diff --git a/WiThrottle.h b/WiThrottle.h index f681b1f..94cf3c0 100644 --- a/WiThrottle.h +++ b/WiThrottle.h @@ -1,3 +1,21 @@ +/* + * © 2020, Chris Harlow. All rights reserved. + * + * This file is part of Asbelos DCC API + * + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * It is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation. If not, see . + */ #ifndef WiThrottle_h #define WiTHrottle_h diff --git a/WifiInterface.cpp b/WifiInterface.cpp index 42c69e3..6cbefaf 100644 --- a/WifiInterface.cpp +++ b/WifiInterface.cpp @@ -1,3 +1,21 @@ +/* + * © 2020, Chris Harlow. All rights reserved. + * + * This file is part of Asbelos DCC API + * + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * It is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation. If not, see . + */ #include "WifiInterface.h" #include "Config.h" #include "DIAG.h" @@ -56,16 +74,16 @@ bool WifiInterface::setup2(Stream & wifiStream, const __FlashStringHelper* SSid, bool WifiInterface::checkForOK(Stream & wifiStream, const unsigned int timeout, const char * waitfor, bool echo) { unsigned long startTime = millis(); char const *locator=waitfor; - DIAG(F("\nWifi setup Check: %S\n"),waitfor); + DIAG(F("\nWifi Check: %E"),waitfor); while( millis()-startTime < timeout) { while(wifiStream.available()) { int ch=wifiStream.read(); - if (echo) Serial.write(ch); + if (echo) StringFormatter::printEscape(Serial,ch); /// THIS IS A DIAG IN DISGUISE if (ch!=pgm_read_byte_near(locator)) locator=waitfor; if (ch==pgm_read_byte_near(locator)) { locator++; if (!pgm_read_byte_near(locator)) { - DIAG(F("\nOK after %dms\n"),millis()-startTime); + DIAG(F("\nChecked after %dms"),millis()-startTime); return true; } } @@ -140,7 +158,7 @@ void WifiInterface::loop(Stream & wifiStream) { if (loopstate!=99) return; streamer.write('\0'); - DIAG(F("\nWifiRead:%d:%s\n"),connectionId,buffer); + DIAG(F("\nWifiRead:%d:%e\n"),connectionId,buffer); streamer.setBufferContentPosition(0,0); // reset write position to start of buffer // SIDE EFFECT WARNING::: // We know that parser will read the entire buffer before starting to write to it. @@ -159,7 +177,7 @@ void WifiInterface::loop(Stream & wifiStream) { if (streamer.available()) { // there is a reply to send streamer.write('\0'); - DIAG(F("WiFiInterface Responding client (%d) l(%d) %s\n"),connectionId,streamer.available()-1,buffer); + DIAG(F("WiFiInterface Responding client (%d) l(%d) %e\n"),connectionId,streamer.available()-1,buffer); StringFormatter::send(wifiStream,F("AT+CIPSEND=%d,%d\r\n"),connectionId,streamer.available()-1); if (checkForOK(wifiStream,1000,PROMPT_SEARCH,true)) wifiStream.print((char *) buffer); diff --git a/WifiInterface.h b/WifiInterface.h index 9210a46..41649ee 100644 --- a/WifiInterface.h +++ b/WifiInterface.h @@ -1,3 +1,21 @@ +/* + * © 2020, Chris Harlow. All rights reserved. + * + * This file is part of Asbelos DCC API + * + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * It is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation. If not, see . + */ #ifndef WifiInterface_h #define WifiInterface_h