Skip to content

wifiMulti - undesirable behaviour when "best" AP not connectable #2117

Open
@SteveToulouse

Description

@SteveToulouse

Basic Infos

Hardware

Hardware: NodeMCU 1.0 Amica ESP-12E
Core Version: 2.2.0
IDE Arduino: 1.6.8

Description

While testing how wifiMulti handles choice of AP I took the NodeMCU close to my secondary access point. The SSID of this AP was in the list added by addAP, but the passphrase had changed since uploading the sketch to the NodeMCU. Naturally, no connexion occurred (other devices were able to connect to the AP by using the correct passphrase).

However, I think it's unfortunate that wifiMulti.run refuses to quit trying to connect to this AP, despite the availability of other, working APs on it's list (by moving back closer to my primary AP, it connected fine). Maybe I didn't wait long enough (over 2 minutes) ?

This may be a design feature but I can't immediately figure why this might be desirable behaviour.

Secondary observation: highest strength, unprotected APs seem to be ignored if they aren't explicitly added by addAP. This too seems unfortunate.
EDIT: I can understand that an "open" AP could cause problems if it requires a further http dialogue to establish connectivity, but then it becomes the same case as an AP with a bad passphrase (or MAC filtering).

Settings in IDE

Module: NodeMCU 1.0 (ESP-12E Module)
Flash Size: 4M (3M SPIFFS)
CPU Frequency: 80Mhz
Flash Mode: n/a
Flash Frequency: 40Mhz
Upload Using: SERIAL
Reset Method: n/a

Sketch

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>

ESP8266WiFiMulti wifiMulti;

void setup() {
  Serial.begin(115200);
  delay(10);
  Serial.setDebugOutput(true);

  wifiMulti.addAP("Stevebox", "passphrase1"); // my ADSL gateway router
  wifiMulti.addAP("AndroidAP", "passphrase2"); // my android phone
  wifiMulti.addAP("SteveAP", "passphrase3"); // my secondary wifi router, with bad passphrase
  wifiMulti.addAP("FreeWifi"); // a neighbour's ADSL gateway router with public AP
}

void loop() {
  Serial.println();
  if (int stat = wifiMulti.run() != WL_CONNECTED) {
    Serial.print("WiFi not connected! run returned: ");
    Serial.println(stat);
  }

  WiFi.printDiag(Serial);
  delay(5000);
}

Debug Messages

f r0, scandone
state: 0 -> 2 (b0)
state: 2 -> 0 (2)
reconnect
f 0, scandone
state: 0 -> 2 (b0)
state: 2 -> 0 (2)
reconnect
f -180, scandone
no SteveAP found, reconnect after 1s
WiFi not connected! run returned: 1
Mode: STA
PHY mode: N
Channel: 6
AP id: 0
Status: 3
Auto connect: 1
SSID (7): SteveAP
Passphrase (11): passphrase3
BSSID set: 1
reconnect
f r0, scandone
state: 0 -> 2 (b0)
state: 2 -> 0 (2)
reconnect
f 0, scandone
state: 0 -> 2 (b0)
state: 2 -> 0 (2)
reconnect
f -180, scandone
state: 0 -> 2 (b0)
state: 2 -> 0 (2)
reconnect
f r0, 
scandone
f r0, WiFi not connected! run returned: 1
Mode: STA
PHY mode: N
Channel: 1
AP id: 0
Status: 0
Auto connect: 1
SSID (0): 
Passphrase (0): 
BSSID set: 0

...etc. etc. etc.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions