Add in a delay before setting present to true
When a power supply is inserted, allow for a time delay before starting
the fault checks. This will give the individual servicing a power supply
some time to insert the supply and then apply power.
Change-Id: Ic957be927cea26a6c011a0a634f84093e040b454
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/power-supply/power_supply.cpp b/power-supply/power_supply.cpp
index e611315..bc76050 100644
--- a/power-supply/power_supply.cpp
+++ b/power-supply/power_supply.cpp
@@ -45,9 +45,15 @@
const std::string& invpath,
sdbusplus::bus::bus& bus,
event::Event& e,
- std::chrono::seconds& t)
+ std::chrono::seconds& t,
+ std::chrono::seconds& p)
: Device(name, inst), monitorPath(objpath), pmbusIntf(objpath),
- inventoryPath(invpath), bus(bus), event(e), powerOnInterval(t),
+ inventoryPath(invpath), bus(bus), event(e), presentInterval(p),
+ presentTimer(e, [this]()
+ {
+ this->present = true;
+ }),
+ powerOnInterval(t),
powerOnTimer(e, [this]()
{
this->powerOn = true;
@@ -156,6 +162,11 @@
if (present)
{
clearFaults();
+ presentTimer.start(presentInterval, Timer::TimerType::oneshot);
+ }
+ else
+ {
+ presentTimer.stop();
}
}