mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-06 19:47:02 +03:00
fix AP scan
This commit is contained in:
@@ -643,16 +643,19 @@ function rssiToIcon(rssi){
|
||||
|
||||
function refreshAP(force){
|
||||
if (!enableAPTimer && !force) return;
|
||||
$.getJSON( "/ap.json", function( data ) {
|
||||
if(data.length > 0){
|
||||
//sort by signal strength
|
||||
data.sort(function (a, b) {
|
||||
var x = a["rssi"]; var y = b["rssi"];
|
||||
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
|
||||
});
|
||||
apList = data;
|
||||
refreshAPHTML(apList);
|
||||
}
|
||||
$.getJSON( "/scan.json", async function( data ) {
|
||||
await sleep(2000);
|
||||
$.getJSON( "/ap.json", function( data ) {
|
||||
if(data.length > 0){
|
||||
//sort by signal strength
|
||||
data.sort(function (a, b) {
|
||||
var x = a["rssi"]; var y = b["rssi"];
|
||||
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
|
||||
});
|
||||
apList = data;
|
||||
refreshAPHTML(apList);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -975,3 +978,7 @@ function showMessage(message, severity, age=0) {
|
||||
function inRange(x, min, max) {
|
||||
return ((x-min)*(x-max) <= 0);
|
||||
}
|
||||
|
||||
function sleep(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user