-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Add Non-blocking Version of localIP Function for WiFiS3 library and fix FifoBuffer.h #408
base: main
Are you sure you want to change the base?
Conversation
the localIP() function just gets the IP from the esp32 over UART. it should be quick this platform has more networking libraries so please add to the title that this is about WiFiS3 library |
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.
Do you have any good reasons to make changes to this file? If not I would recommend you to drop them and open a new PR with these changes instead.
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.
I think it is better to override the functionality of localIP()
instead of writing a new one. I think you had a good Idea to specify in the function signature the timeout, so I would keep it, but with the addition of making it default to _timeout
value. Could you also modify the comment above accordingly?
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.
As described in WiFi.h
file I would integrate these changes in localIP()
function.
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.
Hi @MYusufY, thanks for your contribution! Your work is very much appreciated! I am suggesting you some changes in order for your PR to properly address some issues we are facing.
I would also change the PR name, since we are changing the behavior from an attempt based approach to a timeout based one. The function is still blocking, but now the user may set the timeout to 0 to make it non blocking and deal with the logic of retrial on his own. |
Thanks for your interest! I will try to make these changes and create a new PR soon. Also, i think i accidentaly edited that file :) (the one i put a space below) |
Don't worry, I can guide you through this and fix this PR, you don't need to open a new one for this feature. The usual method to contribute on github is to create a branch on your personal fork of the repo you are contributing to. That way you can always go back to the public repo status with |
This PR introduces a non-blocking version of the localIP function, named localIPNonBlocking, to the WiFi.cpp file. The new function addresses situations where the current localIP implementation, which uses a blocking delay(100) call, can cause issues such as triggering a watchdog timer (WDT).
This PR also solves:
New Function:
localIPNonBlocking
Added to libraries/WiFiS3/src/WiFi.cpp at line 357 (after the existing localIP implementation).
Utilizes a timeout mechanism with millis() to avoid blocking delays.
Returns the device's local IP address or a default address (0.0.0.0) if the timeout expires.
Example Usage: