Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve WiFi scan result display #10253

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions tasmota/language/bg_BG.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,6 @@
#define D_DUPLICATE_ACCESSPOINT "Дублиране на точката за достъп (AP)"
#define D_SKIPPING_LOW_QUALITY "Пропускане поради лошо качество"
#define D_RSSI "RSSI"
#define D_WEP "WEP"
#define D_WPA_PSK "WPA PSK"
#define D_WPA2_PSK "WPA2 PSK"
#define D_AP1_SSID "AP1 SSId"
#define D_AP1_PASSWORD "AP1 Парола"
#define D_AP2_SSID "AP2 SSId"
Expand Down
3 changes: 0 additions & 3 deletions tasmota/language/cs_CZ.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,6 @@
#define D_DUPLICATE_ACCESSPOINT "Kopie AP"
#define D_SKIPPING_LOW_QUALITY "Přeskočení z důvodu kvality signálu"
#define D_RSSI "RSSI"
#define D_WEP "WEP"
#define D_WPA_PSK "WPA PSK"
#define D_WPA2_PSK "WPA2 PSK"
#define D_AP1_SSID "AP1 SSID"
#define D_AP1_PASSWORD "Heslo AP1"
#define D_AP2_SSID "AP2 SSID"
Expand Down
3 changes: 0 additions & 3 deletions tasmota/language/de_DE.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,6 @@
#define D_DUPLICATE_ACCESSPOINT "AccessPoint duplizieren"
#define D_SKIPPING_LOW_QUALITY "überspringe wegen niedriger Qualität"
#define D_RSSI "RSSI"
#define D_WEP "WEP"
#define D_WPA_PSK "WPA-PSK"
#define D_WPA2_PSK "WPA2-PSK"
#define D_AP1_SSID "WLAN 1 - SSID"
#define D_AP1_PASSWORD "WLAN 1 - Passwort"
#define D_AP2_SSID "WLAN 2 - SSID"
Expand Down
3 changes: 0 additions & 3 deletions tasmota/language/el_GR.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,6 @@
#define D_DUPLICATE_ACCESSPOINT "Διπλότυπο AccessPoint"
#define D_SKIPPING_LOW_QUALITY "Παράκαμψη λόγω χαμηλής ποιότητας"
#define D_RSSI "RSSI"
#define D_WEP "WEP"
#define D_WPA_PSK "WPA PSK"
#define D_WPA2_PSK "WPA2 PSK"
#define D_AP1_SSID "AP1 SSId"
#define D_AP1_PASSWORD "AP1 Κωδικός"
#define D_AP2_SSID "AP2 SSId"
Expand Down
3 changes: 0 additions & 3 deletions tasmota/language/en_GB.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,6 @@
#define D_DUPLICATE_ACCESSPOINT "Duplicate AccessPoint"
#define D_SKIPPING_LOW_QUALITY "Skipping due to low quality"
#define D_RSSI "RSSI"
#define D_WEP "WEP"
#define D_WPA_PSK "WPA PSK"
#define D_WPA2_PSK "WPA2 PSK"
#define D_AP1_SSID "AP1 SSId"
#define D_AP1_PASSWORD "AP1 Password"
#define D_AP2_SSID "AP2 SSId"
Expand Down
3 changes: 0 additions & 3 deletions tasmota/language/es_ES.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,6 @@
#define D_DUPLICATE_ACCESSPOINT "AccessPoint duplicado"
#define D_SKIPPING_LOW_QUALITY "Ignorado por baja calidad"
#define D_RSSI "RSSI"
#define D_WEP "WEP"
#define D_WPA_PSK "WPA PSK"
#define D_WPA2_PSK "WPA2 PSK"
#define D_AP1_SSID "SSId AP1"
#define D_AP1_PASSWORD "Clave AP1"
#define D_AP2_SSID "SSId AP2"
Expand Down
3 changes: 0 additions & 3 deletions tasmota/language/fr_FR.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,6 @@
#define D_DUPLICATE_ACCESSPOINT "Point d'Accès dupliqué"
#define D_SKIPPING_LOW_QUALITY "Évité car de mauvaise qualité"
#define D_RSSI "RSSI"
#define D_WEP "WEP"
#define D_WPA_PSK "WPA PSK"
#define D_WPA2_PSK "WPA2 PSK"
#define D_AP1_SSID "AP1 SSID"
#define D_AP1_PASSWORD "Mot de passe AP1"
#define D_AP2_SSID "AP2 SSId"
Expand Down
3 changes: 0 additions & 3 deletions tasmota/language/he_HE.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,6 @@
#define D_DUPLICATE_ACCESSPOINT "נקודות גישה משוכפלות"
#define D_SKIPPING_LOW_QUALITY "מדלג עקב איכות רשת נמוכה"
#define D_RSSI "RSSI"
#define D_WEP "WEP"
#define D_WPA_PSK "WPA PSK"
#define D_WPA2_PSK "WPA2 PSK"
#define D_AP1_SSID "AP1 SSId"
#define D_AP1_PASSWORD "AP1 Password"
#define D_AP2_SSID "AP2 SSId"
Expand Down
3 changes: 0 additions & 3 deletions tasmota/language/hu_HU.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,6 @@
#define D_DUPLICATE_ACCESSPOINT "Duplikált access point"
#define D_SKIPPING_LOW_QUALITY "Rossz, alacsony jelminőség"
#define D_RSSI "RSSI"
#define D_WEP "WEP"
#define D_WPA_PSK "WPA PSK"
#define D_WPA2_PSK "WPA2 PSK"
#define D_AP1_SSID "AP1 SSID"
#define D_AP1_PASSWORD "AP1 megosztott kulcs"
#define D_AP2_SSID "AP2 SSID"
Expand Down
3 changes: 0 additions & 3 deletions tasmota/language/it_IT.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,6 @@
#define D_DUPLICATE_ACCESSPOINT "Access Point duplicato"
#define D_SKIPPING_LOW_QUALITY "Ignorato a causa di bassa qualità"
#define D_RSSI "RSSI"
#define D_WEP "WEP"
#define D_WPA_PSK "WPA PSK"
#define D_WPA2_PSK "WPA2 PSK"
#define D_AP1_SSID "AP1 - SSID"
#define D_AP1_PASSWORD "AP1 - Password"
#define D_AP2_SSID "AP2 - SSID"
Expand Down
3 changes: 0 additions & 3 deletions tasmota/language/ko_KO.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,6 @@
#define D_DUPLICATE_ACCESSPOINT "중복된 AccessPoint"
#define D_SKIPPING_LOW_QUALITY "약한 네트워크 신호 무시"
#define D_RSSI "RSSI"
#define D_WEP "WEP"
#define D_WPA_PSK "WPA PSK"
#define D_WPA2_PSK "WPA2 PSK"
#define D_AP1_SSID "AP1 SSId"
#define D_AP1_PASSWORD "AP1 비밀번호"
#define D_AP2_SSID "AP2 SSId"
Expand Down
3 changes: 0 additions & 3 deletions tasmota/language/nl_NL.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,6 @@
#define D_DUPLICATE_ACCESSPOINT "Dubbel AccessPoint"
#define D_SKIPPING_LOW_QUALITY "Overslaan agv lage ontvangskwaliteit"
#define D_RSSI "RSSI"
#define D_WEP "WEP"
#define D_WPA_PSK "WPA PSK"
#define D_WPA2_PSK "WPA2 PSK"
#define D_AP1_SSID "AP1 SSId"
#define D_AP1_PASSWORD "AP1 Wachtwoord"
#define D_AP2_SSID "AP2 SSId"
Expand Down
3 changes: 0 additions & 3 deletions tasmota/language/pl_PL.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,6 @@
#define D_DUPLICATE_ACCESSPOINT "Duplikuj"
#define D_SKIPPING_LOW_QUALITY "Pominięto z powodu niskiej jakości sygnału"
#define D_RSSI "RSSI"
#define D_WEP "WEP"
#define D_WPA_PSK "WPA PSK"
#define D_WPA2_PSK "WPA2 PSK"
#define D_AP1_SSID "Nazwa 1"
#define D_AP1_PASSWORD "Hasło 1"
#define D_AP2_SSID "Nazwa 2"
Expand Down
3 changes: 0 additions & 3 deletions tasmota/language/pt_BR.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,6 @@
#define D_DUPLICATE_ACCESSPOINT "Ponto de Acesso duplicado"
#define D_SKIPPING_LOW_QUALITY "Ignorado devido à baixa qualidade do sinal"
#define D_RSSI "RSSI"
#define D_WEP "WEP"
#define D_WPA_PSK "WPA PSK"
#define D_WPA2_PSK "WPA2 PSK"
#define D_AP1_SSID "AP1 SSId"
#define D_AP1_PASSWORD "Senha AP1"
#define D_AP2_SSID "AP2 SSId"
Expand Down
3 changes: 0 additions & 3 deletions tasmota/language/pt_PT.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,6 @@
#define D_DUPLICATE_ACCESSPOINT "Duplicar ponto de Acesso"
#define D_SKIPPING_LOW_QUALITY "Ignorado devido a baixa qualidade do sinal"
#define D_RSSI "RSSI"
#define D_WEP "WEP"
#define D_WPA_PSK "WPA PSK"
#define D_WPA2_PSK "WPA2 PSK"
#define D_AP1_SSID "SSId do AP1"
#define D_AP1_PASSWORD "Palavra Chave do AP1"
#define D_AP2_SSID "SSId do AP2"
Expand Down
3 changes: 0 additions & 3 deletions tasmota/language/ro_RO.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,6 @@
#define D_DUPLICATE_ACCESSPOINT "Clonează AccessPoint"
#define D_SKIPPING_LOW_QUALITY "Omite,joasă calitate"
#define D_RSSI "RSSI"
#define D_WEP "WEP"
#define D_WPA_PSK "WPA PSK"
#define D_WPA2_PSK "WPA2 PSK"
#define D_AP1_SSID "AP1 SSId"
#define D_AP1_PASSWORD "Parolă AP1"
#define D_AP2_SSID "AP2 SSId"
Expand Down
3 changes: 0 additions & 3 deletions tasmota/language/ru_RU.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,6 @@
#define D_DUPLICATE_ACCESSPOINT "Дублировать Точку Доступа (AP)"
#define D_SKIPPING_LOW_QUALITY "Пропущено из-за низкого качества"
#define D_RSSI "RSSI"
#define D_WEP "WEP"
#define D_WPA_PSK "WPA PSK"
#define D_WPA2_PSK "WPA2 PSK"
#define D_AP1_SSID "AP1 SSId"
#define D_AP1_PASSWORD "AP1 Пароль"
#define D_AP2_SSID "AP2 SSId"
Expand Down
3 changes: 0 additions & 3 deletions tasmota/language/sk_SK.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,6 @@
#define D_DUPLICATE_ACCESSPOINT "Kópia AP"
#define D_SKIPPING_LOW_QUALITY "Preskočenie z dôvodu kvality signálu"
#define D_RSSI "RSSI"
#define D_WEP "WEP"
#define D_WPA_PSK "WPA PSK"
#define D_WPA2_PSK "WPA2 PSK"
#define D_AP1_SSID "AP1 SSID"
#define D_AP1_PASSWORD "Heslo AP1"
#define D_AP2_SSID "AP2 SSID"
Expand Down
3 changes: 0 additions & 3 deletions tasmota/language/sv_SE.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,6 @@
#define D_DUPLICATE_ACCESSPOINT "Dubblett accesspunkt"
#define D_SKIPPING_LOW_QUALITY "Hoppa över pga dålig kvalitet"
#define D_RSSI "RSSI"
#define D_WEP "WEP"
#define D_WPA_PSK "WPA PSK"
#define D_WPA2_PSK "WPA2 PSK"
#define D_AP1_SSID "AP1 SSId"
#define D_AP1_PASSWORD "AP1 lösenord"
#define D_AP2_SSID "AP2 SSId"
Expand Down
3 changes: 0 additions & 3 deletions tasmota/language/tr_TR.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,6 @@
#define D_DUPLICATE_ACCESSPOINT "AP'yi çoğalt"
#define D_SKIPPING_LOW_QUALITY "Düşük kalitedekileri dikkate alma"
#define D_RSSI "RSSI"
#define D_WEP "WEP"
#define D_WPA_PSK "WPA PSK"
#define D_WPA2_PSK "WPA2 PSK"
#define D_AP1_SSID "AP1 Adı (SSId)"
#define D_AP1_PASSWORD "AP1 Parolası"
#define D_AP2_SSID "AP2 SSId"
Expand Down
3 changes: 0 additions & 3 deletions tasmota/language/uk_UA.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,6 @@
#define D_DUPLICATE_ACCESSPOINT "Дублювати Точку Доступу (AP)"
#define D_SKIPPING_LOW_QUALITY "Пропущено через низьку якість"
#define D_RSSI "RSSI"
#define D_WEP "WEP"
#define D_WPA_PSK "WPA PSK"
#define D_WPA2_PSK "WPA2 PSK"
#define D_AP1_SSID "AP1 SSID"
#define D_AP1_PASSWORD "AP1 гасло"
#define D_AP2_SSID "AP2 SSID"
Expand Down
3 changes: 0 additions & 3 deletions tasmota/language/vi_VN.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,6 @@
#define D_DUPLICATE_ACCESSPOINT "Điểm truy cập trùng lặp"
#define D_SKIPPING_LOW_QUALITY "Bỏ qua do tín hiệu kém"
#define D_RSSI "RSSI"
#define D_WEP "WEP"
#define D_WPA_PSK "WPA PSK"
#define D_WPA2_PSK "WPA2 PSK"
#define D_AP1_SSID "Tên mạng wifi 1"
#define D_AP1_PASSWORD "Mật khẩu mạng wifi 1"
#define D_AP2_SSID "Tên mạng wifi 2"
Expand Down
3 changes: 0 additions & 3 deletions tasmota/language/zh_CN.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,6 @@
#define D_DUPLICATE_ACCESSPOINT "重复AP"
#define D_SKIPPING_LOW_QUALITY "忽略弱信号网络"
#define D_RSSI "RSSI"
#define D_WEP "WEP"
#define D_WPA_PSK "WPA PSK"
#define D_WPA2_PSK "WPA2 PSK"
#define D_AP1_SSID "AP1 名称"
#define D_AP1_PASSWORD "AP1 密码"
#define D_AP2_SSID "AP2 名称"
Expand Down
3 changes: 0 additions & 3 deletions tasmota/language/zh_TW.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,6 @@
#define D_DUPLICATE_ACCESSPOINT "重覆的存取點"
#define D_SKIPPING_LOW_QUALITY "正在忽略訊號品質不佳的訊號"
#define D_RSSI "RSSI"
#define D_WEP "WEP"
#define D_WPA_PSK "WPA PSK"
#define D_WPA2_PSK "WPA2 PSK"
#define D_AP1_SSID "存取點1 SSID"
#define D_AP1_PASSWORD "存取點1 密碼"
#define D_AP2_SSID "存取點2 SSID"
Expand Down
55 changes: 26 additions & 29 deletions tasmota/xdrv_01_webserver.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2067,9 +2067,6 @@ String HtmlEscape(const String unescaped) {
return result;
}

// Indexed by enum wl_enc_type in file wl_definitions.h starting from -1
const char kEncryptionType[] PROGMEM = "|||" D_WPA_PSK "||" D_WPA2_PSK "|" D_WEP "||" D_NONE "|" D_AUTO;

void HandleWifiConfiguration(void)
{
if (!HttpCheckPriviledgedAccess(!WifiIsInManagerMode())) { return; }
Expand Down Expand Up @@ -2114,36 +2111,36 @@ void HandleWifiConfiguration(void)
}
}

// remove duplicates ( must be RSSI sorted )
String cssid;
for (uint32_t i = 0; i < n; i++) {
if (-1 == indices[i]) { continue; }
cssid = WiFi.SSID(indices[i]);
uint32_t cschn = WiFi.channel(indices[i]);
for (uint32_t j = i + 1; j < n; j++) {
if ((cssid == WiFi.SSID(indices[j])) && (cschn == WiFi.channel(indices[j]))) {
DEBUG_CORE_LOG(PSTR(D_LOG_WIFI D_DUPLICATE_ACCESSPOINT " %s"), WiFi.SSID(indices[j]).c_str());
indices[j] = -1; // set dup aps to index -1
}
}
}

//display networks in page
for (uint32_t i = 0; i < n; i++) {
if (-1 == indices[i]) { continue; } // skip dups
uint32_t i = 0;
while (i < n) {
int32_t rssi = WiFi.RSSI(indices[i]);
String ssid = WiFi.SSID(indices[i]);
DEBUG_CORE_LOG(PSTR(D_LOG_WIFI D_SSID " %s, " D_BSSID " %s, " D_CHANNEL " %d, " D_RSSI " %d"),
WiFi.SSID(indices[i]).c_str(), WiFi.BSSIDstr(indices[i]).c_str(), WiFi.channel(indices[i]), rssi);
int quality = WifiGetRssiAsQuality(rssi);
int auth = WiFi.encryptionType(indices[i]);
char encryption[20];
WSContentSend_P(PSTR("<div><a href='#p' onclick='c(this)'>%s</a>&nbsp;(%d)&nbsp<span class='q'>%s %d%% (%d dBm)</span></div>"),
HtmlEscape(WiFi.SSID(indices[i])).c_str(),
WiFi.channel(indices[i]),
GetTextIndexed(encryption, sizeof(encryption), auth +1, kEncryptionType),
quality, rssi
ssid.c_str(), WiFi.BSSIDstr(indices[i]).c_str(), WiFi.channel(indices[i]), rssi);

// Print SSID
WSContentSend_P(PSTR("<div><a href='#p' onclick='c(this)'>%s</a><br><ul>"),
HtmlEscape(ssid).c_str()
);
delay(0);

int j = 0;
String nextSSID = "";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can save code with
String nextSSID;

You don't need to give it a value, is it still initialized.

// Handle all APs with the same SSID
while((i+j) < n && (nextSSID = WiFi.SSID(indices[i+j])) == ssid) {
// Update RSSI / quality
rssi = WiFi.RSSI(indices[i+j]);
// Print item
WSContentSend_P(PSTR("<li title='%d dBm'>%s, CH %d, Quality %d%%</li>"),
rssi, WiFi.BSSIDstr(indices[i+j]).c_str(),
WiFi.channel(indices[i+j]), WifiGetRssiAsQuality(rssi)
);
j++;
}
// Skip all the duplicates
i += j;

WSContentSend_P(PSTR("</ul></div>"));

}
WSContentSend_P(PSTR("<br>"));
Expand Down