Index: /trunk/FACT++/src/biasctrl.cc
===================================================================
--- /trunk/FACT++/src/biasctrl.cc	(revision 11979)
+++ /trunk/FACT++/src/biasctrl.cc	(revision 11980)
@@ -61,4 +61,6 @@
     bool fWaitingForAnswer;
 
+    vector<uint64_t> fCounter;
+
 protected:
     vector<uint16_t> fVolt;        // Current voltage in DAC units (12bit = 90V)
@@ -320,4 +322,5 @@
             // Cancel sending of the next 0
             fSyncTimer.cancel();
+            fCounter[0]++;
 
             // Start continous reading of all channels
@@ -335,8 +338,5 @@
 
 
-        // Take action depending on what is going on
-        if (command==kCmdReset)
-            Message("Reset command successfully answered.");
-
+        // Check if new values have been received
         if (cmd==kCmdRead || cmd==kCmdChannelSet || cmd==kExpertChannelSet)
         {
@@ -345,14 +345,31 @@
         }
 
-        if (cmd==kCmdReset || command==kResetChannels)
-        {
+        // ----- Take action depending on what is going on -----
+
+        if (command==kCmdReset)
+        {
+            Message("Reset command successfully answered... restarting automatic readout.");
+
+            fCounter[1]++;
+
             // Re-start cyclic reading of values after a short time
-            // to allow the currents to become stable
+            // to allow the currents to become stable. This ensures that
+            // we get an update soon but wait long enough to get reasonable
+            // values
             fUpdateTimer.cancel();
             ScheduleUpdate(100);
         }
 
+        if (command==kResetChannels)
+        {
+            ExpertReset(false);
+            fCounter[5]++;
+        }
+
         if (command==kUpdate)
+        {
             ScheduleUpdate(fUpdateTime);
+            fCounter[2]++;
+        }
 
         // If we are ramping, schedule a new ramp step
@@ -360,6 +377,16 @@
         {
             ScheduleRampStep();
-            return;
-        }
+            fCounter[3]++;
+        }
+
+        if (command==kCmdRead)
+            fCounter[4]++;
+
+        if ((command&0xff)==kExpertChannelSet)
+            fCounter[6]++;
+
+        if (command==kCmdGlobalSet)
+            fCounter[7]++;
+
     }
 
@@ -424,6 +451,6 @@
         case kResetChannels:
         case kCmdRead:
+            fWaitingForAnswer = false;
             HandleReceivedData(fBuffer, bytes_received, command, send_counter);
-            fWaitingForAnswer = false;
             return;
 
@@ -687,4 +714,5 @@
         fIsRamping(false),
         fWaitingForAnswer(false),
+        fCounter(8),
         fVolt(kNumChannels),
         fVoltRef(kNumChannels),
@@ -806,7 +834,5 @@
             if (fVoltRef[ch]+dac[ch]>kMaxDac)
             {
-                ostringstream msg;
-                msg << "AddDac - New voltage reference of " << fVoltRef[ch]*90./4096 << "V + " << dac[ch]*90./4096. << "V for channel " << ch << " out of range.";
-                Error(msg);
+                Error("AddDac - New voltage reference out of range.");
                 return false;
             }
@@ -916,7 +942,5 @@
             if (fVoltGapd[ch]+dac>kMaxDac)
             {
-                ostringstream msg;
-                msg << "SetGapdVoltage - New voltage reference of " << fVoltGapd[ch] << "V + " << dac << "V for channel " << ch << " out of range.";
-                Error(msg);
+                Error("SetGapdVoltage - New voltage reference out of range.");
                 return false;
             }
@@ -991,5 +1015,5 @@
     // -------------------------------------------------------------------
 
-    void ExpertReset()
+    void ExpertReset(bool expert_mode=true)
     {
         if (fWaitingForAnswer)
@@ -999,5 +1023,7 @@
         }
 
-        Warn("EXPERT MODE: Sending reset.");
+        if (expert_mode)
+            Warn("EXPERT MODE: Sending reset.");
+
         PostMessage(GetCmd(kCmdReset));
         AsyncRead(ba::buffer(fBuffer, 3), kCmdReset, ++fSendCounter);
@@ -1075,4 +1101,22 @@
     {
         fIsVerbose = b;
+    }
+
+    void PrintInfo()
+    {
+        Out() << endl << kBold << dec << '\n';
+        Out() << "fWrapCounter    = " << fWrapCounter << '\n';
+        Out() << "fSendCounter    = " << fSendCounter%8 << " (" << fSendCounter << ")" << '\n';
+        Out() << "fIsInitializing = " << fIsInitializing << '\n';
+        Out() << "fIsRamping      = " << fIsRamping << '\n';
+        Out() << "Answer counter:" << '\n';
+        Out() << " - Synchronization: " << fCounter[0] << '\n';
+        Out() << " - Reset:           " << fCounter[1] << '\n';
+        Out() << " - Request update:  " << fCounter[2] << '\n';
+        Out() << " - Ramp step:       " << fCounter[3] << '\n';
+        Out() << " - Read:            " << fCounter[4] << '\n';
+        Out() << " - Reset channels:  " << fCounter[5] << '\n';
+        Out() << " - Global set:      " << fCounter[7] << '\n';
+        Out() << " - Channel set:     " << fCounter[6] << '\n' << endl;
     }
 
@@ -1711,4 +1755,7 @@
 
 
+        T::AddEvent("PRINT_INFO")
+            (Wrapper(bind(&ConnectionBias::PrintInfo, &fBias)))
+            ("Print a table with all current read back with the last request operation");
         T::AddEvent("PRINT_CURRENTS")
             (Wrapper(bind(&ConnectionBias::PrintA, &fBias)))
@@ -1727,5 +1774,5 @@
 
         T::AddEvent("EXPERT_RESET", kExpertMode)
-            (Wrapper(bind(&ConnectionBias::ExpertReset, &fBias)))
+            (Wrapper(bind(&ConnectionBias::ExpertReset, &fBias, true)))
             ("Send the RESET command (note that this is possibly harmfull command)");
 
