test
Fork of ESP8266 by
Diff: ESP8266.cpp
- Revision:
- 21:1a9b555962b5
- Parent:
- 20:32e5a5a328e0
--- a/ESP8266.cpp Tue Feb 23 01:29:53 2016 -0600 +++ b/ESP8266.cpp Thu Mar 03 17:38:40 2016 +0000 @@ -141,13 +141,15 @@ bool ESP8266::close(int id) { - //IDs only 0-4 - if(id > 4) { - return false; + //May take a second try if device is busy + for (unsigned i = 0; i < 2; i++) { + if (_parser.send("AT+CIPCLOSE=%d", id) + && _parser.recv("OK")) { + return true; + } } - return _parser.send("AT+CIPCLOSE=%d", id) - && _parser.recv("OK"); + return false; } void ESP8266::setTimeout(uint32_t timeout_ms)