Only setup set speed events when not init mode

Change-Id: Ia6987295a3eb4e23b9d6ae13a383e440386572de
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/main.cpp b/control/main.cpp
index be5b59e..413a419 100644
--- a/control/main.cpp
+++ b/control/main.cpp
@@ -30,15 +30,15 @@
         exit(-1);
     }
 
-    Manager::Mode mode;
+    Mode mode;
 
     if (args["init"] == "true")
     {
-        mode = Manager::Mode::init;
+        mode = Mode::init;
     }
     else if (args["control"] == "true")
     {
-        mode = Manager::Mode::control;
+        mode = Mode::control;
     }
     else
     {
@@ -49,7 +49,7 @@
     Manager manager(bus, mode);
 
     //Init mode will just set fans to max and delay
-    if (mode == Manager::Mode::init)
+    if (mode == Mode::init)
     {
         manager.doInit();
         return 0;
diff --git a/control/manager.cpp b/control/manager.cpp
index 6c773a7..de9074c 100644
--- a/control/manager.cpp
+++ b/control/manager.cpp
@@ -59,7 +59,7 @@
             for (auto& z : zones)
             {
                 _zones.emplace(std::get<zoneNumPos>(z),
-                               std::make_unique<Zone>(_bus, z));
+                               std::make_unique<Zone>(mode, _bus, z));
             }
 
             break;
diff --git a/control/manager.hpp b/control/manager.hpp
index 675dfb8..521b4cd 100644
--- a/control/manager.hpp
+++ b/control/manager.hpp
@@ -23,17 +23,6 @@
 {
     public:
 
-        /**
-         * The mode the manager will run in:
-         *   - init - only do the initialization steps
-         *   - control - run normal control algorithms
-         */
-        enum class Mode
-        {
-            init,
-            control
-        };
-
         Manager() = delete;
         Manager(const Manager&) = delete;
         Manager(Manager&&) = default;
diff --git a/control/zone.cpp b/control/zone.cpp
index 3a35b24..18fd627 100644
--- a/control/zone.cpp
+++ b/control/zone.cpp
@@ -23,7 +23,8 @@
 {
 
 
-Zone::Zone(sdbusplus::bus::bus& bus,
+Zone::Zone(Mode mode,
+           sdbusplus::bus::bus& bus,
            const ZoneDefinition& def) :
     _bus(bus),
     _fullSpeed(std::get<fullSpeedPos>(def)),
@@ -36,23 +37,29 @@
         _fans.emplace_back(std::make_unique<Fan>(bus, def));
     }
 
-    // Setup signal trigger for set speed events
-    for (auto& event : std::get<setSpeedEventsPos>(def))
+    // Do not enable set speed events when in init mode
+    if (mode != Mode::init)
     {
-        for (auto& prop : std::get<propChangeListPos>(event))
+        // Setup signal trigger for set speed events
+        for (auto& event : std::get<setSpeedEventsPos>(def))
         {
-            _signalEvents.emplace_back(
-                std::make_unique<SignalEvent>(this,
-                                              EventData
-                                              {
-                                                  std::get<groupPos>(event),
-                                                  std::get<handlerObjPos>(prop),
-                                                  std::get<actionPos>(event)
-                                              }));
-            _matches.emplace_back(bus,
-                                  std::get<signaturePos>(prop).c_str(),
-                                  signalHandler,
-                                  _signalEvents.back().get());
+            for (auto& prop : std::get<propChangeListPos>(event))
+            {
+                _signalEvents.emplace_back(
+                        std::make_unique<SignalEvent>(
+                                this,
+                                EventData
+                                {
+                                    std::get<groupPos>(event),
+                                    std::get<handlerObjPos>(prop),
+                                    std::get<actionPos>(event)
+                                }));
+                _matches.emplace_back(
+                        bus,
+                        std::get<signaturePos>(prop).c_str(),
+                        signalHandler,
+                        _signalEvents.back().get());
+            }
         }
     }
 }
diff --git a/control/zone.hpp b/control/zone.hpp
index d8f3fe4..1a4e173 100644
--- a/control/zone.hpp
+++ b/control/zone.hpp
@@ -13,6 +13,17 @@
 {
 
 /**
+ * The mode fan control will run in:
+ *   - init - only do the initialization steps
+ *   - control - run normal control algorithms
+ */
+enum class Mode
+{
+    init,
+    control
+};
+
+/**
  * @class Represents a fan control zone, which is a group of fans
  * that behave the same.
  */
@@ -32,10 +43,12 @@
          * Creates the appropriate fan objects based on
          * the zone definition data passed in.
          *
+         * @param[in] mode - mode of fan control
          * @param[in] bus - the dbus object
          * @param[in] def - the fan zone definition data
          */
-        Zone(sdbusplus::bus::bus& bus,
+        Zone(Mode mode,
+             sdbusplus::bus::bus& bus,
              const ZoneDefinition& def);
 
         /**