Merge VIN_UV_FAULT check with the inputFault
Since VIN_UV_FAULT is for input voltage, and the desired behavior was to
"treat as OR condition if either asserts", this change is removing the
variable used to track VIN_UV_FAULT, and adding the condition check to
the path that sets inputFault.
Change-Id: Id4451753f6d627a62588b0d2211614174f83abb0
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/power-supply/power_supply.cpp b/power-supply/power_supply.cpp
index b61d7e5..668ef18 100644
--- a/power-supply/power_supply.cpp
+++ b/power-supply/power_supply.cpp
@@ -119,7 +119,7 @@
checkInputFault(statusWord);
- if (powerOn && !vinUVFault && !inputFault)
+ if (powerOn && !inputFault)
{
checkFanFault(statusWord);
checkTemperatureFault(statusWord);
@@ -244,32 +244,8 @@
std::uint8_t statusInput = 0;
- if ((statusWord & status_word::VIN_UV_FAULT) && !vinUVFault)
- {
- vinUVFault = true;
-
- util::NamesValues nv;
- nv.add("STATUS_WORD", statusWord);
-
- using metadata = org::open_power::Witherspoon::Fault::
- PowerSupplyUnderVoltageFault;
-
- report<PowerSupplyUnderVoltageFault>(
- metadata::RAW_STATUS(nv.get().c_str()),
- metadata::CALLOUT_INVENTORY_PATH(inventoryPath.c_str()));
- }
- else
- {
- if (vinUVFault)
- {
- vinUVFault = false;
- log<level::INFO>("VIN_UV_FAULT cleared",
- entry("POWERSUPPLY=%s",
- inventoryPath.c_str()));
- }
- }
-
- if ((statusWord & status_word::INPUT_FAULT_WARN) && !inputFault)
+ if (!inputFault && ((statusWord & status_word::INPUT_FAULT_WARN) ||
+ (statusWord & status_word::VIN_UV_FAULT)))
{
inputFault = true;
@@ -287,7 +263,8 @@
else
{
if ((inputFault) &&
- !(statusWord & status_word::INPUT_FAULT_WARN))
+ !(statusWord & status_word::INPUT_FAULT_WARN) &&
+ !(statusWord & status_word::VIN_UV_FAULT))
{
inputFault = false;
statusInput = pmbusIntf.read(STATUS_INPUT, Type::Debug);
@@ -471,7 +448,6 @@
void PowerSupply::clearFaults()
{
readFailLogged = false;
- vinUVFault = false;
inputFault = false;
powerOnFault = 0;
outputOCFault = false;