Index: /trunk/FACT++/src/ratecontrol.cc
===================================================================
--- /trunk/FACT++/src/ratecontrol.cc	(revision 14432)
+++ /trunk/FACT++/src/ratecontrol.cc	(revision 14433)
@@ -167,4 +167,10 @@
         for (int i=0; i<40; i++)
         {
+            if (fBlock[i])
+            {
+                fBlock[i] = false;
+                continue;
+            }
+
             int maxi = -1;
 
@@ -186,10 +192,4 @@
             }
 
-            if (fBlock[i])
-            {
-                fBlock[i] = false;
-                continue;
-            }
-
             for (int j=0; j<4; j++)
             {
@@ -441,14 +441,21 @@
             return RateControl::State::kDisconnected;
 
-        if (GetCurrentState()==RateControl::State::kSettingGlobalThreshold)
+        const bool inprog = fEnabled && fTriggerOn && fDimRS.state()<RateScan::State::kConfiguring;
+
+        switch (GetCurrentState())
+        {
+        case RateControl::State::kSettingGlobalThreshold:
             return RateControl::State::kSettingGlobalThreshold;
 
-        if (GetCurrentState()==RateControl::State::kGlobalThresholdSet)
-            return RateControl::State::kGlobalThresholdSet;
-
-        if (fEnabled && fTriggerOn && fDimRS.state()<RateScan::State::kConfiguring)
-            return RateControl::State::kInProgress;
-
-        return RateControl::State::kConnected;
+        case RateControl::State::kGlobalThresholdSet:
+            if (!inprog)
+                return RateControl::State::kGlobalThresholdSet;
+
+        case RateControl::State::kInProgress:
+            if (inprog)
+                return RateControl::State::kInProgress;
+        }
+
+        return RateControl::State::kInConnected;
     }
 
@@ -487,33 +494,36 @@
                      "All needed subsystems are connected to their hardware, no action is performed.");
 
-        AddStateName(RateControl::State::kSettingGlobalThreshold, "Calibrating", "");
-        AddStateName(RateControl::State::kGlobalThresholdSet, "GlobalThresholdSet", "");
+        AddStateName(RateControl::State::kSettingGlobalThreshold, "Calibrating",
+                     "A global minimum thrshold is currently determined.");
+
+        AddStateName(RateControl::State::kGlobalThresholdSet, "GlobalThresholdSet",
+                     "A global threshold has ben set, waiting for the trigger to be switched on.");
 
         AddStateName(RateControl::State::kInProgress, "InProgress",
-                     "Rate scan in progress.");
+                     "Rate control in progress.");
 
         AddEvent("CALIBRATE")
             (bind(&StateMachineRateControl::Calibrate, this))
-            ("");
+            ("Start a search for a reasonable minimum global threshold");
 
         AddEvent("START", "", RateControl::State::kConnected, RateControl::State::kGlobalThresholdSet)
             (bind(&StateMachineRateControl::StartRC, this))
-            ("");
+            ("Enable rate control (it will start when the trigger is on and a calibration was successfull)");
 
         AddEvent("STOP", "", RateControl::State::kSettingGlobalThreshold, RateControl::State::kInProgress)
             (bind(&StateMachineRateControl::StopRC, this))
-            ("");
+            ("Stop rat control");
 
         AddEvent("SET_MIN_THRESHOLD", "I:1")
             (bind(&StateMachineRateControl::SetMinThreshold, this, placeholders::_1))
-            ("");
+            ("Set a minimum threshold at which th rate control starts calibrating");
 
         AddEvent("SET_TARGET_RATE", "F:1")
             (bind(&StateMachineRateControl::SetTargetRate, this, placeholders::_1))
-            ("");
+            ("Set a target trigger rate for the calibration");
 
         AddEvent("PRINT")
             (bind(&StateMachineRateControl::Print, this))
-            ("");
+            ("Print current status");
 
         AddEvent("SET_VERBOSE", "B")
