Index: trunk/FACT++/scripts/Main.js
===================================================================
--- trunk/FACT++/scripts/Main.js	(revision 17028)
+++ trunk/FACT++/scripts/Main.js	(revision 17031)
@@ -196,7 +196,4 @@
 service_feedback.onchange = function(evt)
 {
-    if (this.cnt && evt.counter>this.cnt+12)
-        return;
-
     if (!evt.data)
         return;
@@ -204,5 +201,5 @@
     var Unom = evt.obj['U_nom'];
     var Uov  = evt.obj['U_ov'];
-    if (!U_ov)
+    if (!Uov)
         return;
 
@@ -221,7 +218,10 @@
     avg /= 320;
 
+    if (this.ok==undefined)
+        return;
+
     this.ok = cnt==0;
 
-    console.out("  DeltaUov=%.3f [N(>0.033V)=%d]".$(this.voltageStep, cnt));
+    console.out("  DeltaUov=%.3f [N(>0.033V)=%d]".$(avg, cnt));
 }
 
@@ -248,4 +248,6 @@
         dim.log("Switching voltage off.");
 
+        this.ok = undefined;
+
         // Supress the possibility that the bias control is
         // ramping and will reject the command to switch the
@@ -258,5 +260,5 @@
     }
 
-    dim.wait("BIAS_CONTROL", "VoltageOff", 5000);
+    dim.wait("BIAS_CONTROL", "VoltageOff", 60000);
 
     // FEEDBACK stays in CurrentCtrl when Voltage is off but output enabled
@@ -297,4 +299,5 @@
     {
         dim.log("Switching voltage on.");
+
         dim.send("FEEDBACK/START", 1.1);
         dim.wait("FEEDBACK", "InProgress", 45000);
@@ -302,5 +305,5 @@
 
     // Wait until voltage on
-    dim.wait("BIAS_CONTROL", "VoltageOn", 5000);
+    dim.wait("BIAS_CONTROL", "VoltageOn", 60000);
 
     if (isOff)
@@ -315,5 +318,5 @@
     function func()
     {
-        if (irq || this.ok)
+        if (irq || this.ok==true)
             return true;
     }
@@ -327,4 +330,6 @@
     else
         dim.log("Voltage stable within limits");
+
+    this.ok = undefined;
 }
 
@@ -445,5 +450,5 @@
          "FEEDBACK/CALIBRATION_R8",
          "FEEDBACK/CALIBRATION_STEPS",
-         "FEEDBACK/REFERENCE",
+/*         "FEEDBACK/REFERENCE",*/
          "FSC_CONTROL/CURRENT",
          "FSC_CONTROL/HUMIDITY",
@@ -739,6 +744,6 @@
     // It is not ideal that we allow the drive to be on during day time, but
     // otherwise it is difficult to allow e.g. the STARTUP at the beginning of the night
-    var power_states = sun.isUp || system_on===false ? [ "DriveOff", "SystemOn" ] : [ "SystemOn" ];
-    var drive_states = sun.isUp || system_on===false ?   undefined    : [ "Armed", "Tracking", "OnTrack" ];
+    var power_states = sun.isUp || !system_on ? [ "DriveOff", "SystemOn" ] : [ "SystemOn" ];
+    var drive_states = sun.isUp || !system_on ?   undefined    : [ "Armed", "Tracking", "OnTrack" ];
 
     // A scheduled task was found, lets check if all servers are
