-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Description
Basic Infos
Hardware
Hardware: NodeMCU 1.0 Amica ESP-12E
Core Version: 2.3.0 github latest edited
IDE Arduino: 1.6.9 edited
Description
The nearest AP at my workplace (2 metres away) doesn't broadcast its SSID (checked by WiFiScan example sketch) but the NodeMCU connects perfectly well with a simple WiFi.begin("WorkAP1","passphrase0")
(tested on NTPClient example sketch).
When I added it to a test sketch (see also #2117, 2115) by addAP
, no connection occurs, no errors either. The AP is simply "not there" as far as WiFiMulti is concerned, even though I told it that it exists.
The problem seems to be that it is looping through the visible (by scan) networks to see if they are in the addAP'ed list and, among those which are, to pick the strongest. It should probably be looping through the addAP'ed APs to get their strengths and connect to the strongest one. I don't know how to acheive this for "hidden" SSIDs though.
NOTE: Work environment is densly populated with APs (16 APs at -74..-93dB) but I don't believe this is an issue.
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("WorkAP1", "passphrase0"); // Work *fibre* gateway router no. 1
wifiMulti.addAP("Stevebox", "passphrase1"); // my home ADSL gateway router
wifiMulti.addAP("AndroidAP", "passphrase2"); // my android phone
wifiMulti.addAP("SteveAP", "passphrase3"); // my secondary home 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
scandone
f r0, scandone
>>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
f r0, scandone
>>WiFi not connected! run returned: 1
...etc. etc. etc.