fix scanning after clean flash, fixes #218

pull/236/head
Thorsten von Eicken 8 years ago
parent 2cc9fa1592
commit 5efbf32658
No known key found for this signature in database
GPG Key ID: C7F972A59D834B46
  1. 14
      html/wifi/wifiSta.js

@ -90,11 +90,15 @@ function scanAPs() {
scanTimeout = null; scanTimeout = null;
scanReqCnt = 0; scanReqCnt = 0;
ajaxReq('POST', "scan", function(data) { ajaxReq('POST', "scan", function(data) {
//showNotification("Wifi scan started"); showNotification("Wifi scan started");
window.setTimeout(scanResult, 1000); window.setTimeout(scanResult, 1000);
}, function(s, st) { }, function(s, st) {
//showNotification("Wifi scan may have started?"); if (s == 400) {
window.setTimeout(scanResult, 1000); showWarning("Cannot scan in AP mode");
$("#aps").innerHTML =
"Switch to <a href=\"#\" onclick=\"changeWifiMode(3)\">STA+AP mode</a> to scan.";
} else showWarning("Failed to scan: " + st);
//window.setTimeout(scanResult, 1000);
}); });
} }
@ -109,12 +113,10 @@ function getStatus() {
showNotification(txt); showNotification(txt);
showWifiInfo(data); showWifiInfo(data);
blockScan = 0; blockScan = 0;
if (data.modechange == "yes") { if (data.modechange == "yes") {
var txt2 = "esp-link will switch to STA-only mode in a few seconds"; var txt2 = "esp-link will switch to STA-only mode in a few seconds";
window.setTimeout(function() { showNotification(txt2); }, 4000); window.setTimeout(function() { showNotification(txt2); }, 4000);
} }
$("#reconnect").removeAttribute("hidden"); $("#reconnect").removeAttribute("hidden");
$("#reconnect").innerHTML = $("#reconnect").innerHTML =
"If you are in the same network, go to <a href=\"http://"+data.ip+ "If you are in the same network, go to <a href=\"http://"+data.ip+
@ -138,6 +140,8 @@ function changeWifiMode(m) {
showNotification("Mode changed"); showNotification("Mode changed");
window.setTimeout(getWifiInfo, 100); window.setTimeout(getWifiInfo, 100);
blockScan = 0; blockScan = 0;
window.setTimeout(scanAPs, 500);
$("#aps").innerHTML = 'Scanning... <div class="spinner spinner-small"></div>';
}, function(s, st) { }, function(s, st) {
showWarning("Error changing mode: " + st); showWarning("Error changing mode: " + st);
window.setTimeout(getWifiInfo, 100); window.setTimeout(getWifiInfo, 100);

Loading…
Cancel
Save