Index: /trunk/FACT++/src/ftmctrl.cc
===================================================================
--- /trunk/FACT++/src/ftmctrl.cc	(revision 10554)
+++ /trunk/FACT++/src/ftmctrl.cc	(revision 10555)
@@ -574,4 +574,45 @@
             fStaticData[patch/4].fDAC[patch%4] = value;
 
+        // Maybe move to a "COMMIT" command?
+        CmdSendStatDat();
+
+        return true;
+    }
+
+    bool EnableFTU(int32_t board, bool enable)
+    {
+        if (board>39)
+            return false;
+
+        if (board<0)
+        {
+            if (enable)
+                fStaticData.EnableAllFTU();
+            else
+                fStaticData.DisableAllFTU();
+        }
+        else
+        {
+            if (enable)
+                fStaticData.EnableFTU(board);
+            else
+                fStaticData.DisableFTU(board);
+
+        }
+
+        // Maybe move to a "COMMIT" command?
+        CmdSendStatDat();
+
+        return true;
+    }
+
+    bool ToggleFTU(uint32_t board)
+    {
+        if (board>39)
+            return false;
+
+        fStaticData.ToggleFTU(board);
+
+        // Maybe move to a "COMMIT" command?
         CmdSendStatDat();
 
@@ -838,4 +879,29 @@
     }
 
+    int EnableFTU(const EventImp &evt)
+    {
+        if (!CheckEventSize(evt.GetSize(), "EnableFTU", 5))
+            return T::kSM_FatalError;
+
+        const int32_t &board  = *reinterpret_cast<const int32_t*>(evt.GetText());
+        const int8_t  &enable = *reinterpret_cast<const int8_t*>(evt.GetText()+4);
+
+        if (!fFTM.EnableFTU(board, enable))
+            T::Warn("EnableFTU - Board number must be <40.");
+
+        return T::GetCurrentState();
+    }
+
+    int ToggleFTU(const EventImp &evt)
+    {
+        if (!CheckEventSize(evt.GetSize(), "ToggleFTU", 4))
+            return T::kSM_FatalError;
+
+        if (!fFTM.ToggleFTU(evt.GetInt()))
+            T::Warn("ToggleFTU - Allowed range of boards 0-39.");
+
+        return T::GetCurrentState();
+    }
+
     int Disconnect()
     {
@@ -899,6 +965,4 @@
         fFTM(*this, *this)
     {
-        cout << "FTM" << endl;
-
         // ba::io_service::work is a kind of keep_alive for the loop.
         // It prevents the io_service to go to stopped state, which
@@ -969,6 +1033,17 @@
             (boost::bind(&StateMachineFTM::SetThreshold, this, _1))
             ("Set the comparator threshold"
-             "|Patch[idx]:Index of the patch"
+             "|Patch[idx]:Index of the patch (0-159), -1 for all"
              "|Threshold[counts]:Threshold to be set in binary counts");
+
+        AddConfiguration("ENABLE_FTU", "I:1;B:1", kStateIdle)
+            (boost::bind(&StateMachineFTM::EnableFTU, this, _1))
+            ("Enable or disable FTU"
+             "|Board[idx]:Index of the board (0-39), -1 for all"
+             "|Enable[bool]:Whether FTU should be enabled or disabled (yes/no)");
+
+        AddConfiguration("TOGGLE_FTU", "I:1", kStateIdle)
+            (boost::bind(&StateMachineFTM::ToggleFTU, this, _1))
+            ("Toggle status of FTU (this is mainly meant to be used in the GUI)"
+             "|Board[idx]:Index of the board (0-39)");
 
         T::AddConfiguration("SET_VERBOSE", "B")
@@ -1004,7 +1079,4 @@
         fFTM.StartConnect();
 
-
-        // SET_THRESHOLD          idx val
-        // ---> SetThreshold(idx==-1, val)
 
         // ENABLE_FTU             idx bool
