X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/c06f79c0451ca844f89809058a2767a1a319b137..59e42503e34758a946ebee1a1405fecb8fe7236d:/lib/python/Components/RFmod.py diff --git a/lib/python/Components/RFmod.py b/lib/python/Components/RFmod.py index 98571819..a8f7c9f5 100644 --- a/lib/python/Components/RFmod.py +++ b/lib/python/Components/RFmod.py @@ -1,16 +1,21 @@ -from config import * -from enigma import * +from config import config, ConfigSelection, ConfigSubsection, ConfigOnOff, ConfigSlider +from enigma import eRFmod +from Components.SystemInfo import SystemInfo + +# CHECK ME. +RFMOD_CHANNEL_MIN = 21 +RFMOD_CHANNEL_MAX = 69 + 1 class RFmod: def __init__(self): pass def setFunction(self, value): - eRFmod.getInstance().setFunction(value) + eRFmod.getInstance().setFunction(not value) def setTestmode(self, value): eRFmod.getInstance().setTestmode(value) def setSoundFunction(self, value): - eRFmod.getInstance().setSoundFunction(value) + eRFmod.getInstance().setSoundFunction(not value) def setSoundCarrier(self, value): eRFmod.getInstance().setSoundCarrier(value) def setChannel(self, value): @@ -19,34 +24,36 @@ class RFmod: eRFmod.getInstance().setFinetune(value) def InitRFmod(): + detected = eRFmod.getInstance().detected() + SystemInfo["RfModulator"] = detected + if detected: + config.rfmod = ConfigSubsection() + config.rfmod.enable = ConfigOnOff(default=False) + config.rfmod.test = ConfigOnOff(default=False) + config.rfmod.sound = ConfigOnOff(default=True) + config.rfmod.soundcarrier = ConfigSelection(choices=[("4500","4.5 MHz"), ("5500", "5.5 MHz"), ("6000", "6.0 MHz"), ("6500", "6.5 MHz")], default="5500") + config.rfmod.channel = ConfigSelection(default = "36", choices = ["%d" % x for x in range(RFMOD_CHANNEL_MIN, RFMOD_CHANNEL_MAX)]) + config.rfmod.finetune = ConfigSlider(default=5, limits=(1, 10)) - config.rfmod = ConfigSubsection(); - config.rfmod.enable = configElement("config.rfmod.enable", configSelection, 1, (("enable", _("Enable")), ("disable", _("Disable"))) ); - config.rfmod.test = configElement("config.rfmod.test", configSelection, 1, (("enable", _("Enable")), ("disable", _("Disable"))) ); - config.rfmod.sound = configElement("config.rfmod.sound", configSelection, 0, (("enable", _("Enable")), ("disable", _("Disable"))) ); - config.rfmod.soundcarrier = configElement("config.rfmod.soundcarrier", configSelection, 1, ("4.5 MHz", "5.5 MHz", "6.0 MHz", "6.5 MHz") ); - config.rfmod.channel = configElement("config.rfmod.channel", configSelection, 6, ("30", "31", "32", "33", "34", "35", "36", "37", "38", "39") ); - config.rfmod.finetune = configElement("config.rfmod.finetune", ConfigSlider, 5, ""); - - iRFmod = RFmod() + iRFmod = RFmod() - def setFunction(configElement): - iRFmod.setFunction(configElement.value); - def setTestmode(configElement): - iRFmod.setTestmode(configElement.value); - def setSoundFunction(configElement): - iRFmod.setSoundFunction(configElement.value); - def setSoundCarrier(configElement): - iRFmod.setSoundCarrier(configElement.value); - def setChannel(configElement): - iRFmod.setChannel(configElement.value + 30); - def setFinetune(configElement): - iRFmod.setFinetune(configElement.value - 5); + def setFunction(configElement): + iRFmod.setFunction(configElement.value); + def setTestmode(configElement): + iRFmod.setTestmode(configElement.value); + def setSoundFunction(configElement): + iRFmod.setSoundFunction(configElement.value); + def setSoundCarrier(configElement): + iRFmod.setSoundCarrier(configElement.index); + def setChannel(configElement): + iRFmod.setChannel(int(configElement.value)); + def setFinetune(configElement): + iRFmod.setFinetune(configElement.value - 5); - # this will call the "setup-val" initial - config.rfmod.enable.addNotifier(setFunction); - config.rfmod.test.addNotifier(setTestmode); - config.rfmod.sound.addNotifier(setSoundFunction); - config.rfmod.soundcarrier.addNotifier(setSoundCarrier); - config.rfmod.channel.addNotifier(setChannel); - config.rfmod.finetune.addNotifier(setFinetune); + # this will call the "setup-val" initial + config.rfmod.enable.addNotifier(setFunction); + config.rfmod.test.addNotifier(setTestmode); + config.rfmod.sound.addNotifier(setSoundFunction); + config.rfmod.soundcarrier.addNotifier(setSoundCarrier); + config.rfmod.channel.addNotifier(setChannel); + config.rfmod.finetune.addNotifier(setFinetune);