Skip to content

Conversation

@KrazyKerbalnaut
Copy link

@KrazyKerbalnaut KrazyKerbalnaut commented Jan 7, 2021

This is not completely non-blocking. Please review the delay of 100ms after setting passphrase or key of the normal "begin()" method. To resolution is a little un-optimized at the moment but I needed to to work for now:

WiFi.cpp:

int WiFiClass::setCredNB(const char* ssid, const char *passphrase)
{
  uint8_t status = WL_CONNECT_FAILED;
  startConnection = millis();
  delayStartConnection = millis();

  if (WiFiDrv::wifiSetPassphrase(ssid, strlen(ssid), passphrase, strlen(passphrase))!= WL_FAILURE) {
    status = WiFiDrv::getConnectionStatus();
  }

  return status;
}

int WiFiClass::beginNB()
{
  uint8_t status = WL_CONNECT_FAILED;

  if ((millis() - startConnection) < _timeout) {
    if ((millis() - delayStartConnection) > WL_DELAY_START_CONNECTION) {
      status = WiFiDrv::getConnectionStatus();
      delayStartConnection = millis();
    }
  }

  return status;
}

WiFi.h, add to public section:

unsigned long startConnection;
unsigned long delayStartConnection;

int setCredNB(const char* ssid, const char* passphrase);
int beginNB();

@KrazyKerbalnaut KrazyKerbalnaut marked this pull request as ready for review January 7, 2021 16:53
@CLAassistant
Copy link

CLAassistant commented Apr 9, 2021

CLA assistant check
All committers have signed the CLA.

@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: code Related to content of the project itself type: enhancement Proposed improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants