From 8cc8b9fe8b68cfec89accc94edc719adc82a06cd Mon Sep 17 00:00:00 2001 From: "Evgeny Alekseev (IBS Group)" Date: Fri, 14 Oct 2022 15:23:46 +0300 Subject: IBS:Fix SILABMC-338 thresholds in ADC sensors --- ...4-Fix-PowerState-on-thresholds-going-high.patch | 61 ++++++++++++++++++++++ .../sensors/dbus-sensors_%.bbappend | 1 + 2 files changed, 62 insertions(+) create mode 100644 meta-ibs/meta-common/recipes-phosphor/sensors/dbus-sensors/0004-Fix-PowerState-on-thresholds-going-high.patch diff --git a/meta-ibs/meta-common/recipes-phosphor/sensors/dbus-sensors/0004-Fix-PowerState-on-thresholds-going-high.patch b/meta-ibs/meta-common/recipes-phosphor/sensors/dbus-sensors/0004-Fix-PowerState-on-thresholds-going-high.patch new file mode 100644 index 0000000000..586b0a4279 --- /dev/null +++ b/meta-ibs/meta-common/recipes-phosphor/sensors/dbus-sensors/0004-Fix-PowerState-on-thresholds-going-high.patch @@ -0,0 +1,61 @@ +From 2b9306de104f53a4d8540d33d6d912682957611f Mon Sep 17 00:00:00 2001 +From: "Evgeny Alekseev (IBS Group)" +Date: Fri, 14 Oct 2022 14:41:48 +0300 +Subject: [PATCH] Fix PowerState::on thresholds going high + +--- + src/ADCSensor.cpp | 5 +++++ + src/Thresholds.cpp | 2 +- + src/Utils.cpp | 3 ++- + 3 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/src/ADCSensor.cpp b/src/ADCSensor.cpp +index 4d47762..05e6438 100644 +--- a/src/ADCSensor.cpp ++++ b/src/ADCSensor.cpp +@@ -230,6 +230,11 @@ void ADCSensor::checkThresholds(void) + { + if (!readingStateGood()) + { ++ for(auto th : thresholds) ++ { ++ if(th.direction == thresholds::Direction::LOW) ++ thresholdTimer.stopTimer(th, true); ++ } + return; + } + +diff --git a/src/Thresholds.cpp b/src/Thresholds.cpp +index 9bc8098..3880cb8 100644 +--- a/src/Thresholds.cpp ++++ b/src/Thresholds.cpp +@@ -326,7 +326,7 @@ void ThresholdTimer::startTimer(const std::weak_ptr& weakSensor, + double assertValue) + { + struct TimerUsed timerUsed = {}; +- constexpr const size_t waitTime = 5; ++ constexpr const size_t waitTime = 10; + TimerPair* pair = nullptr; + + for (TimerPair& timer : timers) +diff --git a/src/Utils.cpp b/src/Utils.cpp +index 7dc40c4..785b7be 100644 +--- a/src/Utils.cpp ++++ b/src/Utils.cpp +@@ -418,6 +418,7 @@ void setupPowerMatchCallback( + auto findState = values.find(power::property); + if (findState != values.end()) + { ++ powerStatusOn = false; + bool on = + std::get(findState->second).ends_with(".Running"); + if (!on) +@@ -428,7 +429,7 @@ void setupPowerMatchCallback( + return; + } + // on comes too quickly +- timer.expires_after(std::chrono::seconds(10)); ++ timer.expires_after(std::chrono::seconds(20)); + timer.async_wait( + [hostStatusCallback](boost::system::error_code ec) { + if (ec == boost::asio::error::operation_aborted) diff --git a/meta-ibs/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend b/meta-ibs/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend index acdc527780..33bb62f76d 100644 --- a/meta-ibs/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend +++ b/meta-ibs/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend @@ -2,5 +2,6 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" SRC_URI += "file://0002-PSU-Remove-Error-Reset-On-Read-Failure.patch \ file://0003-Add-temp-high-thresholds.patch \ + file://0004-Fix-PowerState-on-thresholds-going-high.patch \ " -- cgit v1.2.3