Status checking for mobile
This commit is contained in:
39
mobile.html
39
mobile.html
@@ -122,13 +122,6 @@ line-height:140%;
|
||||
})
|
||||
}
|
||||
|
||||
function updateStatus() {
|
||||
if (avgWindValid == 1 && windValid == 1) {
|
||||
document.getElementById("status").style.backgroundColor = '#00AA00';
|
||||
document.getElementById("status").innerHTML = "OK";
|
||||
}
|
||||
}
|
||||
|
||||
function updateWind() {
|
||||
document.getElementById("windSpeed").innerHTML = zeroFilledDir + "/" + instantWindSpeed;
|
||||
}
|
||||
@@ -137,6 +130,7 @@ line-height:140%;
|
||||
updateWindDirection(avgWindDir);
|
||||
document.getElementById("avgWindSpeed").innerHTML = avgWindDir + "/" + avgWindSpeed;
|
||||
document.getElementById("avgWindGust").innerHTML = avgWindGustDir + "/" + avgWindGustSpeed;
|
||||
windAvgValid = 1;
|
||||
}
|
||||
|
||||
function invalidateDisplay() {
|
||||
@@ -318,6 +312,34 @@ line-height:140%;
|
||||
function updateWindDirection(degrees) {
|
||||
windDirection = degrees % 360;
|
||||
drawCompass();
|
||||
}
|
||||
|
||||
function statusLoop() {
|
||||
|
||||
var dt = new Date();
|
||||
secs = (dt.getTime() - lastWind)/1000;
|
||||
|
||||
if (secs > 10 && windValid == 1) {
|
||||
invalidateWind();
|
||||
console.log("Invalidating instant wind due to late message")
|
||||
document.getElementById("status").innerHTML = "Missing Wind message";
|
||||
document.getElementById("status").style.backgroundColor = '#AA0000';
|
||||
}
|
||||
|
||||
secs = (dt.getTime() - lastAvgWind)/1000;
|
||||
|
||||
if (secs > 150 && windAvgValid == 1) {
|
||||
invalidateAvgWind();
|
||||
console.log("Invalidating average wind due to late message")
|
||||
document.getElementById("status").innerHTML = "Missing avg Wind message";
|
||||
document.getElementById("status").style.backgroundColor = '#AA0000';
|
||||
}
|
||||
|
||||
if (avgWindValid == 1 && windValid == 1) {
|
||||
document.getElementById("status").style.backgroundColor = '#00AA00';
|
||||
document.getElementById("status").innerHTML = "OK";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -377,9 +399,10 @@ invalidateDisplay();
|
||||
MQTTconnect();
|
||||
getPressure();
|
||||
getInitialArchive();
|
||||
|
||||
drawCompass();
|
||||
|
||||
setInterval(statusLoop, 5000);
|
||||
setInterval(getPressure, 600000);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user