Implement de-glitch for read failures
If three consecutive read failures in a row occur, one second apart,
create and log an error.
Change-Id: Iaed04c307de2419c614b7916a99dd36a6aa2c106
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/power-supply/power_supply.hpp b/power-supply/power_supply.hpp
index 2723bfe..b1ac71a 100644
--- a/power-supply/power_supply.hpp
+++ b/power-supply/power_supply.hpp
@@ -153,6 +153,14 @@
/** @brief Used to subscribe to D-Bus power on state changes */
std::unique_ptr<sdbusplus::bus::match_t> powerOnMatch;
+ /** @brief Indicates that a read failure has occurred.
+ *
+ * @details This will be incremented each time a read failure is
+ * encountered. If it is incremented to FAULT_COUNT, an error
+ * will be logged.
+ */
+ size_t readFail = 0;
+
/** @brief Has a PMBus read failure already been logged? */
bool readFailLogged = false;