-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
Non-blocking version of WiFi::localIP() #406
Comments
after WiFi.begin, the localIP() should return immediately because WiFi.begin waits for DHCP. how do you initialize WiFi? |
I am also setting timeout to zero, because wifi connection is not mandatory on my device. Its priority is to control connected devices. The control cycle has 1 millisecond resolution. I can handle aprx 20mills a common modem-esp32 exchange, but i cannot handle 5 seconds blocking call. |
I made PR that fixes this by adding PR: I hope it fixes your issue and have a nice day :) |
but then don't call localIP() if there is no WiFi connoection |
You don't understand. My controller is running in the main loop where many operations are scheduler depend on various conditions such a time, sensors or status of various components. One component is Wifi connection. So the task calls WiFi.begin(), then periodically checks for status (while returning CPU thread back to the main loop) and then , when status is OK, retrieves localIP. now consider environment with bad wifi connection. The WiFi status is OK, but immediately after the wifi connection is lost and localIP blocks. Or other scenario, when WiFi.status is OK, but probably DHCP handshake is still in progress. As I understand, this is the main reason, why the function is blocking. So non-blocking version can simply return "still in progress" and we are good, the Task object can postpone the operation until next cycle. |
Thank you, I already happily forked this PR. |
correct solution is change the esp32 firmware to not wait for localIP() |
Glad you solved it! Have a nice day. |
You mean using ESP-IDF? But i think solution is solution. |
I looked more into it. the firmware returns immediately. cc: @pennam |
Unfortunately, some code expects blocking version of this function, like here
|
no. that doesn't require a blocking localIP(). config() sets the static IP settings. |
I don't know. I assume that EDIT: apparently vvvvvvv Actually I don't like that code. It is weird. It calls
by the way, the above code is formally wrong, but luckily works for this specific usage. |
@JAndrassy I will look at it for the next release, 1.3.x is already in the oven |
Can we have non-blocking version of the function localIP?
I have WDT set on 5 seconds and this function causes WDT to trigger
ArduinoCore-renesas/libraries/WiFiS3/src/WiFi.cpp
Line 336 in 03b4a91
Thank you
The text was updated successfully, but these errors were encountered: