Set tach sensor to functional on start

With the addition of a functional state for each fan rotor tach sensor,
these should be set to functional on each power on. This is done during
fan monitor init mode when no monitor is done and then again once
monitoring mode begins.

Change-Id: I3c73c1be5f912c7cee8499f47cc799ac3c20983b
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/monitor/fan.cpp b/monitor/fan.cpp
index 9d2593f..b1aa233 100644
--- a/monitor/fan.cpp
+++ b/monitor/fan.cpp
@@ -40,34 +40,36 @@
     _numSensorFailsForNonFunc(std::get<numSensorFailsForNonfuncField>(def)),
     _trustManager(trust)
 {
+    // Setup tach sensors for monitoring
+    auto& sensors = std::get<sensorListField>(def);
+    for (auto& s : sensors)
+    {
+        try
+        {
+            _sensors.emplace_back(
+                    std::make_unique<TachSensor>(
+                            mode,
+                            bus,
+                            *this,
+                            std::get<sensorNameField>(s),
+                            std::get<hasTargetField>(s),
+                            std::get<timeoutField>(def),
+                            events));
+
+            _trustManager->registerSensor(_sensors.back());
+        }
+        catch (InvalidSensorError& e)
+        {
+
+        }
+    }
+
     //Start from a known state of functional
     updateInventory(true);
 
-    // Setup tach sensors for monitoring when in monitor mode
+    // Check current tach state when entering monitor mode
     if (mode != Mode::init)
     {
-        auto& sensors = std::get<sensorListField>(def);
-        for (auto& s : sensors)
-        {
-            try
-            {
-                _sensors.emplace_back(
-                        std::make_unique<TachSensor>(
-                                bus,
-                                *this,
-                                std::get<sensorNameField>(s),
-                                std::get<hasTargetField>(s),
-                                std::get<timeoutField>(def),
-                                events));
-
-                _trustManager->registerSensor(_sensors.back());
-            }
-            catch (InvalidSensorError& e)
-            {
-
-            }
-        }
-
         //The TachSensors will now have already read the input
         //and target values, so check them.
         tachChanged();