From: Jan Michel Date: Wed, 31 Jul 2013 10:08:03 +0000 (+0200) Subject: avoid unnecessary write after read X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=752b6b8e614a43bfa6f370dd0999027bbcb090ad;p=daqtools.git avoid unnecessary write after read --- diff --git a/web/htdocs/thresh/threshold.htm b/web/htdocs/thresh/threshold.htm index c775d67..d566de5 100644 --- a/web/htdocs/thresh/threshold.htm +++ b/web/htdocs/thresh/threshold.htm @@ -63,6 +63,7 @@ var type = document.getElementById("form_type").value; var reference = document.getElementById("form_ref").value; var updateTask = 0; var total = 0; +var wasRead = 0; function update(bar,scale) { @@ -72,9 +73,14 @@ function update(bar,scale) { document.getElementById("total").innerHTML = total+" - "+Math.round(total/655.36*reference)/100+" mV"; command = (type << 20) + (chan << 16) + (total); command = command.toString(16); - dataWaiting = 1; - if(updateTask == 0) { - updateTask = setTimeout("doUpdate()",updaterate); + if(wasRead == 0) { + dataWaiting = 1; + if(updateTask == 0) { + updateTask = setTimeout("doUpdate()",updaterate); + } + } + else { + wasRead--; } } @@ -108,6 +114,7 @@ function anaret2(d) { var n=d.toLocaleTimeString(); document.getElementById("timeget").innerHTML = n; document.getElementById("timeget").style.background = "transparent"; + wasRead = 2; }