Lines Matching +full:sensor +full:- +full:gain

3 #include "sensor.hpp"
11 #include <phosphor-logging/elog-errors.hpp>
13 #include <xyz/openbmc_project/Sensor/Device/error.hpp>
24 namespace sensor namespace
31 Sensor::Sensor(const SensorSet::key_type& sensor, in Sensor() argument
34 _sensor(sensor), _ioAccess(ioAccess), _devPath(devPath), _scale(0), in Sensor()
37 auto chip = env::getEnv("GPIOCHIP", sensor); in Sensor()
38 auto access = env::getEnv("GPIO", sensor); in Sensor()
50 auto gain = env::getEnv("GAIN", sensor); in Sensor() local
51 if (!gain.empty()) in Sensor()
53 _sensorAdjusts.gain = std::stod(gain); in Sensor()
56 auto offset = env::getEnv("OFFSET", sensor); in Sensor()
61 auto senRmRCs = env::getEnv("REMOVERCS", sensor); in Sensor()
62 // Add sensor removal return codes defined per sensor in Sensor()
66 void Sensor::addRemoveRCs(const std::string& rcList) in addRemoveRCs()
86 log<level::INFO>("Unable to convert sensor removal return code", in addRemoveRCs()
87 entry("SENSOR=%s", name.c_str()), in addRemoveRCs()
95 SensorValueType Sensor::adjustValue(SensorValueType value) in adjustValue()
107 // Adjust based on gain and offset in adjustValue()
109 static_cast<double>(value) * _sensorAdjusts.gain + in adjustValue()
120 std::shared_ptr<ValueObject> Sensor::addValue( in addValue()
137 if (statusIface->functional()) in addValue()
162 val = _ioAccess->read( in addValue()
175 statusIface->functional(false); in addValue()
186 iface->unit(hwmon::getUnit(attrs)); in addValue()
192 iface->value(val); in addValue()
197 iface->maxValue(std::stoll(maxValue)); in addValue()
202 iface->minValue(std::stoll(minValue)); in addValue()
209 std::shared_ptr<StatusObject> Sensor::addStatus(ObjectInfo& info) in addStatus()
224 sysfs::make_sysfs_path(_ioAccess->path(), faultName, faultID, entry); in addStatus()
230 uint32_t fault = _ioAccess->read(faultName, faultID, entry, in addStatus()
239 using namespace sdbusplus::xyz::openbmc_project::Sensor::Device:: in addStatus()
241 using metadata = xyz::openbmc_project::Sensor::Device::ReadFailure; in addStatus()
258 iface->functional(functional); in addStatus()
265 std::shared_ptr<AccuracyObject> Sensor::addAccuracy(ObjectInfo& info, in addAccuracy()
275 iface->accuracy(accuracy); in addAccuracy()
281 std::shared_ptr<PriorityObject> Sensor::addPriority(ObjectInfo& info, in addPriority()
291 iface->priority(priority); in addPriority()
299 handle->setValues({0}); in gpioLock()
309 handle->setValues({1}); in gpioUnlock()
319 const std::string& type, const std::string& id, const std::string& sensor, in asyncRead() argument
329 // If sensor not found in timedoutMap, spawn an async thread in asyncRead()
332 ioAccess, type, id, sensor, retries, delay); in asyncRead()
338 // sensor has already timed out in the previous reads. No need to wait in asyncRead()
339 // on subsequent reads - proceed to check the future_status to see when in asyncRead()
342 asyncThread = std::move(asyncIter->second); in asyncRead()
348 // sensor value in asyncRead()
357 // Good sensor reads should skip the code below in asyncRead()
362 // as the sensor reading may be bad / corrupted if it took so long. in asyncRead()
378 } // namespace sensor