add timeout to streamSkipUntil
This commit is contained in:
@@ -644,9 +644,13 @@ public:
|
|||||||
streamWrite(tail...);
|
streamWrite(tail...);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool streamSkipUntil(char c) { //TODO: timeout
|
bool streamSkipUntil(char c) {
|
||||||
while (true) {
|
const unsigned long timeout = 1000L;
|
||||||
while (!stream.available()) { TINY_GSM_YIELD(); }
|
unsigned long startMillis = millis();
|
||||||
|
while (millis() - startMillis < timeout) {
|
||||||
|
while (millis() - startMillis < timeout && !stream.available()) {
|
||||||
|
TINY_GSM_YIELD();
|
||||||
|
}
|
||||||
if (stream.read() == c)
|
if (stream.read() == c)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -412,9 +412,13 @@ public:
|
|||||||
streamWrite(tail...);
|
streamWrite(tail...);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool streamSkipUntil(char c) { //TODO: timeout
|
bool streamSkipUntil(char c) {
|
||||||
while (true) {
|
const unsigned long timeout = 1000L;
|
||||||
while (!stream.available()) { TINY_GSM_YIELD(); }
|
unsigned long startMillis = millis();
|
||||||
|
while (millis() - startMillis < timeout) {
|
||||||
|
while (millis() - startMillis < timeout && !stream.available()) {
|
||||||
|
TINY_GSM_YIELD();
|
||||||
|
}
|
||||||
if (stream.read() == c)
|
if (stream.read() == c)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -589,9 +589,13 @@ public:
|
|||||||
streamWrite(tail...);
|
streamWrite(tail...);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool streamSkipUntil(char c) { //TODO: timeout
|
bool streamSkipUntil(char c) {
|
||||||
while (true) {
|
const unsigned long timeout = 1000L;
|
||||||
while (!stream.available()) { TINY_GSM_YIELD(); }
|
unsigned long startMillis = millis();
|
||||||
|
while (millis() - startMillis < timeout) {
|
||||||
|
while (millis() - startMillis < timeout && !stream.available()) {
|
||||||
|
TINY_GSM_YIELD();
|
||||||
|
}
|
||||||
if (stream.read() == c)
|
if (stream.read() == c)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -837,9 +837,13 @@ public:
|
|||||||
streamWrite(tail...);
|
streamWrite(tail...);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool streamSkipUntil(char c) { //TODO: timeout
|
bool streamSkipUntil(char c) {
|
||||||
while (true) {
|
const unsigned long timeout = 1000L;
|
||||||
while (!stream.available()) { TINY_GSM_YIELD(); }
|
unsigned long startMillis = millis();
|
||||||
|
while (millis() - startMillis < timeout) {
|
||||||
|
while (millis() - startMillis < timeout && !stream.available()) {
|
||||||
|
TINY_GSM_YIELD();
|
||||||
|
}
|
||||||
if (stream.read() == c)
|
if (stream.read() == c)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -606,9 +606,13 @@ public:
|
|||||||
streamWrite(tail...);
|
streamWrite(tail...);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool streamSkipUntil(char c) { //TODO: timeout
|
bool streamSkipUntil(char c) {
|
||||||
while (true) {
|
const unsigned long timeout = 1000L;
|
||||||
while (!stream.available()) { TINY_GSM_YIELD(); }
|
unsigned long startMillis = millis();
|
||||||
|
while (millis() - startMillis < timeout) {
|
||||||
|
while (millis() - startMillis < timeout && !stream.available()) {
|
||||||
|
TINY_GSM_YIELD();
|
||||||
|
}
|
||||||
if (stream.read() == c)
|
if (stream.read() == c)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user