diff --git a/mobile.html b/mobile.html
index 11e3d55..37b4bcb 100644
--- a/mobile.html
+++ b/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() {
@@ -320,6 +314,34 @@ line-height:140%;
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";
+ }
+
+}
+
@@ -377,9 +399,10 @@ invalidateDisplay();
MQTTconnect();
getPressure();
getInitialArchive();
-
drawCompass();
+setInterval(statusLoop, 5000);
+setInterval(getPressure, 600000);