From 710b3ea19993c9fc15e38a57101494eb962c606c Mon Sep 17 00:00:00 2001 From: thedoc Date: Thu, 10 Dec 2009 14:52:36 +0100 Subject: support up to 8 fan/temp sensors --- .../Plugins/SystemPlugins/TempFanControl/plugin.py | 96 ++++++++++++++++++++-- 1 file changed, 87 insertions(+), 9 deletions(-) (limited to 'lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py') diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py index 60af03cb..b5762529 100644 --- a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py +++ b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py @@ -1,6 +1,7 @@ from Components.ActionMap import ActionMap from Components.Sensors import sensors from Components.Sources.Sensor import SensorSource +from Components.Sources.StaticText import StaticText from Components.ConfigList import ConfigListScreen from Components.config import getConfigListEntry @@ -13,10 +14,70 @@ class TempFanControl(Screen, ConfigListScreen): skin = """ - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -25,15 +86,32 @@ class TempFanControl(Screen, ConfigListScreen): def __init__(self, session, args = None): Screen.__init__(self, session) - id = sensors.getSensorsList(sensors.TYPE_TEMPERATURE)[0] - self["SensorTemp"] = SensorSource(sensorid = id) - id = sensors.getSensorsList(sensors.TYPE_FAN_RPM)[0] - self["SensorFan"] = SensorSource(sensorid = id, update_interval = 100) + templist = sensors.getSensorsList(sensors.TYPE_TEMPERATURE) + tempcount = len(templist) + fanlist = sensors.getSensorsList(sensors.TYPE_FAN_RPM) + fancount = len(fanlist) + + for count in range(8): + if count < tempcount: + id = templist[count] + self["SensorTempText%d" % count] = StaticText(sensors.getSensorName(id)) + self["SensorTemp%d" % count] = SensorSource(sensorid = id) + else: + self["SensorTempText%d" % count] = StaticText("") + self["SensorTemp%d" % count] = SensorSource() + + if count < fancount: + id = fanlist[count] + self["SensorFanText%d" % count] = StaticText(sensors.getSensorName(id)) + self["SensorFan%d" % count] = SensorSource(sensorid = id) + else: + self["SensorFanText%d" % count] = StaticText("") + self["SensorFan%d" % count] = SensorSource() self.list = [] - if fancontrol.getFanCount() > 0: - self.list.append(getConfigListEntry(_("Fan Voltage"), fancontrol.getConfig(0).vlt)) - self.list.append(getConfigListEntry(_("Fan PWM"), fancontrol.getConfig(0).pwm)) + for count in range(fancontrol.getFanCount()): + self.list.append(getConfigListEntry(_("Fan %d Voltage") % (count + 1), fancontrol.getConfig(count).vlt)) + self.list.append(getConfigListEntry(_("Fan %d PWM") % (count + 1), fancontrol.getConfig(count).pwm)) ConfigListScreen.__init__(self, self.list, session = self.session) #self["config"].list = self.list #self["config"].setList(self.list) -- cgit v1.2.3