Index: trunk/FACT++/src/fscctrl.cc
===================================================================
--- trunk/FACT++/src/fscctrl.cc	(revision 19922)
+++ trunk/FACT++/src/fscctrl.cc	(revision 19923)
@@ -35,4 +35,6 @@
     uint16_t fTempMin;
     uint16_t fTempMax;
+
+    uint16_t fTempExceeded55;
 
     size_t fNumConsecutiveErrors;   // Number of consecutive messages with errors
@@ -259,16 +261,45 @@
         //1300=76
         //DD 2019/09/01: changed from 970 to 980 as sensor 19 had values slighly larger than -7.6
+        // Note that these values are not only the temperature sensors in the compartment
+        // but also all other tempereture sensors in the electronics!
 
         const auto min = GetTempPT1000(fTempMin);
 
+        bool tempgt50 = false;
         for (int *pt=mapt; *pt>=0; pt++)
         {
             const bool valid = resist[*pt]>=fTempMin && resist[*pt]<=fTempMax;
             temperatures.push_back(valid ? GetTempPT1000(resist[*pt]) : 0);
+
+            if (temperatures.back()>55)
+            {
+                Warn("Temperature sensor "+to_string(temperatures.size()-1)+" exceeds 55 degC!");
+                tempgt50 = true;
+            }
 
             if (valid && temperatures.back()<min+1)
                 Warn(Tools::Form("Temperature sensor %2d has reading (%d=%.2f degC) closer than 1K to lower limit (%d=%.2f degC)",
                                  temperatures.size()-1, resist[*pt], temperatures.back(), fTempMin, min));
-
+        }
+
+        if (tempgt50)
+            fTempExceeded55++;
+        else
+            fTempExceeded55 = 0;
+
+        if (fTempExceeded55==3)
+        {
+            Error("EMERGENCY: This is the third time in a row that any of the tempereture sensors exceeds 50 degC.");
+            Dim::SendCommandNB("BIAS_CONTROL/VOLTAGE_OFF");
+            Error("Sending 'BIAS_CONTROL/VOLTAGE_OFF'.");
+
+            Dim::SendCommandNB("PWR_CONTROL/CAMERA_POWER", uint8_t(0));
+            Error("Sending 'PWR_CONTROL/CAMERA_POWER off'.");
+
+            Dim::SendCommandNB("AGILENT_CONTROL_50V/SET_POWER", uint8_t(0));
+            Error("Sending 'AGILENT_CONTROL_50V/SET_POWER off'.");
+
+            Dim::SendCommandNB("AGILENT_CONTROL_80V/SET_POWER", uint8_t(0));
+            Error("Sending 'AGILENT_CONTROL_80V/SET_POWER off'.");
         }
 
@@ -575,5 +606,7 @@
 public:
     ConnectionFSC(ba::io_service& ioservice, MessageImp &imp) : Connection(ioservice, imp()),
-        fIsVerbose(false), fIsAutoReconnect(false), fTempMin(0), fTempMax(65535), fReconnectTimeout(ioservice)
+        fIsVerbose(false), fIsAutoReconnect(false), 
+        fTempMin(0), fTempMax(65535), fTempExceeded55(0),
+        fReconnectTimeout(ioservice)
     {
         SetLogStream(&imp);
