diff --git a/sd-card/html/overview.html b/sd-card/html/overview.html index eb0e453a..e8eced61 100644 --- a/sd-card/html/overview.html +++ b/sd-card/html/overview.html @@ -80,41 +80,47 @@ function addZero(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(''); - $('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s)); + function LoadData(){ loadStatus(); loadCPUTemp(); loadRSSI(); loadUptime(); 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(''); + $('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s)); + } + + + function Refresh() { setTimeout (function() { - var time = new Date(); - var timestamp = new Date().getTime(); + LoadData(); + var d = new Date(); + var timestamp = d.getTime(); var h = addZero(d.getHours()); var m = addZero(d.getMinutes()); var s = addZero(d.getSeconds()); - - // reassign the url to be like alg_roi.jpg?timestamp=456784512 based on timestamp - $('#img').html(''); + // reassign the url to be like alg_roi.jpg?timestamp=456784512 based on timestamp to ensure image is getting reloaded + $('#img').html(''); $('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s)); - init(); - refresh(); - }, 300000); + Refresh(); + }, 300000); } - var basepath = "http://192.168.178.22"; function loadStatus() { url = basepath + '/statusflow'; @@ -129,6 +135,7 @@ function refresh() { xhttp.send(); } + function loadCPUTemp() { url = basepath + '/cpu_temperature'; var xhttp = new XMLHttpRequest(); @@ -142,6 +149,7 @@ function refresh() { xhttp.send(); } + function loadRSSI() { url = basepath + '/rssi'; var xhttp = new XMLHttpRequest(); @@ -155,6 +163,7 @@ function refresh() { xhttp.send(); } + function loadUptime() { url = basepath + '/uptime'; var xhttp = new XMLHttpRequest(); @@ -168,6 +177,7 @@ function refresh() { xhttp.send(); } + function loadRoundCounter() { url = basepath + '/info?type=Round'; var xhttp = new XMLHttpRequest(); @@ -181,6 +191,7 @@ function refresh() { xhttp.send(); } + function loadValue(_type, _div, _style) { url = basepath + '/value?all=true&type=' + _type; var xhttp = new XMLHttpRequest(); @@ -221,19 +232,15 @@ function refresh() { xhttp.send(); } + function init(){ basepath = getbasepath(); - loadValue("value", "value"); - loadValue("raw", "raw"); - loadValue("prevalue", "prevalue"); - loadValue("error", "error", "font-size:8px"); - loadStatus(); - loadCPUTemp(); - loadRSSI(); - loadUptime(); - loadRoundCounter(); + LoadData(); + LoadROIImage(); + Refresh(); } + init();