aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components
diff options
context:
space:
mode:
authorghost <andreas.monzner@multimedia-labs.de>2010-03-24 11:29:50 +0100
committerghost <andreas.monzner@multimedia-labs.de>2010-03-24 11:31:10 +0100
commit4d01a8b971e7631cf999d4773891cce657b9aa27 (patch)
tree1df95b176c459bc7bd596389275933a6023b20cc /lib/python/Components
parent57127cfed5dcb8b1da632e7d24b0c42224671ff1 (diff)
downloadenigma2-4d01a8b971e7631cf999d4773891cce657b9aa27.tar.gz
enigma2-4d01a8b971e7631cf999d4773891cce657b9aa27.zip
add possibility to separately set fan voltage and fan pwm for standby and normal run
when a recording starts in standby switch to normal mode and vice versa this fixes bug #430 (thx to Dr.Best)
Diffstat (limited to 'lib/python/Components')
-rw-r--r--lib/python/Components/FanControl.py43
1 files changed, 36 insertions, 7 deletions
diff --git a/lib/python/Components/FanControl.py b/lib/python/Components/FanControl.py
index cee0523e..a993c396 100644
--- a/lib/python/Components/FanControl.py
+++ b/lib/python/Components/FanControl.py
@@ -3,6 +3,9 @@ import os
from Components.config import config, ConfigSubList, ConfigSubsection, ConfigSlider
from Tools.BoundFunction import boundFunction
+import NavigationInstance
+from enigma import iRecordableService
+
class FanControl:
# ATM there's only support for one fan
def __init__(self):
@@ -13,18 +16,42 @@ class FanControl:
self.createConfig()
config.misc.standbyCounter.addNotifier(self.standbyCounterChanged, initial_call = False)
- def leaveStandby(self):
+ def setVoltage_PWM(self):
for fanid in range(self.getFanCount()):
cfg = self.getConfig(fanid)
self.setVoltage(fanid, cfg.vlt.value)
self.setPWM(fanid, cfg.pwm.value)
+ print "[FanControl]: setting fan values: fanid = %d, voltage = %d, pwm = %d" % (fanid, cfg.vlt.value, cfg.pwm.value)
+
+ def setVoltage_PWM_Standby(self):
+ for fanid in range(self.getFanCount()):
+ cfg = self.getConfig(fanid)
+ self.setVoltage(fanid, cfg.vlt_standby.value)
+ self.setPWM(fanid, cfg.pwm_standby.value)
+ print "[FanControl]: setting fan values (standby mode): fanid = %d, voltage = %d, pwm = %d" % (fanid, cfg.vlt_standby.value, cfg.pwm_standby.value)
+
+ def getRecordEvent(self, recservice, event):
+ recordings = len(NavigationInstance.instance.getRecordings())
+ if event == iRecordableService.evEnd:
+ if recordings == 0:
+ self.setVoltage_PWM_Standby()
+ elif event == iRecordableService.evStart:
+ if recordings == 1:
+ self.setVoltage_PWM()
+
+ def leaveStandby(self):
+ NavigationInstance.instance.record_event.remove(self.getRecordEvent)
+ recordings = NavigationInstance.instance.getRecordings()
+ if not recordings:
+ self.setVoltage_PWM()
def standbyCounterChanged(self, configElement):
from Screens.Standby import inStandby
inStandby.onClose.append(self.leaveStandby)
- for fanid in range(self.getFanCount()):
- self.setVoltage(fanid, 0)
- self.setPWM(fanid, 0)
+ recordings = NavigationInstance.instance.getRecordings()
+ NavigationInstance.instance.record_event.append(self.getRecordEvent)
+ if not recordings:
+ self.setVoltage_PWM_Standby()
def createConfig(self):
def setVlt(fancontrol, fanid, configElement):
@@ -35,12 +62,14 @@ class FanControl:
config.fans = ConfigSubList()
for fanid in range(self.getFanCount()):
fan = ConfigSubsection()
- fan.vlt = ConfigSlider(default = 16, increment = 5, limits = (0, 255))
+ fan.vlt = ConfigSlider(default = 15, increment = 5, limits = (0, 255))
fan.pwm = ConfigSlider(default = 0, increment = 5, limits = (0, 255))
+ fan.vlt_standby = ConfigSlider(default = 5, increment = 5, limits = (0, 255))
+ fan.pwm_standby = ConfigSlider(default = 0, increment = 5, limits = (0, 255))
fan.vlt.addNotifier(boundFunction(setVlt, self, fanid))
fan.pwm.addNotifier(boundFunction(setPWM, self, fanid))
config.fans.append(fan)
-
+
def getConfig(self, fanid):
return config.fans[fanid]
@@ -85,4 +114,4 @@ class FanControl:
f.write("%x" % value)
f.close()
-fancontrol = FanControl() \ No newline at end of file
+fancontrol = FanControl()