Index: trunk/FACT++/src/ftmctrl.cc
===================================================================
--- trunk/FACT++/src/ftmctrl.cc	(revision 10735)
+++ trunk/FACT++/src/ftmctrl.cc	(revision 10749)
@@ -238,5 +238,6 @@
             {
                 stringstream str;
-                str << "Invalid header received: start delimiter wrong, received " << hex << fHeader.fDelimiter << " expected " << FTM::kDelimiterStart << ".";
+                str << "Invalid header received: start delimiter wrong, received ";
+                str << hex << fHeader.fDelimiter << ", expected " << FTM::kDelimiterStart << ".";
                 Error(str);
                 PostClose(false);
@@ -298,5 +299,5 @@
             stringstream str;
             str << "Invalid data received: end delimiter wrong, received ";
-            str << hex << ntohs(fBuffer.back()) << " expected " << FTM::kDelimiterEnd << ".";
+            str << hex << ntohs(fBuffer.back()) << ", expected " << FTM::kDelimiterEnd << ".";
             Error(str);
             PostClose(false);
@@ -484,5 +485,5 @@
 public:
 
-    static const uint16_t kMaxAddr;
+//    static const uint16_t kMaxAddr;
 
 public:
@@ -549,5 +550,5 @@
     bool CmdSetRegister(uint16_t addr, uint16_t val)
     {
-        if (addr>kMaxAddr)
+        if (addr>FTM::StaticData::kMaxAddr)
             return false;
 
@@ -564,5 +565,5 @@
     bool CmdGetRegister(uint16_t addr)
     {
-        if (addr>kMaxAddr)
+        if (addr>FTM::StaticData::kMaxAddr)
             return false;
 
@@ -872,10 +873,25 @@
     }
 
-    bool DisablePixel(uint16_t idx, bool disable)
+    bool EnablePixel(uint16_t idx, bool enable)
     {
         if (idx>FTM::StaticData::kMaxPixelIdx)
             return false;
 
-        fStaticData.EnablePixel(idx, !disable);
+        cout << "ENABLE " << idx << " " << enable << endl;
+        fStaticData.EnablePixel(idx, enable);
+
+        CmdSendStatDat();
+
+        return true;
+    }
+
+    bool TogglePixel(uint16_t idx)
+    {
+        if (idx>FTM::StaticData::kMaxPixelIdx)
+            return false;
+
+        cout << "TOGGLE " << idx << endl;
+
+        fStaticData.EnablePixel(idx, !fStaticData.Enabled(idx));
 
         CmdSendStatDat();
@@ -887,5 +903,5 @@
 };
 
-const uint16_t ConnectionFTM::kMaxAddr = 0xfff;
+//const uint16_t ConnectionFTM::kMaxAddr = 0xfff;
 
 // ------------------------------------------------------------------------
@@ -1330,10 +1346,20 @@
     }
 
-    int DisablePixel(const EventImp &evt)
-    {
-        if (!CheckEventSize(evt.GetSize(), "DisablePixel", 3))
-            return T::kSM_FatalError;
-
-        fFTM.DisablePixel(evt.GetUShort(), evt.GetText()[2]!=0);
+    int EnablePixel(const EventImp &evt, bool b)
+    {
+        if (!CheckEventSize(evt.GetSize(), "EnablePixel", 2))
+            return T::kSM_FatalError;
+
+        fFTM.EnablePixel(evt.GetUShort(), b);
+
+        return T::GetCurrentState();
+    }
+
+    int TogglePixel(const EventImp &evt)
+    {
+        if (!CheckEventSize(evt.GetSize(), "TogglePixel", 2))
+            return T::kSM_FatalError;
+
+        fFTM.TogglePixel(evt.GetUShort());
 
         return T::GetCurrentState();
@@ -1483,6 +1509,14 @@
              "|Enable[bool]:Whether FTU should be enabled or disabled (yes/no)");
 
-        AddEvent("DISABLE_PIXEL", "S:1;B:1", kStateIdle)
-            (boost::bind(&StateMachineFTM::DisablePixel, this, _1))
+        AddEvent("DISABLE_PIXEL", "S:1", kStateIdle)
+            (boost::bind(&StateMachineFTM::EnablePixel, this, _1, false))
+            ("");
+
+        AddEvent("ENABLE_PIXEL", "S:1", kStateIdle)
+            (boost::bind(&StateMachineFTM::EnablePixel, this, _1, true))
+            ("");
+
+        AddEvent("TOGGLE_PIXEL", "S:1", kStateIdle)
+            (boost::bind(&StateMachineFTM::TogglePixel, this, _1))
             ("");
 
@@ -1533,4 +1567,9 @@
             ("Enable veto line"
              "|Enable[bool]:Enable veto (yes/no)");
+
+        AddEvent("ENABLE_CLOCK_CONDITIONER", "B:1", kStateIdle)
+            (boost::bind(&StateMachineFTM::Enable, this, _1, FTM::StaticData::kClockConditioner))
+            ("Enable clock conidtioner output in favor of time marker output"
+             "|Enable[bool]:Enable clock conditioner (yes/no)");
 
         AddEvent("SET_TRIGGER_SEQUENCE", "C:3", kStateIdle)
