Refresh sensor functional state

During the monitoring loop, the associated fault file of a sensor is
read and its functional status is updated prior to reading the sensor's
input file.

Tested:
    The functional property is updated according to its fault file

Resolves: openbmc/openbmc#2329

Change-Id: Icc28e914df79c6681d45e92a5ea4054704ad8efd
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/mainloop.cpp b/mainloop.cpp
index 9944e09..11b182e 100644
--- a/mainloop.cpp
+++ b/mainloop.cpp
@@ -532,9 +532,15 @@
                 auto it = obj.find(InterfaceType::STATUS);
                 if (it != obj.end())
                 {
+                    auto fault = ioAccess.read(
+                            i.first.first,
+                            i.first.second,
+                            hwmon::entry::fault,
+                            hwmonio::retries,
+                            hwmonio::delay);
                     auto statusIface = std::experimental::any_cast<
                             std::shared_ptr<StatusObject>>(it->second);
-                    if (!statusIface->functional())
+                    if (!statusIface->functional((fault == 0) ? true : false))
                     {
                         continue;
                     }