Skip to content

Fix 10 second delay in WiFiClient read methods when no data is available to read #458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions libraries/WiFiS3/src/Modem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,15 +289,18 @@ ModemClass::ParseResult ModemClass::buf_read(const string &prompt, string &data_
* in case multiple parameters separated by ',' are sent, they will be present in data_res
* - if we encounter <CR> we need to wait for <LF>
* - if we encounter <LF> we need to parse the response status
* - if we encounter '|', the next token will contain binary sized data, the current value in
* - if we encounter '|', the next token will contain binary sized data, the current value
* in data_res contains the length of the next token
*/

if(c == '|') { // sized read, the previous parameter is the length
state = at_parse_state_t::Sized;

sized_read_size = atoi(data_res.c_str());
data_res.clear();
if (sized_read_size != 0) {
state = at_parse_state_t::Sized;
} else {
state = at_parse_state_t::Res;
}
} else if(c == '\r') {
state = at_parse_state_t::ResWaitLF;
} else if(c == '\n') {
Expand Down
Loading