Move sensor adjust within sensor object
All sensor adjustments should be contained within the sensor object for
the sensor. This allows the adjustments to be retrieved for a given
sensor and applied accordingly.
Tested:
No change in adjusting a sensor value
No change in removing a sensor given a removal return code
Change-Id: I5e1e40fe41b4064422a47178aec1f297b781566d
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/sensor.cpp b/sensor.cpp
index 155b8bd..6191688 100644
--- a/sensor.cpp
+++ b/sensor.cpp
@@ -23,6 +23,20 @@
ioAccess(ioAccess),
devPath(devPath)
{
+ auto gain = env::getEnv("GAIN", sensor);
+ if (!gain.empty())
+ {
+ sensorAdjusts.gain = std::stod(gain);
+ }
+
+ auto offset = env::getEnv("OFFSET", sensor);
+ if (!offset.empty())
+ {
+ sensorAdjusts.offset = std::stoi(offset);
+ }
+ auto senRmRCs = env::getEnv("REMOVERCS", sensor);
+ // Add sensor removal return codes defined per sensor
+ addRemoveRCs(senRmRCs);
}
void Sensor::addRemoveRCs(const std::string& rcList)
@@ -172,7 +186,6 @@
}
catch (const std::system_error& e)
{
- using namespace phosphor::logging;
using namespace sdbusplus::xyz::openbmc_project::
Sensor::Device::Error;
using metadata = xyz::openbmc_project::Sensor::