Skip to content

Commit

Permalink
Merge pull request #57 from adamliyi/adm1278
Browse files Browse the repository at this point in the history
skeleton: Add dbus objects for adm1278 hwmon sensors
  • Loading branch information
nkskjames committed May 11, 2016
2 parents 2640096 + a8260c8 commit a7bf0ef
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
22 changes: 22 additions & 0 deletions bin/Barreleye.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,5 +716,27 @@ def convertGpio(name):
'101' : { 'object_path' : 'temperature/membuf7','poll_interval' : 5000,'scale' : 1000,'units' : 'C' },
}
},
'4-0010' : {
'names' : {
# Barreleye uses 0.25 millioohms sense resistor for adm1278
# To convert Iout register value Y to real-world value X, use an equation:
# X= 1/m * (Y * 10^-R - b), here m = 800 * R_sense, and R_sense is expressed in milliohms.
# The adm1278 driver did the conversion, but the R_sense is set here as a scale factor.
'curr1_input' : { 'object_path' : 'HSCA/Iout','poll_interval' : 5000,'scale' : 0.25,'units' : 'mA' },
'in2_input' : { 'object_path' : 'HSCA/Vout','poll_interval' : 5000,'scale' : 1,'units' : 'mV' },
}
},
'5-0010' : {
'names' : {
'curr1_input' : { 'object_path' : 'HSCB/Iout','poll_interval' : 5000,'scale' : 0.25,'units' : 'mA' },
'in2_input' : { 'object_path' : 'HSCB/Vout','poll_interval' : 5000,'scale' : 1,'units' : 'mV' },
}
},
'6-0010' : {
'names' : {
'curr1_input' : { 'object_path' : 'HSCC/Iout','poll_interval' : 5000,'scale' : 0.25,'units' : 'mA' },
'in2_input' : { 'object_path' : 'HSCC/Vout','poll_interval' : 5000,'scale' : 1,'units' : 'mV' },
}
},
}

3 changes: 2 additions & 1 deletion bin/Sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ def setByPoll(self,value):
val = (self.properties[SensorValue.IFACE_NAME]['value']-offset) * scale
return [True,val]
else:
val = (value/scale) + offset
# Keep the val as integer. scale may be floating point
val = int(value/scale + offset)
if (val != self.value):
SensorValue.setValue(self,val)
self.check_thresholds(val)
Expand Down

0 comments on commit a7bf0ef

Please sign in to comment.