Implement de-glitch for input fault
If three consecutive reads in a row, on second apart, show the
INPUT_FAULT_WARN and/or VIN_UV_FAULT on, create and log an error.
Resolves: openbmc/openbmc#2484
Change-Id: I35dedfc6acbb68bd8004c4fd1cc3d6dc799a9a17
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/power-supply/power_supply.hpp b/power-supply/power_supply.hpp
index b1ac71a..7a5f1b5 100644
--- a/power-supply/power_supply.hpp
+++ b/power-supply/power_supply.hpp
@@ -165,12 +165,14 @@
bool readFailLogged = false;
/**
- * @brief Set to true when an input fault or warning is detected
+ * @brief Indicates an input fault or warning if equal to FAULT_COUNT.
*
- * This is the "INPUT FAULT OR WARNING" bit in the high byte from the
- * STATUS_WORD command response.
+ * @details This is the "INPUT FAULT OR WARNING" bit in the high byte,
+ * or the VIN_UV_FAULT bit in the low byte in the STATUS_WORD
+ * command response. If either of those bits are on, this will
+ * be incremented.
*/
- bool inputFault = false;
+ size_t inputFault = 0;
/**
* @brief Indicates output over current fault if equal to FAULT_COUNT