You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
While testing my solution I came across weird situation. While interrupting SIM800L <-> ESP32 communication I noticed that stream`s _timeout only skips the character that is being currently read, then tries to read another character in function modemRead.
My quickfix is:
size_tmodemRead(size_t size, uint8_t mux) {
#ifdef TINY_GSM_USE_HEX
sendAT(GF("+CIPRXGET=3,"), mux, ',', size);
if (waitResponse(GF("+CIPRXGET:")) != 1) {
return0;
}
#elsesendAT(GF("+CIPRXGET=2,"), mux, ',', size);
if (waitResponse(GF("+CIPRXGET:")) != 1) {
return0;
}
#endifstreamSkipUntil(','); // Skip Rx mode 2/normal or 3/HEXstreamSkipUntil(','); // Skip muxsize_t len_requested = stream.readStringUntil(',').toInt();
// ^^ Requested number of data bytes (1-1460 bytes)to be readsize_t len_confirmed = stream.readStringUntil('\n').toInt();
// ^^ Confirmed number of data bytes to be read, which may be less than requested.// 0 indicates that no data can be read.// This is actually be the number of bytes that will be remaining after the readfor (size_t i=0; i<len_requested; i++) {
uint32_t startMillis = millis();
#ifdef TINY_GSM_USE_HEX
while (stream.available() < 2 && (millis() - startMillis < sockets[mux]->_timeout)) {
TINY_GSM_YIELD();
}
char buf[4] = { 0, };
buf[0] = stream.read();
buf[1] = stream.read();
char c = strtol(buf, NULL, 16);
#elsewhile (!stream.available() && (millis() - startMillis < sockets[mux]->_timeout)) {
TINY_GSM_YIELD();
}
if(millis() - startMillis > sockets[mux]->_timeout){
DBG("TIMEOUT, ABORTING READ.");
break;
}
char c = stream.read();
#endif
sockets[mux]->rx.put(c);
}
// sockets[mux]->sock_available = modemGetAvailable(mux);
sockets[mux]->sock_available = len_confirmed;
waitResponse();
return len_requested;
}
Was skipping byte by byte intended? It seems weird to me.
The text was updated successfully, but these errors were encountered:
Hello,
While testing my solution I came across weird situation. While interrupting SIM800L <-> ESP32 communication I noticed that stream`s _timeout only skips the character that is being currently read, then tries to read another character in function modemRead.
My quickfix is:
Was skipping byte by byte intended? It seems weird to me.
The text was updated successfully, but these errors were encountered: