From 298de834a29e7b5dfa1d5109fedba1c4aacddd3d Mon Sep 17 00:00:00 2001 From: M Hightower <27247790+mhightower83@users.noreply.github.com> Date: Fri, 28 Jun 2019 14:24:16 -0700 Subject: [PATCH] Do not call yield() from timedRead() or timedPeek() when _timeout is set to 0. --- cores/esp8266/Stream.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cores/esp8266/Stream.cpp b/cores/esp8266/Stream.cpp index a29388b2bf..3d7f5bc23f 100644 --- a/cores/esp8266/Stream.cpp +++ b/cores/esp8266/Stream.cpp @@ -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; } -