mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
Do not call yield() from timedRead() or timedPeek() when _timeout is set to 0. (#6242)
This commit is contained in:
parent
4bfa2ae889
commit
ad2b51e36f
@ -33,6 +33,8 @@ int Stream::timedRead() {
|
||||
c = read();
|
||||
if(c >= 0)
|
||||
return c;
|
||||
if(_timeout == 0)
|
||||
return -1;
|
||||
yield();
|
||||
} while(millis() - _startMillis < _timeout);
|
||||
return -1; // -1 indicates timeout
|
||||
@ -46,6 +48,8 @@ int Stream::timedPeek() {
|
||||
c = peek();
|
||||
if(c >= 0)
|
||||
return c;
|
||||
if(_timeout == 0)
|
||||
return -1;
|
||||
yield();
|
||||
} while(millis() - _startMillis < _timeout);
|
||||
return -1; // -1 indicates timeout
|
||||
@ -254,4 +258,3 @@ String Stream::readStringUntil(char terminator) {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user