Description
Basic Infos
Hardware
Hardware: NodeMCU 1.0 Amica ESP-12E
Core Version: 2.2.0
IDE Arduino 1.6.8
Description
Either wifiMulti
or WiFi.printDiag
are setting or printing the wrong (but not random) value for passphrase on an open (unprotected) AP.
I added a series of 4 APs (see code) of which the last is an open AP. When connected to that AP (wifiMulti.run
) the WiFi.printDiag prints out the passphrase of the last previously-added AP instead of nothing/empty string. In the example below it printed "passphrase3", but after inverting the adding order, it always prints the passphrase of the preceding AP by order of addAP
.
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 <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
wifiMulti.addAP("FreeWifi"); // a neighbour's ADSL gateway router with public AP
// wifiMulti.addAP("FreeWifi",""); has the same effect
// wifiMulti.addAP("FreeWifi"," "); works (passphrase is printed as length 1)
}
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
scandone
f r0, scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
connected with FreeWifi, channel 2
dhcp client start...
cnt
ip:10.1.125.162,mask:255.248.0.0,gw:10.7.255.254
Mode: STA
PHY mode: N
Channel: 2
AP id: 0
Status: 5
Auto connect: 1
SSID (8): FreeWifi
Passphrase (11): passphrase3
BSSID set: 1
pm open,type:2 0
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.