Skip to content
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

Modified WiFiMulti to work with FreeRTOS #1876

Closed
wants to merge 7 commits into from
Closed
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
13 changes: 11 additions & 2 deletions libraries/WiFi/src/WiFiMulti.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,17 @@ uint8_t WiFiMulti::run(uint32_t to) {
WiFi.beginBSSID(j->ssid, j->bssid);
}
while (!WiFi.connected() && (millis() - start < to)) {
delay(5);
}
// Replaced delay(5); with the following to prevent
// failure when using RTOS
unsigned long tWifiDelayForRtos_start = millis();
while (millis()-tWifiDelayForRtos_start <= 5) {
if(millis()<tWifiDelayForRtos_start) {
// millis wrapped around to zero. Rare to hit this
// issue, but it will do this every 49 days.
tWifiDelayForRtos_start = millis();
}
}
}
if (WiFi.status() == WL_CONNECTED) {
return WL_CONNECTED;
}
Expand Down
Loading