X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/624cd1811f54808d23a50840bb35494e4e5ca3b6..09eaa1b41d5b74464ad83eda66be50689247074f:/lib/python/Components/Renderer/FrontpanelLed.py diff --git a/lib/python/Components/Renderer/FrontpanelLed.py b/lib/python/Components/Renderer/FrontpanelLed.py index dcb9cd2f..f896ecde 100644 --- a/lib/python/Components/Renderer/FrontpanelLed.py +++ b/lib/python/Components/Renderer/FrontpanelLed.py @@ -2,25 +2,31 @@ from Components.Element import Element # this is not a GUI renderer. class FrontpanelLed(Element): + def __init__(self, which = 0, patterns = [(20, 0, 0xffffffff),(20, 0x55555555, 0x84fc8c04)], boolean = True): + self.which = which + self.boolean = boolean + self.patterns = patterns + Element.__init__(self) + def changed(self, *args, **kwargs): - if self.source.value or 1: - pattern = 0x55555555 - pattern_4bit = 0x84fc8c04 - speed = 20 + if self.boolean: + val = self.source.boolean and 0 or 1 else: - pattern = 0 - pattern_4bit = 0xffffffff - speed = 1 + val = self.source.value + + (speed, pattern, pattern_4bit) = self.patterns[val] try: - open("/proc/stb/fp/led0_pattern", "w").write("%08x" % pattern) - except IOError: - pass - try: - open("/proc/stb/fp/led_pattern", "w").write("%08x" % pattern_4bit) - except IOError: - pass - try: - open("/proc/stb/fp/led_pattern_speed", "w").write("%d" % speed) + open("/proc/stb/fp/led%d_pattern" % self.which, "w").write("%08x" % pattern) except IOError: pass + if self.which == 0: + try: + open("/proc/stb/fp/led_set_pattern", "w").write("%08x" % pattern_4bit) + open("/proc/stb/fp/led_set_speed", "w").write("%d" % speed) + except IOError: + pass + try: + open("/proc/stb/fp/led_pattern_speed", "w").write("%d" % speed) + except IOError: + pass