Skip to content

[UNO R4 WIFI][WifiS3] Non blocking option for Wifi.begin #337

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

Closed
LatchT opened this issue Jun 11, 2024 · 0 comments · Fixed by #339
Closed

[UNO R4 WIFI][WifiS3] Non blocking option for Wifi.begin #337

LatchT opened this issue Jun 11, 2024 · 0 comments · Fixed by #339
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@LatchT
Copy link

LatchT commented Jun 11, 2024

Hello,

The timeout in use when calling Wifi.begin is hardcoded and set to 10000 ms (see code below).
That makes it difficult to handle reconnection is some cases, because loop execution will be locked for 10s if no WiFi is available.

// ArduinoCore-renesas/libraries/WiFiS3/src/WiFi.cpp

/* -------------------------------------------------------------------------- */
int CWifi::begin(const char* ssid, const char *passphrase) {
/* -------------------------------------------------------------------------- */
 ...

   unsigned long start_time = millis();
   while(millis() - start_time < 10000){
      if(status() == WL_CONNECTED) {
         return WL_CONNECTED;
      } 
   }
  return WL_CONNECT_FAILED;
}

User should be able to set his own timeout value.

So Is there any way to perform a non-blocking reconnection ? If not, is it possible to update the interface to something like this?:

int CWifi::begin(const char* ssid, const char *passphrase, unsigned int timeout = 10000)
@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself labels Jun 12, 2024
@per1234 per1234 added the conclusion: resolved Issue was resolved label Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants