Lines Matching +full:high +full:- +full:threshold
11 #include <phosphor-logging/lg2.hpp>
48 return Direction::HIGH; in findThresholdDirection()
59 std::vector<thresholds::Threshold>& thresholdVector, in parseThresholdsFromConfig()
75 if (std::visit(VariantToStringVisitor(), labelFind->second) != in parseThresholdsFromConfig()
93 (std::visit(VariantToIntVisitor(), indexFind->second) != in parseThresholdsFromConfig()
105 std::visit(VariantToDoubleVisitor(), hysteresisFind->second); in parseThresholdsFromConfig()
115 "Malformed threshold on configuration interface: '{INTERFACE}'", in parseThresholdsFromConfig()
120 std::visit(VariantToUnsignedIntVisitor(), severityFind->second); in parseThresholdsFromConfig()
123 std::visit(VariantToStringVisitor(), directionFind->second); in parseThresholdsFromConfig()
132 double val = std::visit(VariantToDoubleVisitor(), valueFind->second); in parseThresholdsFromConfig()
140 const thresholds::Threshold& threshold, in persistThreshold() argument
148 conn->async_method_call( in persistThreshold()
149 [&, path, threshold, thresholdInterface, in persistThreshold()
154 return; // threshold not supported in persistThreshold()
162 lg2::error("No label in threshold configuration"); in persistThreshold()
166 std::visit(VariantToStringVisitor(), labelFind->second); in persistThreshold()
179 lg2::error("Malformed threshold in configuration"); in persistThreshold()
183 VariantToUnsignedIntVisitor(), severityFind->second); in persistThreshold()
186 std::visit(VariantToStringVisitor(), directionFind->second); in persistThreshold()
187 if ((findThresholdLevel(severity) != threshold.level) || in persistThreshold()
188 (findThresholdDirection(dir) != threshold.direction)) in persistThreshold()
193 std::variant<double> value(threshold.value); in persistThreshold()
194 conn->async_method_call( in persistThreshold()
199 "Error setting threshold: '{ERROR_MESSAGE}'", in persistThreshold()
213 for (const auto& threshold : sensor->thresholds) in updateThresholds() local
216 sensor->getThresholdInterface(threshold.level); in updateThresholds()
224 Sensor::propertyLevel(threshold.level, threshold.direction); in updateThresholds()
229 interface->set_property(property, threshold.value); in updateThresholds()
245 ChangeParam(Threshold whichThreshold, bool status, double value) : in ChangeParam()
246 threshold(whichThreshold), asserted(status), assertValue(value) in ChangeParam()
249 Threshold threshold; member
257 if (sensor->thresholds.empty()) in checkThresholds()
262 for (auto& threshold : sensor->thresholds) in checkThresholds() local
264 // Use "Schmitt trigger" logic to avoid threshold trigger spam, in checkThresholds()
265 // if value is noisy while hovering very close to a threshold. in checkThresholds()
266 // When a threshold is crossed, indicate true immediately, in checkThresholds()
269 if (threshold.direction == thresholds::Direction::HIGH) in checkThresholds()
271 if (value >= threshold.value) in checkThresholds()
273 thresholdChanges.emplace_back(threshold, true, value); in checkThresholds()
277 "Sensor name: {NAME}, high threshold: {THRESHOLD}, " in checkThresholds()
279 "NAME", sensor->name, "THRESHOLD", threshold.value, in checkThresholds()
280 "VALUE", value, "RAW_DATA", sensor->rawValue); in checkThresholds()
283 else if (value < (threshold.value - threshold.hysteresis)) in checkThresholds()
285 thresholdChanges.emplace_back(threshold, false, value); in checkThresholds()
293 else if (threshold.direction == thresholds::Direction::LOW) in checkThresholds()
295 if (value <= threshold.value) in checkThresholds()
297 thresholdChanges.emplace_back(threshold, true, value); in checkThresholds()
301 "Sensor name: {NAME}, low threshold: {THRESHOLD}, " in checkThresholds()
303 "NAME", sensor->name, "THRESHOLD", threshold.value, in checkThresholds()
304 "VALUE", value, "RAW_DATA", sensor->rawValue); in checkThresholds()
307 else if (value > (threshold.value + threshold.hysteresis)) in checkThresholds()
309 thresholdChanges.emplace_back(threshold, false, value); in checkThresholds()
319 lg2::error("Error determining threshold direction"); in checkThresholds()
330 lg2::error("checkThresholds: High T= {HIGH_TRUE}, F= {HIGH_FALSE}," in checkThresholds()
343 const Threshold& threshold, bool assert, in startTimer() argument
363 pair->first.used = true; in startTimer()
364 pair->first.level = threshold.level; in startTimer()
365 pair->first.direction = threshold.direction; in startTimer()
366 pair->first.assert = assert; in startTimer()
367 pair->second.expires_after(std::chrono::seconds(waitTime)); in startTimer()
368 pair->second.async_wait([weakSensor, pair, threshold, assert, in startTimer()
376 pair->first.used = false; in startTimer()
388 if (sensorPtr->readingStateGood()) in startTimer()
390 assertThresholds(sensorPtr.get(), assertValue, threshold.level, in startTimer()
391 threshold.direction, assert); in startTimer()
399 std::vector<ChangeParam> changes = checkThresholds(sensor, sensor->value); in checkThresholds()
402 assertThresholds(sensor, change.assertValue, change.threshold.level, in checkThresholds()
403 change.threshold.direction, change.asserted); in checkThresholds()
404 if (change.threshold.level == thresholds::Level::CRITICAL && in checkThresholds()
424 std::vector<ChangeParam> changes = checkThresholds(sensor, sensor->value); in checkThresholdsPowerDelay()
431 // 2. conditional delay the de-assertion of low events if there is in checkThresholdsPowerDelay()
433 // 3. no delays for de-assert of low events if there is an existing in checkThresholdsPowerDelay()
434 // de-assert for low event. This means 2nd de-assert would happen in checkThresholdsPowerDelay()
437 // 4. no delays for all high events. in checkThresholdsPowerDelay()
438 if (change.threshold.direction == thresholds::Direction::LOW) in checkThresholdsPowerDelay()
441 change.threshold, !change.asserted)) in checkThresholdsPowerDelay()
443 thresholdTimer.startTimer(weakSensor, change.threshold, in checkThresholdsPowerDelay()
448 assertThresholds(sensor, change.assertValue, change.threshold.level, in checkThresholdsPowerDelay()
449 change.threshold.direction, change.asserted); in checkThresholdsPowerDelay()
458 sensor->getThresholdInterface(level); in assertThresholds()
472 if (interface->set_property<bool, true>(property, assert)) in assertThresholds()
476 // msg.get_path() is interface->get_object_path() in assertThresholds()
478 interface->new_signal("ThresholdAsserted"); in assertThresholds()
480 msg.append(sensor->name, interface->get_interface_name(), property, in assertThresholds()
493 std::vector<thresholds::Threshold>& thresholdVector, in parseThresholdsFromAttr()
505 std::make_tuple("average_max", Level::WARNING, Direction::HIGH, in parseThresholdsFromAttr()
511 std::make_tuple("max", Level::WARNING, Direction::HIGH, 0.0), in parseThresholdsFromAttr()
513 std::make_tuple("crit", Level::CRITICAL, Direction::HIGH, in parseThresholdsFromAttr()
533 lg2::info("Threshold: '{PATH}': '{VALUE}'", "PATH", in parseThresholdsFromAttr()
551 return std::string("xyz.openbmc_project.Sensor.Threshold.") + in getInterface()