From 8f101bb7b8bd7027bb1084ff01b149a44debd3dc Mon Sep 17 00:00:00 2001 From: Russ Butler Date: Thu, 7 Sep 2017 11:29:34 -0500 Subject: [PATCH] Fix dropped receive data caused by timeout Set receive timeout to 500ms to prevent dropped data. Update the call in ESP8266::recv to call parser.process_oob rather than parser.recv since this code is only used to trigger the processing of out-of-band data. --- ESP8266/ATParser.lib | 2 +- ESP8266/ESP8266.cpp | 4 ++-- ESP8266Interface.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ESP8266/ATParser.lib b/ESP8266/ATParser.lib index 9248823..2f4de6a 100644 --- a/ESP8266/ATParser.lib +++ b/ESP8266/ATParser.lib @@ -1 +1 @@ -https://github.com/ARMmbed/ATParser/#77734ee44a63b149cd20a6647394ab781b67c0aa +https://github.com/ARMmbed/ATParser/#a2cb09990f11a17504608272966f1185b211ce23 diff --git a/ESP8266/ESP8266.cpp b/ESP8266/ESP8266.cpp index 6751d78..0e95ad2 100644 --- a/ESP8266/ESP8266.cpp +++ b/ESP8266/ESP8266.cpp @@ -269,8 +269,8 @@ int32_t ESP8266::recv(int id, void *data, uint32_t amount) } } - // Wait for inbound packet - if (!_parser.recv("OK")) { + // Check for inbound packets + if (!_parser.process_oob()) { return -1; } } diff --git a/ESP8266Interface.cpp b/ESP8266Interface.cpp index dcf4bea..77d3ce8 100644 --- a/ESP8266Interface.cpp +++ b/ESP8266Interface.cpp @@ -26,7 +26,7 @@ #define ESP8266_SEND_TIMEOUT 500 #endif #ifndef ESP8266_RECV_TIMEOUT -#define ESP8266_RECV_TIMEOUT 0 +#define ESP8266_RECV_TIMEOUT 500 #endif #ifndef ESP8266_MISC_TIMEOUT #define ESP8266_MISC_TIMEOUT 500