Skip to content

Minor yield() cleanup: optimistic_yield, proper polledTimeout use #6869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cores/esp8266/HardwareSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ unsigned long HardwareSerial::detectBaudrate(time_t timeoutMillis)
if ((detectedBaudrate = testBaudrate())) {
break;
}
yield();
delay(100);
}
return detectedBaudrate;
Expand Down
2 changes: 1 addition & 1 deletion cores/esp8266/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
6 changes: 3 additions & 3 deletions libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down