From 09cf6763cb6a742ce7f56b5332c655779e4fab86 Mon Sep 17 00:00:00 2001 From: Asbelos Date: Sat, 25 Jul 2020 01:40:20 +0100 Subject: [PATCH] DIAGSERIAL corrections for SAMD --- CVReader.ino | 1 + DCCEXParser.cpp | 2 +- WifiInterface.cpp | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CVReader.ino b/CVReader.ino index 1251286..1abe39c 100644 --- a/CVReader.ino +++ b/CVReader.ino @@ -80,6 +80,7 @@ void setup() { // Responsibility 1: Start the usb connection for diagnostics and possible JMRI input // DIAGSERAL is normally Serial but uses SerialUSB on a SAMD processor DIAGSERIAL.begin(115200); + while(!DIAGSERIAL); // Responsibility 2: Start the DCC engine. DCC::begin(); diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index 546c15c..0339945 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -35,7 +35,7 @@ const int HASH_KEYWORD_MAIN=11339; int DCCEXParser::stashP[MAX_PARAMS]; bool DCCEXParser::stashBusy; - Print & DCCEXParser::stashStream=Serial; // keep compiler happy but ovevride in constructor + Print & DCCEXParser::stashStream=DIAGSERIAL; // keep compiler happy but ovevride in constructor // This is a JMRI command parser, one instance per incoming stream // It doesnt know how the string got here, nor how it gets back. diff --git a/WifiInterface.cpp b/WifiInterface.cpp index ee0fede..34efe1b 100644 --- a/WifiInterface.cpp +++ b/WifiInterface.cpp @@ -93,7 +93,7 @@ bool WifiInterface::checkForOK(Stream & wifiStream, const unsigned int timeout, while( millis()-startTime < timeout) { while(wifiStream.available()) { int ch=wifiStream.read(); - if (echo) StringFormatter::printEscape(Serial,ch); /// THIS IS A DIAG IN DISGUISE + if (echo) StringFormatter::printEscape(DIAGSERIAL,ch); /// THIS IS A DIAG IN DISGUISE if (ch!=pgm_read_byte_near(locator)) locator=waitfor; if (ch==pgm_read_byte_near(locator)) { locator++; @@ -139,7 +139,7 @@ void WifiInterface::loop(Stream & wifiStream) { int ch=wifiStream.read(); // echo the char to the diagnostic stream in escaped format - StringFormatter::printEscape(Serial,ch); // DIAG in disguise + StringFormatter::printEscape(DIAGSERIAL,ch); // DIAG in disguise switch (loopstate) { case 0: // looking for +IPD