From 44d41ac4d61f05bdafeca3edcd5ed1798f48a9bc Mon Sep 17 00:00:00 2001 From: Asbelos Date: Tue, 14 Jul 2020 13:32:55 +0100 Subject: [PATCH] Wifi write(0) Some environments complain about sending a char --- WifiInterface.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/WifiInterface.cpp b/WifiInterface.cpp index 1a1196c..e57e8b7 100644 --- a/WifiInterface.cpp +++ b/WifiInterface.cpp @@ -156,7 +156,7 @@ void WifiInterface::loop(Stream & wifiStream) { } // switch } // while if (loopstate!=99) return; - streamer.write('\0'); + streamer.write((byte)0); // null the end of the buffer for conventional string handling DIAG(F("\nWifiRead:%d:%e\n"),connectionId,buffer); streamer.setBufferContentPosition(0,0); // reset write position to start of buffer @@ -176,7 +176,9 @@ void WifiInterface::loop(Stream & wifiStream) { if (streamer.available()) { // there is a reply to send - streamer.write('\0'); + streamer.write((byte)0); // null the end of the buffer for conventional string handling in DIAG + // but remember to NOT include the null when transmitting back to client + DIAG(F("\nWiFiInterface reply c(%d) l(%d) [%e]\n"),connectionId,streamer.available()-1,buffer); StringFormatter::send(wifiStream,F("AT+CIPSEND=%d,%d\r\n"),connectionId,streamer.available()-1);