Index: /trunk/FACT++/src/smartfact.cc
===================================================================
--- /trunk/FACT++/src/smartfact.cc	(revision 17059)
+++ /trunk/FACT++/src/smartfact.cc	(revision 17060)
@@ -1711,7 +1711,4 @@
         out << d.GetJavaDate() << '\n';
         out << HTML::kWhite << '\t' << fFscControlHumidityAvg << '\n';
-        out << HTML::kWhite << '\t' << min      << '\n';
-        out << HTML::kWhite << '\t' << avg      << '\n';
-        out << HTML::kWhite << '\t' << max      << '\n';
         out << HTML::kWhite << '\t' << stat.min << '\n';
         out << HTML::kWhite << '\t' << stat.avg << '\n';
@@ -1722,4 +1719,81 @@
         WriteHist(d, "hist-fsccontrol-temperature",
                   fFscControlTemperatureHist, 10);
+
+        out.str("");
+        out << setprecision(3);
+        out << d.GetJavaDate() << '\n';
+        out << HTML::kWhite << '\t' << max << '\n';
+        out << HTML::kWhite << '\t' << avg << '\n';
+        out << HTML::kWhite << '\t' << min << '\n';
+
+        ofstream(fPath+"/camtemp.data") << out.str();
+
+        // =======================================================
+
+        struct weight
+        {
+            int idx;
+            int i[3];
+            double w[3];
+        };
+
+        static vector<weight> fWeights;
+        if (fWeights.empty())
+        {
+            ifstream fin("temp-interpolator.txt");
+            int cnt = 0;
+            while (1)
+            {
+                weight w;
+                fin >> w.idx;
+                fin >> w.i[0];
+                fin >> w.i[1];
+                fin >> w.i[2];
+                fin >> w.w[0];
+                fin >> w.w[1];
+                fin >> w.w[2];
+                if (!fin)
+                    break;
+
+                if (w.idx != cnt++)
+                {
+                    Fatal("Reading interpolator failed ("+to_string(w.idx)+"|"+to_string(cnt)+")");
+                    fWeights.clear();
+                    break;
+                }
+
+                fWeights.emplace_back(w);
+            }
+
+            if (fWeights.size() && fWeights.size() != 160)
+            {
+                Fatal("Reading interpolator failed ("+to_string(fWeights.size())+")");
+                fWeights.clear();
+            }
+        }
+
+        if (fWeights.size()==160)
+        {
+            vector<float> temp(160);
+            vector<float> cpy(ptr, ptr+31);
+
+            cpy[8]  = (cpy[4] +cpy[6] +cpy[7] +cpy[10]+cpy[11])/5;
+            cpy[19] = (cpy[7] +cpy[11]+cpy[16]+cpy[17]+cpy[21])/5;
+            cpy[15] = (cpy[14]+cpy[16]+cpy[18])/3;
+
+            double pavg = 0;
+            for (int i=0; i<160; i++)
+            {
+                const double T =
+                    fWeights[i].w[0]*cpy[fWeights[i].i[0]]+
+                    fWeights[i].w[1]*cpy[fWeights[i].i[1]]+
+                    fWeights[i].w[2]*cpy[fWeights[i].i[2]];
+
+                temp[i] = T;
+                pavg += T;
+            }
+
+            WriteCam(d, "cam-fsccontrol-temperature", temp, 3, pavg/160-1.5);
+        }
 
         return GetCurrentState();
