Index: /trunk/FACT++/src/smartfact.cc
===================================================================
--- /trunk/FACT++/src/smartfact.cc	(revision 13935)
+++ /trunk/FACT++/src/smartfact.cc	(revision 13936)
@@ -25,4 +25,5 @@
 #include "HeadersMCP.h"
 #include "HeadersDrive.h"
+#include "HeadersFeedback.h"
 #include "HeadersRateScan.h"
 #include "HeadersRateControl.h"
@@ -355,4 +356,5 @@
     vector<float> fBiasControlVoltageVec;
 
+    float  fBiasControlPowerTot;
     float  fBiasControlVoltageMed;
     float  fBiasControlCurrentMed;
@@ -367,4 +369,5 @@
     string fDriveControlPointingAz;
     string fDriveControlSourceName;
+    float  fDriveControlMoonDist;
 
     deque<float> fDriveControlTrackingDevHist;
@@ -564,5 +567,5 @@
         if (!CheckDataSize(d, "Mcp:Configuration", 16, true))
         {
-            fMcpConfigurationState     = -256;
+            fMcpConfigurationState     = 0;
             fMcpConfigurationMaxTime   = 0;
             fMcpConfigurationMaxEvents = 0;
@@ -771,4 +774,6 @@
         out << kHtmlWhite << '\t' << dev << '\n';
 
+        fDriveControlMoonDist = -1;
+
         Moon moon(-(17.+53./60+26.525/3600), 28.+45./60+42.462/3600);
         if (moon.visible)
@@ -777,9 +782,11 @@
 
             string col = kHtmlGreen;
-            if (angle<35 || angle>145)
+            if (angle<20 || angle>140)
                 col = kHtmlYellow;
-            if (angle<25 || angle>155)
+            if (angle<10 || angle>150)
                 col = kHtmlRed;
             out << col << '\t' << setprecision(3) << angle << '\n';
+
+            fDriveControlMoonDist = angle;
         }
         else
@@ -954,4 +961,6 @@
         if (power_apd<1e-3)
             power_apd = 0;
+
+        fBiasControlPowerTot = power_tot;
 
         // Get the maximum of each patch
@@ -1569,6 +1578,12 @@
             msg << "dimctrl offline<br/>";
 
+        if (fDriveControlMoonDist>155)
+            msg << "Moon within the field-of-view of the cones<br/>";
+        if (fDriveControlMoonDist>=0 && fDriveControlMoonDist<3)
+            msg << "Moon within the field-of-view of the camera<br/>";
+
+
         if (!fDimFeedback.state()==Feedback::State::kCalibrating &&
-            fDimBias.state()==BIAS::State::kVoltageOn &&
+            fDimBiasControl.state()==BIAS::State::kVoltageOn &&
             fBiasControlVoltageMed>3 &&
             fFeedbackCalibration.size()==0)
@@ -1638,15 +1653,21 @@
                 switch (fMcpConfigurationState)
                 {
-                // kStateIdle
-                case  5: out << "Idle [" << fMcpConfigurationName << "]"; break;
-                // Configuring1 - Configuring3
-                case  7:
-                case  8:
-                case  9: out << "Configuring [" << fMcpConfigurationName << "]"; break;
-                // Configured
-                case 10: out << "Configured [" << fMcpConfigurationName << "]"; break;
-                // TriggerOn / Taking Data
-                case 11: 
-                case 12: out << fMcpConfigurationName; break;
+                case MCP::State::kIdle:
+                    out << "Idle [" << fMcpConfigurationName << "]";
+                    break;
+                case MCP::State::kConfiguring1:
+                case MCP::State::kConfiguring2:
+                case MCP::State::kConfiguring3:
+                    out << "Configuring [" << fMcpConfigurationName << "]";
+                    break;
+                case MCP::State::kConfigured:
+                    out << "Configured [" << fMcpConfigurationName << "]";
+                    break;
+                case MCP::State::kTriggerOn:
+                case MCP::State::kTakingData:
+                    out << fMcpConfigurationName;
+                    if (fFadControlDrsRuns[2]>0)
+                        out << "(" << fFadControlDrsRuns[2] << ")";
+                    break;
                 }
             }
@@ -1673,5 +1694,10 @@
                 {
                     if (fMcpConfigurationState==MCP::State::kTakingData)
-                        evt << fFadControlNumEvents;
+                    {
+                        if (fFadControlNumEvents>2999)
+                            evt << floor(fFadControlNumEvents/1000) << 'k';
+                        else
+                            evt << fFadControlNumEvents;
+                    }
                 }
 
@@ -1707,7 +1733,4 @@
                     out << ']';
             }
-
-            if (fFadControlDrsRuns[2]>0)
-                out << " (" << fFadControlDrsRuns[2] << ")";
         }
         else
@@ -1736,14 +1759,14 @@
             //out << rc.name << '\t';
             out << fDriveControlPointingZd  << '\t';
+            out << setprecision(2);
             out << fDriveControlPointingAz  << '\t';
             if (fDimDriveControl.state()==7)
             {
                 out << fDriveControlSourceName  << '\t';
-                out << setprecision(2);
                 out << dev << '\n';
-                out << setprecision(3);
             }
             else
                 out << "\t\n";
+            out << setprecision(3);
         }
         else
@@ -1796,5 +1819,6 @@
                 col = kHtmlRed;
 
-            out << col << '\t' << fFtmControlTriggerRateCam << '\n';
+            out << col << '\t' << fFtmControlTriggerRateCam << '\t';
+            out << fFtmPatchThresholdMed << '\n';
         }
         else
@@ -1853,5 +1877,9 @@
                 out << setprecision(3);
             }
-            out << (off ? 0 : fBiasControlVoltageMed) << '\n';
+            if (cal && fDimFeedback.state()!=Feedback::State::kCalibrating)
+                out << setprecision(2) << fBiasControlPowerTot << " W" << setprecision(3);
+            else
+                out << (off ? 0 : fBiasControlVoltageMed);
+            out << '\n';
         }
         else
@@ -1902,4 +1930,5 @@
         fPath("www/smartfact/data"),
         fControlScriptDepth(0),
+        fMcpConfigurationState(-256),
         fMcpConfigurationMaxTime(0),
         fMcpConfigurationMaxEvents(0),
