]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
avoid unnecessary write after read
authorJan Michel <j.michel@gsi.de>
Wed, 31 Jul 2013 10:08:03 +0000 (12:08 +0200)
committerJan Michel <j.michel@gsi.de>
Wed, 31 Jul 2013 10:08:03 +0000 (12:08 +0200)
web/htdocs/thresh/threshold.htm

index c775d6744b1553713fb4aad4427862dabe1380b8..d566de52d6219db7f39f8052453d038621fcef42 100644 (file)
@@ -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;
   }