[dbus-passive] Add threshold fan failure
When a threshold is crossed for a monitored sensor,
assert fan failure.
Tested-by: Changed a sensor threshold so that its current
reading made the threshold asserted and noticed via print
messages that the sensor went into failure state. Also
noticed fans ramp. Wrote unit test to verify sensor can
move in and out of error state correctly.
Change-Id: I83182536e4874eaba97f3f1d48d53ac110fba833
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/pid/zone.cpp b/pid/zone.cpp
index d5e2646..35abb13 100644
--- a/pid/zone.cpp
+++ b/pid/zone.cpp
@@ -251,10 +251,14 @@
_cachedValuesByName[t] = r.value;
tstamp then = r.updated;
+ if (sensor->getFailed())
+ {
+ _failSafeSensors.insert(t);
+ }
/* Only go into failsafe if the timeout is set for
* the sensor.
*/
- if (timeout > 0)
+ else if (timeout > 0)
{
auto duration =
duration_cast<std::chrono::seconds>(now - then).count();