Add check for faultFound to power fault checks
The faultFound flag was added in an earlier series of commits. This was
intended to limit the number of faults leading up to error log entries.
During the checks for when the system is powered on, a number of the
faults (OC, OV, OT, etc.) can ultimately lead to other faults,
especially the UNIT_IS_OFF fault. For instance, if an overcurrent fault
is detected, it likely means that the power supply will turn itself off.
When that fault is seen and logged, the faultFound will be set to true.
If that is the case, we do not need to also log a fault for the PGOOD
being off or the UNIT_IS_OFF bit being on, we already know a fault has
occurred. The metadata should capture the resulting end state.
Change-Id: I27ea7e77d492597a3581026285c7e552a1297a60
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/power-supply/power_supply.cpp b/power-supply/power_supply.cpp
index 1dcf462..f6f658a 100644
--- a/power-supply/power_supply.cpp
+++ b/power-supply/power_supply.cpp
@@ -328,7 +328,7 @@
}
}
- if (powerOnFault >= FAULT_COUNT)
+ if (!faultFound && (powerOnFault >= FAULT_COUNT))
{
faultFound = true;
@@ -372,7 +372,7 @@
}
}
- if (outputOCFault >= FAULT_COUNT)
+ if (!faultFound && (outputOCFault >= FAULT_COUNT))
{
util::NamesValues nv;
nv.add("STATUS_WORD", statusWord);
@@ -413,7 +413,7 @@
}
}
- if (outputOVFault >= FAULT_COUNT)
+ if (!faultFound && (outputOVFault >= FAULT_COUNT))
{
util::NamesValues nv;
nv.add("STATUS_WORD", statusWord);
@@ -454,7 +454,7 @@
}
}
- if (fanFault >= FAULT_COUNT)
+ if (!faultFound && (fanFault >= FAULT_COUNT))
{
util::NamesValues nv;
nv.add("STATUS_WORD", statusWord);
@@ -500,7 +500,7 @@
}
}
- if (temperatureFault >= FAULT_COUNT)
+ if (!faultFound && (temperatureFault >= FAULT_COUNT))
{
// The power supply has had an over-temperature condition.
// This may not result in a shutdown if experienced for a short