Index: trunk/FACT++/src/DataWriteFits.cc
===================================================================
--- trunk/FACT++/src/DataWriteFits.cc	(revision 12151)
+++ trunk/FACT++/src/DataWriteFits.cc	(revision 12160)
@@ -44,5 +44,5 @@
     fFile.AddColumn('C', "Errors",              4);
     fFile.AddColumn('I', "SoftTrig");
-    fFile.AddColumn('I', "PCTime",              2);
+    fFile.AddColumn('I', "UnixTimeUTC",         2);
     fFile.AddColumn('I', "BoardTime",           NBOARDS);
     fFile.AddColumn('S', "StartCellData",       NPIX);
Index: trunk/FACT++/src/PixelMap.h
===================================================================
--- trunk/FACT++/src/PixelMap.h	(revision 12151)
+++ trunk/FACT++/src/PixelMap.h	(revision 12160)
@@ -31,4 +31,6 @@
     int group() const { return pixel()>4; }
     int hv() const    { return hv_channel+hv_board*32; }
+
+    operator bool() const { return index>=0; }
 };
 
@@ -181,5 +183,3 @@
 };
 
-//const PixelMapEntry PixelMap::empty = { 0, 0, 0, 0, 0, 0 };
-
 #endif
Index: trunk/FACT++/src/feedback.cc
===================================================================
--- trunk/FACT++/src/feedback.cc	(revision 12151)
+++ trunk/FACT++/src/feedback.cc	(revision 12160)
@@ -301,18 +301,22 @@
                             // Kd = 0;
 
-                            //                    -110 / -110 (-23 DAC / -0.51V)
-                            // Reference voltage: -238 / -203
-                            //                    -360 / -343 ( 23 DAC /  0.51V)
-
-                            // 0.005 A/V
-                            // 220 Amplitude / 1V
-
-                            // Gain = 1V / 200 = 0.005
-
                             // => Kp = 0.01 * gain     = 0.00005
                             // => Ki = 0.8  * gain/20s = 0.00025
                             // => Kd = 0.1  * gain/20s = 0.00003
 
-                            //valarray<double> correction = - Kp*(PV[2] - PV[1]) + Ki * dT * (SP-PV[2]) - Kd/dT * (PV[2] - 2*PV[1] + PV[0]);
+                            //valarray<double> correction =
+                            // -      Kp * (PV[2] - PV[1])
+                            // + dT * Ki * (SP    - PV[2])
+                            // - Kd / dT * (PV[2] - 2*PV[1] + PV[0]);
+                            //
+                            // - (Kp+Kd/dT1) * (PV[2] - PV[1])
+                            // + dT2 * Ki * (SP    - PV[2])
+                            // + Kd / dT1 * (PV[1] - PV[0]);
+                            //
+                            // - Kp * (PV[2] - PV[1])
+                            // + Ki * (SP    - PV[2])*dT
+                            // - Kd * (PV[2] - PV[1])/dT
+                            // + Kd * (PV[1] - PV[0])/dT;
+                            //
                             //valarray<double> correction =
                             //    - Kp*(PV[2] - PV[1]) + Ki * T21 * (SP-PV[2]) - Kd*(PV[2]-PV[1])/T21 - Kd*(PV[0]-PV[1])/T01;
@@ -324,4 +328,16 @@
                                 );
 
+                            /*
+                             integral = 0
+                             start:
+                                 integral += (fSP - fPV[2])*dt
+
+                                 output = Kp*(fSP - fPV[2]) + Ki*integral - Kd*(fPV[2] - fPV[1])/dt
+
+                                 wait(dt)
+
+                                 goto start
+                             */
+
                             vector<float> vec(2*BIAS::kNumChannels);
                             for (int i=0; i<BIAS::kNumChannels; i++)
@@ -337,6 +353,6 @@
                                 Info("Sending correction to feedback.");
 
-                                dic_cmnd_service((char*)"BIAS_CONTROL/ADD_REFERENCE_VOLTAGES",
-                                                 (void*)(vec.data()+416), 416*sizeof(float));
+                                DimClient::sendCommandNB("BIAS_CONTROL/ADD_REFERENCE_VOLTAGES",
+                                                         (void*)(vec.data()+416), 416*sizeof(float));
 
                                 /*
@@ -607,4 +623,13 @@
             return 1;
         }
+
+        //                    -110 / -110 (-23 DAC / -0.51V)
+        // Reference voltage: -238 / -203
+        //                    -360 / -343 ( 23 DAC /  0.51V)
+
+        // 0.005 A/V
+        // 220 Amplitude / 1V
+
+        // Gain = 1V / 200 = 0.005
 
         fGain = 5; // (BIAS)V / (DRS)V     ( 1V / 0.22V )
@@ -676,4 +701,6 @@
 void PrintHelp()
 {
+    Main::PrintHelp<StateMachineFeedback>();
+
     /* Additional help text which is printed after the configuration
      options goes here */
Index: trunk/FACT++/src/tools.cc
===================================================================
--- trunk/FACT++/src/tools.cc	(revision 12151)
+++ trunk/FACT++/src/tools.cc	(revision 12160)
@@ -73,2 +73,43 @@
     return str.substr(start, end-start+1);
 }
+
+// --------------------------------------------------------------------------
+//
+//! This is a static helper to remove leading and trailing whitespaces.
+//!
+//! Usage example:
+//!
+//! \code
+//!    string str = "     Dies ist ein test fuer einen ganz     langen Satz "
+//!        "und ob er korrekt umgebrochen und formatiert wird. Alles "
+//!        "nur ein simpler test aber trotzdem ganz wichtig.";
+//!
+//!    cout << setfill('-') << setw(40) << "+" << endl;
+//!    while (1)
+//!    {
+//!        const string rc = Tools::Wrap(str, 40);
+//!        if (rc.empty())
+//!            break;
+//!        cout << rc << endl;
+//!    }
+//! \endcode
+//!
+string Tools::Wrap(string &str, size_t width)
+{
+    const size_t pos = str.length()<width ? string::npos : str.find_last_of(' ', width);
+    if (pos==string::npos)
+    {
+        const string rc = str;
+        str = "";
+        return rc;
+    }
+
+    const size_t indent = str.find_first_not_of(' ');
+
+    const string rc = str.substr(0, pos);
+    const size_t p2 = str.find_first_not_of(' ', pos+1);
+
+    str = str.substr(0, indent) + str.substr(p2==string::npos ? pos+1 : p2);
+
+    return rc;
+}
Index: trunk/FACT++/src/tools.h
===================================================================
--- trunk/FACT++/src/tools.h	(revision 12151)
+++ trunk/FACT++/src/tools.h	(revision 12160)
@@ -1,2 +1,5 @@
+#ifndef FACT_Tools
+#define FACT_Tools
+
 #include <string>
 
@@ -6,3 +9,6 @@
     std::string Form(const char *fmt, ...);
     std::string Trim(const std::string &str);
+    std::string Wrap(std::string &str, size_t width=78);
 }
+
+#endif
