Browse Source

Do not scan networks if just one network defined

fastled
Xose Pérez 7 years ago
parent
commit
dc5c7020cc
1 changed files with 8 additions and 2 deletions
  1. +8
    -2
      code/espurna/wifi.ino

+ 8
- 2
code/espurna/wifi.ino View File

@ -49,12 +49,14 @@ bool createAP() {
} }
void wifiConfigure() { void wifiConfigure() {
jw.scanNetworks(true);
jw.setHostname(getSetting("hostname", HOSTNAME).c_str()); jw.setHostname(getSetting("hostname", HOSTNAME).c_str());
jw.setSoftAP(getSetting("hostname", HOSTNAME).c_str(), getSetting("adminPass", ADMIN_PASS).c_str(), AP_MODE_IP, AP_MODE_GW, AP_MODE_MASK); jw.setSoftAP(getSetting("hostname", HOSTNAME).c_str(), getSetting("adminPass", ADMIN_PASS).c_str(), AP_MODE_IP, AP_MODE_GW, AP_MODE_MASK);
jw.setAPMode(AP_MODE); jw.setAPMode(AP_MODE);
jw.cleanNetworks(); jw.cleanNetworks();
for (int i = 0; i< WIFI_MAX_NETWORKS; i++) {
int i;
for (i = 0; i< WIFI_MAX_NETWORKS; i++) {
if (getSetting("ssid" + String(i)).length() == 0) break; if (getSetting("ssid" + String(i)).length() == 0) break;
if (getSetting("ip" + String(i)).length() == 0) { if (getSetting("ip" + String(i)).length() == 0) {
jw.addNetwork( jw.addNetwork(
@ -72,6 +74,10 @@ void wifiConfigure() {
); );
} }
} }
// Scan for best network only if we have more than 1 defined
jw.scanNetworks(i>1);
} }
void wifiSetup() { void wifiSetup() {


Loading…
Cancel
Save