Skip to content

Commit d04f768

Browse files
dok-netdevyte
authored andcommitted
Use PolledTimeout for busy loop timeout (#6371)
1 parent 85f1ea7 commit d04f768

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cores/esp8266/HardwareSerial.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ unsigned long HardwareSerial::testBaudrate()
121121

122122
unsigned long HardwareSerial::detectBaudrate(time_t timeoutMillis)
123123
{
124-
time_t startMillis = millis();
124+
esp8266::polledTimeout::oneShotFastMs timeOut(timeoutMillis);
125125
unsigned long detectedBaudrate;
126-
while ((time_t) millis() - startMillis < timeoutMillis) {
126+
while (!timeOut) {
127127
if ((detectedBaudrate = testBaudrate())) {
128128
break;
129129
}

0 commit comments

Comments
 (0)