summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/sensor-example.yaml5
-rw-r--r--scripts/writesensor.mako.cpp5
2 files changed, 8 insertions, 2 deletions
diff --git a/scripts/sensor-example.yaml b/scripts/sensor-example.yaml
index db0e694..06c8836 100755
--- a/scripts/sensor-example.yaml
+++ b/scripts/sensor-example.yaml
@@ -100,6 +100,11 @@
multiplierM: 511
offsetB: 0
bExp: 0
+ # Result exponent field in Type 1 SDR(2's complement, signed)
+ rExp: 0
+ # Applies for analog sensors, the actual reading value for the sensor is
+ # Value * 10^N
+ scale: -3
mutability: Mutability::Write|Mutability::Read
serviceInterface: org.freedesktop.DBus.Properties
readingType: readingData
diff --git a/scripts/writesensor.mako.cpp b/scripts/writesensor.mako.cpp
index 4644ff7..a59e149 100644
--- a/scripts/writesensor.mako.cpp
+++ b/scripts/writesensor.mako.cpp
@@ -45,6 +45,7 @@ extern const IdInfoMap sensors = {
multiplier = sensor.get("multiplierM", 1)
offsetB = sensor.get("offsetB", 0)
exp = sensor.get("bExp", 0)
+ rExp = sensor.get("rExp", 0)
unit = sensor.get("unit", "")
scale = sensor.get("scale", 0)
hasScale = "true" if "scale" in sensor.keys() else "false"
@@ -68,8 +69,8 @@ extern const IdInfoMap sensors = {
mutability = sensor.get("mutability", "Mutability::Read")
%>
${entityID},${instance},${sensorType},"${path}","${sensorInterface}",
- ${readingType},${multiplier}, ${offsetB},${exp},
- ${offsetB * pow(10,exp)}, ${hasScale},${scale},"${unit}",
+ ${readingType},${multiplier},${offsetB},${exp},
+ ${offsetB * pow(10,exp)}, ${rExp}, ${hasScale},${scale},"${unit}",
${updateFunc},${getFunc},Mutability(${mutability}),${sensorNameFunc},{
% for interface,properties in interfaces.items():
{"${interface}",{
OpenPOWER on IntegriCloud