mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
Merge pull request #6869 from dok-net/refactooptimisticyield
Minor yield() cleanup: optimistic_yield, proper polledTimeout use
This commit is contained in:
commit
d7d03f9a41
@ -146,7 +146,6 @@ unsigned long HardwareSerial::detectBaudrate(time_t timeoutMillis)
|
||||
if ((detectedBaudrate = testBaudrate())) {
|
||||
break;
|
||||
}
|
||||
yield();
|
||||
delay(100);
|
||||
}
|
||||
return detectedBaudrate;
|
||||
|
@ -54,7 +54,7 @@ void hexdump(const void *mem, uint32_t len, uint8_t cols)
|
||||
}
|
||||
src += linesize;
|
||||
len -= linesize;
|
||||
yield();
|
||||
optimistic_yield(10000);
|
||||
}
|
||||
os_printf("\n");
|
||||
}
|
||||
|
@ -431,10 +431,10 @@ int8_t ESP8266WiFiSTAClass::waitForConnectResult(unsigned long timeoutLength) {
|
||||
if((wifi_get_opmode() & 1) == 0) {
|
||||
return WL_DISCONNECTED;
|
||||
}
|
||||
using esp8266::polledTimeout::oneShot;
|
||||
oneShot timeout(timeoutLength); // number of milliseconds to wait before returning timeout error
|
||||
// if probing doesn't trip, this yields
|
||||
using oneShotYieldMs = esp8266::polledTimeout::timeoutTemplate<false, esp8266::polledTimeout::YieldPolicy::YieldOrSkip>;
|
||||
oneShotYieldMs timeout(timeoutLength); // number of milliseconds to wait before returning timeout error
|
||||
while(!timeout) {
|
||||
yield();
|
||||
if(status() != WL_DISCONNECTED) {
|
||||
return status();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user