added setter for removing duplicate APs

This commit is contained in:
Alex T
2016-03-16 20:42:47 +02:00
parent 413b76cd81
commit f99156e29f
2 changed files with 11 additions and 6 deletions
+8 -4
View File
@@ -235,7 +235,7 @@ int WiFiManager::connectWifi(String ssid, String pass) {
ETS_UART_INTR_DISABLE();
wifi_station_disconnect();
ETS_UART_INTR_ENABLE();
WiFi.begin();
} else {
DEBUG_WM("No saved credentials");
@@ -390,7 +390,7 @@ void WiFiManager::handleWifi(boolean scan) {
DEBUG_WM(F("No networks found"));
page += F("No networks found. Refresh to scan again.");
} else {
//sort networks
int indices[n];
for (int i = 0; i < n; i++) {
@@ -417,7 +417,7 @@ void WiFiManager::handleWifi(boolean scan) {
});
// remove duplicates ( must be RSSI sorted )
if(_removeDupAps){
if(_removeDuplicateAPs){
String cssid;
for (int i = 0; i < n; i++) {
if(indices[i] == -1) continue;
@@ -427,7 +427,7 @@ void WiFiManager::handleWifi(boolean scan) {
DEBUG_WM("DUP AP: " + WiFi.SSID(indices[j]));
indices[j] = -1; // set dup aps to index -1
}
}
}
}
}
@@ -710,6 +710,10 @@ void WiFiManager::setCustomHeadElement(const char* element) {
_customHeadElement = element;
}
//if this is true, remove duplicated Access Points - defaut true
void WiFiManager::setRemoveDuplicateAPs(boolean removeDuplicates) {
_removeDuplicateAPs = removeDuplicates;
}
+3 -2
View File
@@ -110,7 +110,8 @@ class WiFiManager
//TODO
//if this is set, customise style
void setCustomHeadElement(const char* element);
//if this is true, remove duplicated Access Points - defaut true
void setRemoveDuplicateAPs(boolean removeDuplicates);
private:
std::unique_ptr<DNSServer> dnsServer;
@@ -141,7 +142,7 @@ class WiFiManager
int _paramsCount = 0;
int _minimumQuality = -1;
boolean _removeDupAps = true;
boolean _removeDuplicateAPs = true;
boolean _shouldBreakAfterConfig = false;
boolean _tryWPS = false;