Index: /trunk/FACT++/src/feedback.cc
===================================================================
--- /trunk/FACT++/src/feedback.cc	(revision 13115)
+++ /trunk/FACT++/src/feedback.cc	(revision 13116)
@@ -103,5 +103,5 @@
     vector<vector<float>> fData;
 
-    uint64_t fCursorCur;
+     int64_t fCursorCur;
     uint64_t fCursorAmpl;
 
@@ -172,5 +172,6 @@
             if (fCursorCur==0)
             {
-                DimClient::sendCommandNB("BIAS_CONTROL/REQUEST_STATUS", NULL, 0);
+                if (fStatusBias.second==BIAS::kVoltageOn)
+                    DimClient::sendCommandNB("BIAS_CONTROL/REQUEST_STATUS", NULL, 0);
                 return;
             }
@@ -181,6 +182,7 @@
             {
                 // 3900 Ohm/n  +  1000 Ohm  +  1150 Ohm
-                const double R = fMap.hv(i).group()==0 ? 3125 : 2930;
-                const double I = double(fCurrentsAvg[i])/fCursorCur - fCalibration[i];
+                const double R  = fMap.hv(i).group()==0 ? 3125 : 2930;
+                const double Im = double(fCurrentsAvg[i])/fCursorCur;
+                const double I  = Im>fCalibration[i] ? Im-fCalibration[i] : 0;
                 vec[i+416] += R * I*conv;
                 if (fCalibration[i]>0)
@@ -215,6 +217,9 @@
             return -1;
 
-        if (fStatusBias.second==BIAS::kRamping)
+        if (fStatusBias.second!=BIAS::kVoltageOn)
             return false;
+
+        if (fCursorCur++<0)
+            return true;
 
         const int16_t *ptr = static_cast<int16_t*>(fBiasA.getData());
@@ -226,6 +231,4 @@
         }
 
-        fCursorCur++;
-
         return true;
     }
@@ -240,5 +243,5 @@
         if (fCursorCur<100)
         {
-            if (fStatusBias.second!=BIAS::kRamping)
+            if (fStatusBias.second==BIAS::kVoltageOn)
                 DimClient::sendCommandNB("BIAS_CONTROL/REQUEST_STATUS", NULL, 0);
             return;
@@ -260,5 +263,6 @@
         fControlType = kIdle;
 
-        DimClient::sendCommandNB("BIAS_CONTROL/REQUEST_STATUS", NULL, 0);
+        if (fStatusBias.second==BIAS::kVoltageOn)
+            DimClient::sendCommandNB("BIAS_CONTROL/REQUEST_STATUS", NULL, 0);
     }
 
@@ -805,5 +809,6 @@
         Message(out);
 
-        DimClient::sendCommandNB("BIAS_CONTROL/REQUEST_STATUS", NULL, 0);
+        if (fStatusBias.second==BIAS::kVoltageOn)
+            DimClient::sendCommandNB("BIAS_CONTROL/REQUEST_STATUS", NULL, 0);
 
         return GetCurrentState();
@@ -817,7 +822,5 @@
         if (fCalibration.size()==0)
         {
-            ostringstream out;
-            out << "Current control needs a bias crate calibration first... command ignored.";
-            Error(out);
+            Warn("Current control needs a bias crate calibration first... command ignored.");
             return GetCurrentState();
         }
@@ -896,11 +899,17 @@
 //            return kSM_FatalError;
 
+        if (fStatusBias.second==BIAS::kRamping)
+        {
+            Warn("Calibration cannot be started when biasctrl is in state Ramping.");
+            return GetCurrentState();
+        }
+
         ostringstream out;
-        out << "Starting temperature feedback with an offset of -2V";
+        out << "Starting temperature feedback for calibration with an offset of -2V";
         Message(out);
 
         fBiasOffset = -2;
         fControlType = kTemp;
-        fCursorCur = 0;
+        fCursorCur = -10;
         fCurrentsAvg.assign(416, 0);
         fCurrentsRms.assign(416, 0);
