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() {
|
function updateWind() {
|
||||||
document.getElementById("windSpeed").innerHTML = zeroFilledDir + "/" + instantWindSpeed;
|
document.getElementById("windSpeed").innerHTML = zeroFilledDir + "/" + instantWindSpeed;
|
||||||
}
|
}
|
||||||
@@ -137,6 +130,7 @@ line-height:140%;
|
|||||||
updateWindDirection(avgWindDir);
|
updateWindDirection(avgWindDir);
|
||||||
document.getElementById("avgWindSpeed").innerHTML = avgWindDir + "/" + avgWindSpeed;
|
document.getElementById("avgWindSpeed").innerHTML = avgWindDir + "/" + avgWindSpeed;
|
||||||
document.getElementById("avgWindGust").innerHTML = avgWindGustDir + "/" + avgWindGustSpeed;
|
document.getElementById("avgWindGust").innerHTML = avgWindGustDir + "/" + avgWindGustSpeed;
|
||||||
|
windAvgValid = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function invalidateDisplay() {
|
function invalidateDisplay() {
|
||||||
@@ -320,6 +314,34 @@ line-height:140%;
|
|||||||
drawCompass();
|
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>
|
</script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
@@ -377,9 +399,10 @@ invalidateDisplay();
|
|||||||
MQTTconnect();
|
MQTTconnect();
|
||||||
getPressure();
|
getPressure();
|
||||||
getInitialArchive();
|
getInitialArchive();
|
||||||
|
|
||||||
drawCompass();
|
drawCompass();
|
||||||
|
|
||||||
|
setInterval(statusLoop, 5000);
|
||||||
|
setInterval(getPressure, 600000);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user