initial commit. basic structure. untested.
This commit is contained in:
65
data/js/scripts.js
Normal file
65
data/js/scripts.js
Normal file
@@ -0,0 +1,65 @@
|
||||
var _elapsedTime = 0;
|
||||
|
||||
function getParams() {
|
||||
aja()
|
||||
.url('/params')
|
||||
.on('success', function (data) {
|
||||
document.getElementById('Iim').value = data.Iim || -1;
|
||||
document.getElementById('Imp').value = data.Imp || -1;
|
||||
document.getElementById('Tu').value = data.Tu || -1;
|
||||
document.getElementById('Tl').value = data.Tl || -1;
|
||||
M.updateTextFields();
|
||||
})
|
||||
.go();
|
||||
}
|
||||
|
||||
function setParams() {
|
||||
aja()
|
||||
.method('post')
|
||||
.url('/params')
|
||||
.data({ Iim: document.getElementById('Iim').value, Imp: document.getElementById('Imp').value, Tu: document.getElementById('Tu').value, Tl: document.getElementById('Tl').value})
|
||||
.go();
|
||||
}
|
||||
|
||||
function joinNetwork() {
|
||||
aja()
|
||||
.method('post')
|
||||
.url('/setWiFi')
|
||||
.data({ ssid: document.getElementById('ssid').value, pass: document.getElementById('pass').value, ip: document.getElementById('ip').value, gateway: document.getElementById('gateway').value})
|
||||
.go();
|
||||
}
|
||||
|
||||
function scanNetworks() {
|
||||
aja()
|
||||
.url('/scanNetworks')
|
||||
.on('success', function (data) {
|
||||
var listHTML = "";
|
||||
data.forEach((network)=>{
|
||||
listHTML += '<tr><td>'+network.ssid+'</td><td>'+network.channel+'</td><td>'+network.rssi+'</td></tr>';
|
||||
});
|
||||
document.getElementById("networks").innerHTML = listHTML;
|
||||
})
|
||||
.go();
|
||||
}
|
||||
|
||||
setInterval(function () {
|
||||
aja()
|
||||
.url('/sensors')
|
||||
.on('success', function (data) {
|
||||
document.getElementById("tempinfo").value = data.temperature || -1;
|
||||
document.getElementById("humidityinfo").value = data.humidity || -1;
|
||||
document.getElementById("pressureinfo").value = data.pressure || -1;
|
||||
//document.getElementById("targetinfo").value = data.target.toFixed(2) || -1;
|
||||
_run = data.runProfile || 0;
|
||||
_elapsedTime = data.elapsedTime || 0;
|
||||
M.updateTextFields();
|
||||
})
|
||||
.go();
|
||||
}, 4000);
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
M.AutoInit();
|
||||
getParams();
|
||||
// var elems = document.querySelectorAll('.tooltipped');
|
||||
// var instances = M.Tooltip.init(elems, ttOptions);
|
||||
});
|
||||
Reference in New Issue
Block a user