1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-27 01:56:14 +01:00

Wifi write(0)

Some environments complain about sending a char
This commit is contained in:
Asbelos 2020-07-14 13:32:55 +01:00
parent 3691cf87d3
commit 44d41ac4d6

View File

@ -156,7 +156,7 @@ void WifiInterface::loop(Stream & wifiStream) {
} // switch } // switch
} // while } // while
if (loopstate!=99) return; 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); DIAG(F("\nWifiRead:%d:%e\n"),connectionId,buffer);
streamer.setBufferContentPosition(0,0); // reset write position to start of 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 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); 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); StringFormatter::send(wifiStream,F("AT+CIPSEND=%d,%d\r\n"),connectionId,streamer.available()-1);