Skip to content

Commit cb7ff53

Browse files
author
Dominika Maziec
committed
esp8266 in _oob_* : recv() brought back where it was needed
1 parent 1f5a124 commit cb7ff53

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

components/wifi/esp8266-driver/ESP8266/ESP8266.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ void ESP8266::_oob_packet_hdlr()
686686
}
687687

688688
if (_tcp_passive && _sock_i[id].open == true && _sock_i[id].proto == NSAPI_TCP) {
689-
if (_parser.scanf("%d\n", &amount)) {
689+
if (_parser.recv("%d\n", &amount)) {
690690
_sock_i[id].tcp_data_avbl = amount;
691691

692692
// notify data is available

platform/ATCmdParser.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,9 @@ class ATCmdParser : private NonCopyable<ATCmdParser> {
271271

272272
/**
273273
* Direct scanf on underlying stream
274+
* This function does not itself match whitespace in its format string, so \n is not significant to it.
275+
* It should be used only when certain string is needed or format ends with certain character, otherwise
276+
* it will fill the output with one character.
274277
* @see scanf
275278
*
276279
* @param format Format string to pass to scanf

platform/source/ATCmdParser.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@ bool ATCmdParser::vrecv(const char *response, std::va_list args)
309309
if (whole_line_wanted && c != '\n') {
310310
// Don't attempt scanning until we get delimiter if they included it in format
311311
// This allows recv("Foo: %s\n") to work, and not match with just the first character of a string
312-
// (scanf does not itself match whitespace in its format string, so \n is not significant to it)
313312
} else if (response) {
314313
sscanf(_buffer + offset, _buffer, &count);
315314
}

0 commit comments

Comments
 (0)