Index: /trunk/FACT++/src/lidctrl.cc
===================================================================
--- /trunk/FACT++/src/lidctrl.cc	(revision 14679)
+++ /trunk/FACT++/src/lidctrl.cc	(revision 14680)
@@ -328,4 +328,7 @@
     {
         fNextCommand = post;
+
+        fLid1.status = "";
+        fLid2.status = "";
         //PostRequest("POST", post);
     }
@@ -335,7 +338,4 @@
         PostRequest("POST", fNextCommand);
         fNextCommand = "";
-
-        fLid1.status = "";
-        fLid2.status = "";
 
         fKeepAlive.expires_from_now(boost::posix_time::seconds(fInterval));
@@ -441,4 +441,6 @@
     Time fLastCommand;
 
+    uint16_t fTimeToMove;
+
     bool CheckEventSize(size_t has, const char *name, size_t size)
     {
@@ -513,6 +515,8 @@
         if (T::GetCurrentState()==Lid::State::kMoving &&
             (rc==Lid::State::kConnected || rc==Lid::State::kDisconnected) &&
-            fLastCommand+boost::posix_time::seconds(6*fLid.GetInterval()) < Time())
+            fLastCommand+boost::posix_time::seconds(fTimeToMove+fLid.GetInterval()) > Time())
+        {
             return Lid::State::kMoving;
+        }
 
         return rc==Lid::State::kConnected ? T::GetCurrentState() : rc;
@@ -562,8 +566,10 @@
 
         T::AddEvent("OPEN", Lid::State::kInconsistent, Lid::State::kClosed)
-            (bind(&StateMachineLidControl::Open, this));
+            (bind(&StateMachineLidControl::Open, this))
+            ("Open the lids");
 
         T::AddEvent("CLOSE", Lid::State::kInconsistent, Lid::State::kOpen)
-            (bind(&StateMachineLidControl::Close, this));
+            (bind(&StateMachineLidControl::Close, this))
+            ("Close the lids");
 
         T::AddEvent("POST", "C")
@@ -581,4 +587,6 @@
         fLid.SetEndpoint(conf.Get<string>("addr"));
         fLid.StartConnect();
+
+        fTimeToMove = conf.Get<uint16_t>("time-to-move");
 
         return -1;
@@ -606,4 +614,5 @@
         ("quiet,q",    po_bool(true),  "Disable printing contents of all received messages (except dynamic data) in clear text.")
         ("interval,i", var<uint16_t>(5), "Interval between two updates on the server in seconds")
+        ("time-to-move", var<uint16_t>(20), "Expected minimum time the lid taks to open/close")
         ("debug-tx",   po_bool(), "Enable debugging of ethernet transmission.")
         ;
