mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-11 14:07:00 +03:00
Avoid loading of status infos twice (#1711)
This commit is contained in:
@@ -80,41 +80,47 @@ function addZero(i) {
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
|
||||||
var d = new Date();
|
|
||||||
var h = addZero(d.getHours());
|
|
||||||
var m = addZero(d.getMinutes());
|
|
||||||
var s = addZero(d.getSeconds());
|
|
||||||
|
|
||||||
$('#img').html('<img src="/img_tmp/alg_roi.jpg" style="max-height:555px; display:block; margin-left:auto; margin-right:auto;"></img>');
|
function LoadData(){
|
||||||
$('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
|
|
||||||
loadStatus();
|
loadStatus();
|
||||||
loadCPUTemp();
|
loadCPUTemp();
|
||||||
loadRSSI();
|
loadRSSI();
|
||||||
loadUptime();
|
loadUptime();
|
||||||
loadRoundCounter();
|
loadRoundCounter();
|
||||||
refresh();
|
loadValue("value", "value");
|
||||||
});
|
loadValue("raw", "raw");
|
||||||
|
loadValue("prevalue", "prevalue");
|
||||||
|
loadValue("error", "error", "font-size:8px");
|
||||||
|
}
|
||||||
|
|
||||||
function refresh() {
|
|
||||||
|
function LoadROIImage(){
|
||||||
|
var d = new Date();
|
||||||
|
var h = addZero(d.getHours());
|
||||||
|
var m = addZero(d.getMinutes());
|
||||||
|
var s = addZero(d.getSeconds());
|
||||||
|
$('#img').html('<img src="/img_tmp/alg_roi.jpg" style="max-height:555px; display:block; margin-left:auto; margin-right:auto;"></img>');
|
||||||
|
$('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function Refresh() {
|
||||||
setTimeout (function() {
|
setTimeout (function() {
|
||||||
var time = new Date();
|
LoadData();
|
||||||
var timestamp = new Date().getTime();
|
|
||||||
var d = new Date();
|
var d = new Date();
|
||||||
|
var timestamp = d.getTime();
|
||||||
var h = addZero(d.getHours());
|
var h = addZero(d.getHours());
|
||||||
var m = addZero(d.getMinutes());
|
var m = addZero(d.getMinutes());
|
||||||
var s = addZero(d.getSeconds());
|
var s = addZero(d.getSeconds());
|
||||||
|
// reassign the url to be like alg_roi.jpg?timestamp=456784512 based on timestamp to ensure image is getting reloaded
|
||||||
// reassign the url to be like alg_roi.jpg?timestamp=456784512 based on timestamp
|
$('#img').html('<img src="/img_tmp/alg_roi.jpg?timestamp='+ timestamp +'" max-height:555px; display:block; margin-left:auto; margin-right:auto;"></img>');
|
||||||
$('#img').html('<img src="/img_tmp/alg_roi.jpg?timestamp='+ timestamp +'"max-height:555px; display:block; margin-left:auto; margin-right:auto;"></img>');
|
|
||||||
$('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
|
$('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
|
||||||
init();
|
|
||||||
refresh();
|
|
||||||
}, 300000);
|
|
||||||
|
|
||||||
|
Refresh();
|
||||||
|
}, 300000);
|
||||||
}
|
}
|
||||||
|
|
||||||
var basepath = "http://192.168.178.22";
|
|
||||||
|
|
||||||
function loadStatus() {
|
function loadStatus() {
|
||||||
url = basepath + '/statusflow';
|
url = basepath + '/statusflow';
|
||||||
@@ -129,6 +135,7 @@ function refresh() {
|
|||||||
xhttp.send();
|
xhttp.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function loadCPUTemp() {
|
function loadCPUTemp() {
|
||||||
url = basepath + '/cpu_temperature';
|
url = basepath + '/cpu_temperature';
|
||||||
var xhttp = new XMLHttpRequest();
|
var xhttp = new XMLHttpRequest();
|
||||||
@@ -142,6 +149,7 @@ function refresh() {
|
|||||||
xhttp.send();
|
xhttp.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function loadRSSI() {
|
function loadRSSI() {
|
||||||
url = basepath + '/rssi';
|
url = basepath + '/rssi';
|
||||||
var xhttp = new XMLHttpRequest();
|
var xhttp = new XMLHttpRequest();
|
||||||
@@ -155,6 +163,7 @@ function refresh() {
|
|||||||
xhttp.send();
|
xhttp.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function loadUptime() {
|
function loadUptime() {
|
||||||
url = basepath + '/uptime';
|
url = basepath + '/uptime';
|
||||||
var xhttp = new XMLHttpRequest();
|
var xhttp = new XMLHttpRequest();
|
||||||
@@ -168,6 +177,7 @@ function refresh() {
|
|||||||
xhttp.send();
|
xhttp.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function loadRoundCounter() {
|
function loadRoundCounter() {
|
||||||
url = basepath + '/info?type=Round';
|
url = basepath + '/info?type=Round';
|
||||||
var xhttp = new XMLHttpRequest();
|
var xhttp = new XMLHttpRequest();
|
||||||
@@ -181,6 +191,7 @@ function refresh() {
|
|||||||
xhttp.send();
|
xhttp.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function loadValue(_type, _div, _style) {
|
function loadValue(_type, _div, _style) {
|
||||||
url = basepath + '/value?all=true&type=' + _type;
|
url = basepath + '/value?all=true&type=' + _type;
|
||||||
var xhttp = new XMLHttpRequest();
|
var xhttp = new XMLHttpRequest();
|
||||||
@@ -221,19 +232,15 @@ function refresh() {
|
|||||||
xhttp.send();
|
xhttp.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function init(){
|
function init(){
|
||||||
basepath = getbasepath();
|
basepath = getbasepath();
|
||||||
loadValue("value", "value");
|
LoadData();
|
||||||
loadValue("raw", "raw");
|
LoadROIImage();
|
||||||
loadValue("prevalue", "prevalue");
|
Refresh();
|
||||||
loadValue("error", "error", "font-size:8px");
|
|
||||||
loadStatus();
|
|
||||||
loadCPUTemp();
|
|
||||||
loadRSSI();
|
|
||||||
loadUptime();
|
|
||||||
loadRoundCounter();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user