-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Update ESP8266WiFiSTAClass::waitForConnectResult() for the same behavior with ESP32. #4985
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
base: master
Are you sure you want to change the base?
Changes from 3 commits
0be5be6
d2c4cc7
b39fc18
579a9a6
5c4ff27
8abc913
8544d30
956510e
52fcfa3
c5fec54
cba45ea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -237,7 +237,8 @@ class String { | |
void toLowerCase(void); | ||
void toUpperCase(void); | ||
void trim(void); | ||
|
||
|
||
int td_split(String delimiter, String** str_array); // v2.3 split String to String Array by multi-delimiters | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove this change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Already removed this String addition change. |
||
// parsing/conversion | ||
long toInt(void) const; | ||
float toFloat(void) const; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -374,7 +374,8 @@ uint8_t ESP8266WiFiSTAClass::waitForConnectResult() { | |
if((wifi_get_opmode() & 1) == 0) { | ||
return WL_DISCONNECTED; | ||
} | ||
while(status() == WL_DISCONNECTED) { | ||
int i = 0; | ||
while((!status() || status() >= WL_DISCONNECTED) && i++ < 100) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a max of 10s time. Some connections could take longer, especially under poor signal conditions. Some users could not want to spend so much time trying to connect and want to give up sooner. I suggest taking an argument that defaults to this when not set. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If default time trying to connect when not set is 15 secs. What do you think ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What would happen with a default non infinite value when user's network connectivity / the router is for any reason powered down or disconnected for a while (a longer while than this default value), or takes long to power on, or whatever ? My point is that usually sketches patiently wait for connectivity. With this change, all sketches would need to be updated to loop on the connectivity loop. I don't question this PR, only the historical default behavior / backward compatibility. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops @d-a-v is correct: either we maintain backwards compatibility and merge now, or we keep this breaking change and wait until release 3.0.0 to merge. I prefer the former.
@ShinDaiIchi Could you please implement the changes and update the PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Already update with WiFi connecting's wait-timeout with backwards compatibility. |
||
delay(100); | ||
} | ||
return status(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this String addition.
On a personal note, the implementation makes me want to tear my eyes out. Why didn't the author use a C++ reference instead of a double pointer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I just tried something on String addition but not for this PR.
Already remove them.