-->
Page 2 of 2

Re: ESP8266 connection time to access point is too long

PostPosted: Fri Mar 23, 2018 2:11 pm
by sej7278
hmm, yes there has to be something better than doing a network scan.

static ip speeds things up a bit, but i suspect most of the time is finding the ap

Re: ESP8266 connection time to access point is too long

PostPosted: Sat Mar 24, 2018 3:25 am
by john564
I agree, there got to be a better way. As far as I know Android as well as iOS don't use static IPs for their access points, so I guess I cannot use this trick in my application to speed things up

Re: ESP8266 connection time to access point is too long

PostPosted: Sat Mar 24, 2018 7:38 am
by sej7278
I tried wifi multi, but because you have to use delay() to give it some time to connect, i never managed to get it under 4 seconds, most of the time it was 5, and that doesn't even include actually getting an IP etc; just authenticating with the AP.

Code: Select all#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>

ESP8266WiFiMulti wifiMulti;

void setup()
{
    Serial.begin(115200);

    WiFi.mode(WIFI_STA);
    wifiMulti.addAP("AP_ONE", "password1");
    wifiMulti.addAP("AP_TWO", "password2");

    unsigned long start_time = millis();

    while (wifiMulti.run() != WL_CONNECTED)
    {
        delay(50);
    }

    unsigned long end_time = millis();
    unsigned long elapsed_time = end_time - start_time;

    Serial.println();
    Serial.print("start: "); Serial.println(start_time);
    Serial.print("end: "); Serial.println(end_time);
    Serial.print("elapsed: "); Serial.println(elapsed_time);
    Serial.println();
    Serial.print("Connection status: "); Serial.println(WiFi.status());
    Serial.println();
    WiFi.printDiag(Serial);
}

void loop()
{
}


The problem is the return codes don't work, you only ever get a 3 or 6, i'm sure if 1 (WL_NO_SSID_AVAIL) worked it would be almost instant.

Re: ESP8266 connection time to access point is too long

PostPosted: Sat Mar 24, 2018 2:31 pm
by john564
That is really annoying, seems almost impossible to get the time any shorter for several APs. The fastest connection time seems to be WiFi.begin("ap", "pw") with slightly above 2s, but this is just for a single AP.