Fix threshold checks

With the previous code, if the alarm was already set and the value was
still above the threshold, then the statement
    if (!alarmHigh && value >= threshold->high() || alarmHigh)

would pass due to the '|| alarmHigh' but the code inside that block
would then think the alarm should deassert.  This commit adds code to
also check if the value is below the high threshold if the alarmHigh is
set, and does a similar check for the alarmLow section.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I673de7154959133d48c524b85a680e7d523aa6a5
diff --git a/virtualSensor.hpp b/virtualSensor.hpp
index 62042d8..4553024 100644
--- a/virtualSensor.hpp
+++ b/virtualSensor.hpp
@@ -132,7 +132,8 @@
         static constexpr auto tname = T::element_type::name;
 
         auto alarmHigh = threshold->alarmHigh();
-        if ((!alarmHigh && value >= threshold->high()) || alarmHigh)
+        if ((!alarmHigh && value >= threshold->high()) ||
+            (alarmHigh && value < threshold->high()))
         {
             if (!alarmHigh)
             {
@@ -150,7 +151,8 @@
         }
 
         auto alarmLow = threshold->alarmLow();
-        if ((!alarmLow && value <= threshold->low()) || alarmLow)
+        if ((!alarmLow && value <= threshold->low()) ||
+            (alarmLow && value > threshold->low()))
         {
             if (!alarmLow)
             {