From 45b36c48cbfd4fbeda4b85cb946b33d38fb672f9 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Wed, 30 Nov 2022 13:16:04 +0100 Subject: [PATCH] be more strict about int vs char for the wifi diag --- WifiInterface.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/WifiInterface.cpp b/WifiInterface.cpp index 4d93eda..347d7ef 100644 --- a/WifiInterface.cpp +++ b/WifiInterface.cpp @@ -377,11 +377,12 @@ bool WifiInterface::checkForOK( const unsigned int timeout, const FSH * waitfor, char *locator = (char *)waitfor; DIAG(F("Wifi Check: [%E]"), waitfor); while ( millis() - startTime < timeout) { - while (wifiStream->available()) { - int ch = wifiStream->read(); + int nextchar; + while (wifiStream->available() && (nextchar = wifiStream->read()) > -1) { + char ch = (char)nextchar; if (echo) { if (escapeEcho) StringFormatter::printEscape( ch); /// THIS IS A DIAG IN DISGUISE - else USB_SERIAL.print((char)ch); + else USB_SERIAL.print(ch); } if (ch != GETFLASH(locator)) locator = (char *)waitfor; if (ch == GETFLASH(locator)) {