Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skeleton: Add dbus objects for adm1278 hwmon sensors #57

Merged
merged 1 commit into from
May 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions bin/Barreleye.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,5 +717,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