mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-04 02:48:13 +10:00
added setter for removing duplicate APs
This commit is contained in:
+8
-4
@@ -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
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user