Index: trunk/FACT++/src/fscctrl.cc
===================================================================
--- trunk/FACT++/src/fscctrl.cc	(revision 18193)
+++ trunk/FACT++/src/fscctrl.cc	(revision 18194)
@@ -31,8 +31,10 @@
 
     bool fIsVerbose;
+    bool fIsAutoReconnect;
 
     size_t fNumConsecutiveErrors;   // Number of consecutive messages with errors
     size_t fNumConsecutiveMessages; // Number of consecutive message which are ok
 
+    boost::asio::deadline_timer fReconnectTimeout;
 
 protected:
@@ -126,5 +128,5 @@
     }
 
-    void ProcessMessage()
+    bool ProcessMessage()
     {
         if (fIsVerbose)
@@ -132,5 +134,5 @@
 
         if (!CheckChecksum())
-            return;
+            return false;
 
         // That looks a bit odd because it copies the values twice for no reason.
@@ -247,7 +249,12 @@
             humidities.push_back((volt[*ph]-offrh[idx])*0.0313);
 
+        //1019=4.8
+        //1005=1.3
+        //970=-7.6
+        //1300=76
         for (int *pt=mapt; *pt>=0; pt++)
             //temperatures.push_back(resist[*pt]>800&&resist[*pt]<2000 ? GetTempPT1000(resist[*pt]) : 0);
             temperatures.push_back(resist[*pt]>970&&resist[*pt]<1300 ? GetTempPT1000(resist[*pt]) : 0);
+            //temperatures.push_back(resist[*pt]>1019&&resist[*pt]<1300 ? GetTempPT1000(resist[*pt]) : 0);
 
         // 0 = 3-(3+0)%4
@@ -435,4 +442,5 @@
                 //if (resist[i]>800 && resist[i]<2000)
                 if (resist[i]>970 && resist[i]<1300)
+                //if (resist[i]>1019 && resist[i]<1300)
                     Out() << setw(2) << i << " - " << setw(4) << (int)resist[i] << ": " << setprecision(1) << fixed << GetTempPT1000(resist[i]) << endl;
                 else
@@ -447,4 +455,6 @@
         fNumConsecutiveErrors = 0;
         fNumConsecutiveMessages++;
+
+        return true;
     }
 
@@ -480,5 +490,14 @@
         }
 
-        ProcessMessage();
+        if (!ProcessMessage())
+        {
+            fIsAutoReconnect = true;
+            fReconnectTimeout.expires_from_now(boost::posix_time::seconds(10));
+            fReconnectTimeout.async_wait(boost::bind(&ConnectionFSC::HandleReconnectTimeout,
+                                                     this, dummy::error));
+            PostClose(true);
+            return;
+        }
+
         StartRead();
     }
@@ -488,6 +507,12 @@
         fNumConsecutiveErrors   = 0;
         fNumConsecutiveMessages = 0;
+        fIsAutoReconnect = false;
 
         StartRead();
+    }
+
+    void HandleReconnectTimeout(const bs::error_code &)
+    {
+        fIsAutoReconnect = false;
     }
 
@@ -529,5 +554,5 @@
 public:
     ConnectionFSC(ba::io_service& ioservice, MessageImp &imp) : Connection(ioservice, imp()),
-        fIsVerbose(false)
+        fIsVerbose(false), fIsAutoReconnect(false), fReconnectTimeout(ioservice)
     {
         SetLogStream(&imp);
@@ -547,4 +572,9 @@
     {
         fPositionsBias = vec;
+    }
+
+    bool IsOpen() const
+    {
+        return IsConnected() || fIsAutoReconnect;
     }
 };
@@ -758,5 +788,5 @@
     int Execute()
     {
-        return fFSC.IsConnected() ? State::kConnected : State::kDisconnected;
+        return fFSC.IsOpen() ? State::kConnected : State::kDisconnected;
     }
 
