Permalink
Browse files

ScreenPosition is 7025 specific, and added FanControl plugin (8000 sp…

…ecific)
  • Loading branch information...
1 parent e0f0549 commit f99fcf018a332363e52ec936e378817758a54a58 @pieterg pieterg committed Oct 10, 2009
View
@@ -1,3 +1,3 @@
AUTOMAKE_OPTIONS = gnu
-SUBDIRS = PLi
+SUBDIRS = PLi UPnP SystemPlugins
View
@@ -1 +1,5 @@
-SUBDIRS = PPanel SoftcamSetup NFSServer Bitrate NewsReader RemoteControlChannel UShare ScreenPosition StreamInterface SnmpAgent
+if DM7025
+BOXSPECIFIC = ScreenPosition
+endif
+
+SUBDIRS = PPanel SoftcamSetup NFSServer Bitrate NewsReader RemoteControlChannel StreamInterface SnmpAgent $(BOXSPECIFIC)
@@ -0,0 +1,46 @@
+from Components.Converter.Converter import Converter
+from Components.Element import cached
+
+class FanInfo(Converter, object):
+ RPM = 0
+ VLT = 1
+ PWM = 2
+
+ def __init__(self, type):
+ Converter.__init__(self, type)
+ if type == "RPM":
+ self.type = self.RPM
+ elif type == "VLT":
+ self.type = self.VLT
+ else :
+ self.type = self.PWM
+ @cached
+ def getText(self):
+ if self.type == self.RPM:
+ return "%d" % self.source.rpm
+ elif self.type == self.VLT:
+ return "%d" % self.source.vlt
+ else:
+ return "%d" % self.source.pwm
+
+
+ @cached
+ def getBool(self):
+ return False
+
+ text = property(getText)
+
+ boolean = property(getBool)
+
+ @cached
+ def getValue(self):
+ if self.type == self.RPM:
+ return int((self.source.rpm * 255)/5500)
+ elif self.type == self.VLT:
+ return self.source.vlt
+ else:
+ return self.source.pwm
+
+ range = 255
+ value = property(getValue)
+
@@ -0,0 +1,5 @@
+installdir = $(LIBDIR)/enigma2/python/Components/Converter
+
+install_PYTHON = \
+ FanInfo.py \
+ TemperatureInfo.py
@@ -0,0 +1,47 @@
+from Components.Converter.Converter import Converter
+from Components.Element import cached
+
+class TemperatureInfo(Converter, object):
+
+ def __init__(self, type):
+ Converter.__init__(self, type)
+ if type == "SENSOR_1":
+ self.type = 0
+ elif type == "SENSOR_2":
+ self.type = 1
+ elif type == "SENSOR_3":
+ self.type = 2
+ elif type == "SENSOR_4":
+ self.type = 3
+ elif type == "SENSOR_5":
+ self.type = 4
+ elif type == "SENSOR_6":
+ self.type = 5
+ elif type == "SENSOR_7":
+ self.type = 6
+ elif type == "SENSOR_8":
+ self.type = 7
+ else:
+ self.type = 7
+ @cached
+ def getText(self):
+ self.source.current = self.type
+ return "%d" % self.source.current
+
+
+ @cached
+ def getBool(self):
+ return False
+
+ text = property(getText)
+
+ boolean = property(getBool)
+
+ @cached
+ def getValue(self):
+ self.source.current = self.type
+ return int((self.source.current * 255)/70)
+
+ range = 255
+ value = property(getValue)
+
@@ -0,0 +1,12 @@
+This plugin is licensed under the Creative Commons
+Attribution-NonCommercial-ShareAlike 3.0 Unported
+License. To view a copy of this license, visit
+http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative
+Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
+
+Alternatively, this plugin may be distributed and executed on hardware which
+is licensed by Dream Multimedia GmbH.
+
+This plugin is NOT free software. It is open source, you are allowed to
+modify it (if you keep the license), but it may not be commercially
+distributed other than under the conditions noted above.
@@ -0,0 +1,9 @@
+installdir = $(LIBDIR)/enigma2/python/Plugins/SystemPlugins/FanMonitor
+
+install_PYTHON = \
+ __init__.py \
+ plugin.py
+
+install_DATA = LICENSE
+
+SUBDIRS = data Sources Converters
@@ -0,0 +1,88 @@
+from Source import Source
+from enigma import eTimer
+
+class FanStatus(Source):
+ def __init__(self,update_interval = 1000):
+ Source.__init__(self)
+ self.update_interval = update_interval
+ self.fan_timer = eTimer()
+ self.fan_timer.callback.append(self.updateFanStatus)
+ self.fan_timer.start(update_interval, True)
+ self.rps_flt_coef_dest = 64.0
+ self.rps_flt_coef = 1.0
+ self.rps = float(open("/proc/stb/fp/fan_speed").read().split(' ')[0])/60.0
+ self.rps_old = 0.0
+ self.rps_flt = self.rps_flt_coef * self.rps
+ self.current_rps = 0
+
+ def inc_flt(self):
+ delta =abs(self.rps - self.rps_old)
+ delta2 = abs(self.current_rps - self.rps)
+ print "delta", delta
+ print "delta2", delta2
+ if delta != 0:
+ print "1/delta", 1/delta
+ else:
+ print "1/delta unendlich"
+ treshold_1 = (1.0/(2.0*self.rps_flt_coef))
+ treshold_2 = (2.0/self.rps_flt_coef)
+ print "treshold_1", treshold_1
+ print "treshold_2", treshold_2
+
+
+ if delta > treshold_2 or delta2 > 1 :
+ if self.rps_flt_coef > 1:
+ if delta2 > 2:
+ self.rps_flt = self.current_rps
+ self.rps_flt_coef = 1
+ else:
+ self.rps_flt = self.rps_flt / 2
+ self.rps_flt_coef = self.rps_flt_coef / 2
+ if self.rps_flt_coef < 1:
+ self.rps_flt_coef = 1
+ elif delta <= treshold_1:
+ if self.rps_flt_coef < self.rps_flt_coef_dest:
+ self.rps_flt = self.rps_flt * 2
+ self.rps_flt_coef = self.rps_flt_coef * 2
+
+ def updateFanStatus(self):
+ self.current_rps = float(open("/proc/stb/fp/fan_speed").read().split(' ')[0])/60 #
+ print "curr_rps:", self.current_rps
+ print "rps:", self.rps
+ print "coef:",self.rps_flt_coef
+
+ self.inc_flt()
+ self.rps_flt = float(self.rps_flt) - (float(self.rps_flt) / float(self.rps_flt_coef)) + self.current_rps
+ self.changed((self.CHANGED_ALL, ))
+ self.fan_timer.start(self.update_interval, True)
+ self.rps_old = self.rps
+ self.rps = (self.rps_flt / self.rps_flt_coef)
+
+ def doSuspend(self, suspended):
+ if suspended:
+ self.fan_timer.stop()
+ else:
+ self.fan_timer.start(self.update_interval)
+
+ def getRPM(self):
+ return int(self.rps*60)
+
+ def getVLT(self):
+ return int(open("/proc/stb/fp/fan_vlt").read().split(' ')[0],16)
+
+ def getPWM(self):
+ return int(open("/proc/stb/fp/fan_pwm").read().split(' ')[0],16)
+
+ def setVLT(self,output):
+ open("/proc/stb/fp/fan_vlt", "w").write("%x" % output)
+
+ def setPWM(self,output):
+ open("/proc/stb/fp/fan_pwm", "w").write("%x" % output)
+
+ rpm = property(getRPM)
+ vlt = property(getVLT,setVLT)
+ pwm = property(getPWM,setPWM)
+
+ def destroy(self):
+ self.fan_timer.callback.remove(self.updateFanStatus)
+ Source.destroy(self)
@@ -0,0 +1,5 @@
+installdir = $(LIBDIR)/enigma2/python/Components/Sources
+
+install_PYTHON = \
+ FanStatus.py \
+ TemperatureStatus.py
@@ -0,0 +1,36 @@
+from Source import Source
+from enigma import eTimer
+
+class TemperatureStatus(Source):
+ def __init__(self,update_interval = 1000):
+ Source.__init__(self)
+ self.update_interval = update_interval
+ self.temp_timer = eTimer()
+ self.temp_timer.callback.append(self.updateTemperatureStatus)
+ self.temp_timer.start(update_interval, True)
+
+ def updateTemperatureStatus(self):
+ self.changed((self.CHANGED_ALL, ))
+ self.temp_timer.start(self.update_interval, True)
+
+ def doSuspend(self, suspended):
+ if suspended:
+ self.temp_timer.stop()
+ else:
+ self.temp_timer.start(self.update_interval)
+
+ def readTemp(self):
+ t = int(open("/proc/stb/fp/temp%d"%self.index).read()) / 256.0 * 3.3
+ t = 4.246e1 * t + 7.362e-1
+ return t
+ def setIndex(self,index):
+ if (index < 0) or (index > 7):
+ self.index = 0
+ else:
+ self.index = index
+
+ current = property(readTemp,setIndex)
+
+ def destroy(self):
+ self.temp_timer.callback.remove(self.updateTemperatureStatus)
+ Source.destroy(self)
File renamed without changes.
@@ -0,0 +1,4 @@
+installdir = /usr/share/enigma2/skin_default
+
+install_DATA = \
+ v_temp_bar.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.

0 comments on commit f99fcf0

Please sign in to comment.