mirror of
https://github.com/lumapu/ahoy.git
synced 2025-07-04 18:17:16 +02:00
added wifi scan to setup
fixed issues on index.html
This commit is contained in:
parent
8b8deded9a
commit
dbbfe25a44
10 changed files with 91 additions and 17 deletions
|
@ -36,6 +36,10 @@
|
|||
<fieldset>
|
||||
<legend class="des">WiFi</legend>
|
||||
<p>Enter the credentials to your prefered WiFi station. After rebooting the device tries to connect with this information.</p>
|
||||
<label for="networks">Avail Networks</label>
|
||||
<select name="networks" id="networks" onChange="selNet()">
|
||||
<option value="-1">scanning ...</option>
|
||||
</select>
|
||||
<label for="ssid">SSID</label>
|
||||
<input type="text" name="ssid" class="text"/>
|
||||
<label for="pwd">Password</label>
|
||||
|
@ -377,12 +381,35 @@
|
|||
parseRadio(root["radio"]);
|
||||
parseSerial(root["serial"]);
|
||||
}
|
||||
getAjax('/api/setup/networks', listNetworks);
|
||||
window.setInterval("getAjax('/api/setup/networks', listNetworks)", 7000);
|
||||
}
|
||||
|
||||
function listNetworks(root) {
|
||||
if(root["networks"].length > 0) {
|
||||
var s = document.getElementById("networks");
|
||||
var i, l = s.options.length - 1;
|
||||
for(i = l; i >= 0; i--) {
|
||||
s.remove(i);
|
||||
}
|
||||
|
||||
for(i = 0; i < root["networks"].length; i++) {
|
||||
s.appendChild(opt(root["networks"][i]["ssid"], root["networks"][i]["ssid"] + " (" + root["networks"][i]["rssi"] + " dBm)"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function selNet() {
|
||||
var s = document.getElementById("networks");
|
||||
var e = document.getElementsByName("ssid")[0];
|
||||
e.value = s.value;
|
||||
}
|
||||
|
||||
hiddenInput = document.getElementById("disclaimer")
|
||||
hiddenInput.value = sessionStorage.getItem("gDisclaimer");
|
||||
|
||||
getAjax("/api/setup", parse);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue