Index: /trunk/FACT++/gui/FactGui.h
===================================================================
--- /trunk/FACT++/gui/FactGui.h	(revision 10555)
+++ /trunk/FACT++/gui/FactGui.h	(revision 10556)
@@ -324,5 +324,5 @@
     };
 
-    vector<bool> fFtuDisabled;
+    valarray<int8_t> fFtuStatus;
 
     DimStampedInfo fDimDNS;
@@ -902,46 +902,65 @@
     FTM::DimStaticData fFtmStaticData;
 
-    int fFtuStatus;
-
-
     void SetFtuLed(int idx, int counter)
     {
-        if (counter<0)
+        if (counter==0)
+            counter = 3;
+
+        if (counter==-1)
+            counter = 0;
+
+        switch (counter)
+        {
+        case 0:
             fFtuLED[idx]->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
-
-        if (counter==0)
-        {
+            break;
+
+        case 1:
+            fFtuLED[idx]->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
+            break;
+
+        case 2:
+            fFtuLED[idx]->setIcon(QIcon(":/Resources/icons/orange circle 1.png"));
+            break;
+
+        case 3:
             fFtuLED[idx]->setIcon(QIcon(":/Resources/icons/red circle 1.png"));
+            break;
+        }
+
+        fFtuStatus[idx] = counter;
+    }
+
+    void SetFtuStatusLed()
+    {
+        const int max = fFtuStatus.max();
+
+        switch (max)
+        {
+        case 0:
+            fStatusFTULed->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
+            fStatusFTULabel->setText("All disabled");
+            fStatusFTULabel->setToolTip("All FTUs are disabled");
+            break;
+
+        case 1:
+            fStatusFTULed->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
+            fStatusFTULabel->setToolTip("Communication with FTU is smooth.");
+            fStatusFTULabel->setText("Ok");
+            break;
+
+        case 2:
+            fStatusFTULed->setIcon(QIcon(":/Resources/icons/orange circle 1.png"));
+            fStatusFTULabel->setText("Warning");
+            fStatusFTULabel->setToolTip("At least one FTU didn't answer immediately");
+            break;
+
+        case 3:
             fStatusFTULed->setIcon(QIcon(":/Resources/icons/red circle 1.png"));
             fStatusFTULabel->setToolTip("At least one FTU didn't answer!");
             fStatusFTULabel->setText("ERROR");
-            fFtuStatus = 0;
-        }
-        if (counter==1)
-        {
-            fFtuLED[idx]->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
-            if (fFtuStatus<0)
-            {
-                fStatusFTULed->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
-                fStatusFTULabel->setToolTip("Communication with FTU is smooth.");
-                fStatusFTULabel->setText("Ok");
-                fFtuStatus = 1;
-            }
-        }
-
-        if (counter>1)
-        {
-            fFtuLED[idx]->setIcon(QIcon(":/Resources/icons/orange circle 1.png"));
-            if (fFtuStatus!=0)
-            {
-                fStatusFTULed->setIcon(QIcon(":/Resources/icons/orange circle 1.png"));
-                fStatusFTULabel->setText("Warning");
-                fStatusFTULabel->setToolTip("At least one FTU didn't answer immediately");
-                fFtuStatus = 2;
-            }
-        }
-
-    }
-
+            break;
+        }
+    }
 
     void handleFtmStaticData(const DimData &d)
@@ -990,25 +1009,18 @@
         fEnableTimeMarker->setChecked(sdata.HasTimeMarker());
 
-        bool active = false;
         for (int i=0; i<40; i++)
         {
             if (!sdata.IsActive(i))
-            {
                 SetFtuLed(i, -1);
-                fFtuDisabled[i] = true;
-            }
             else
             {
-                active = true;
-                if (fFtuDisabled[i])
-                {
+                if (fFtuStatus[i]==0)
                     SetFtuLed(i, 1);
-                    fFtuDisabled[i] = false;
-                }
             }
-        }
-
-        if (!active)
-            DisableStatusLedFtu();
+            fFtuLED[i]->setChecked(false);
+        }
+        cout << endl;
+
+        SetFtuStatusLed();
 
 #ifdef HAS_ROOT
@@ -1045,12 +1057,4 @@
         fFtmBoardId->setText(str1.str().c_str());
         fFtmFirmwareId->setText(str2.str().c_str());
-    }
-
-    void DisableStatusLedFtu()
-    {
-        fFtuStatus = -1;
-        fStatusFTULed->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
-        fStatusFTULabel->setText("All disabled");
-        fStatusFTULabel->setToolTip("All FTUs are disabled");
     }
 
@@ -1093,13 +1097,8 @@
         fFtuAnswersCrate3->setValue(sdata.fNumBoardsCrate[3]);
 
-        DisableStatusLedFtu();
-
         for (int i=0; i<40; i++)
-        {
-            const bool active = sdata.IsActive(i);
-
-            SetFtuLed(i, active ? sdata.fPing[i] : -1);
-            fFtuDisabled[i] = !active;
-        }
+            SetFtuLed(i, sdata.IsActive(i) ? sdata.fPing[i] : -1);
+
+        SetFtuStatusLed();
     }
 
@@ -1112,4 +1111,5 @@
 
         SetFtuLed(sdata.fError.fDestAddress , sdata.fError.fNumCalls);
+        SetFtuStatusLed();
 
         // Write to special window!
@@ -1149,5 +1149,4 @@
             if (!enable)
             {
-                fFtuStatus = -1;
                 fStatusFTULed->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
                 fStatusFTULabel->setText("Offline");
@@ -1580,5 +1579,5 @@
 public:
     FactGui() :
-        fFtuDisabled(40),
+        fFtuStatus(40),
         fDimDNS("DIS_DNS/VERSION_NUMBER", 1, int(0), this),
 
