From 2dbd18117bf8519ea700c7f87424eaa2e5a794fa Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 25 Nov 2008 21:15:42 +0100 Subject: add possibility to always switch to 13V before do sec commands --- lib/python/Components/NimManager.py | 42 ++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 15 deletions(-) (limited to 'lib/python/Components/NimManager.py') diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index f4e91083..edd3bbbb 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -39,7 +39,7 @@ class SecConfigure: sec.addSatellite(orbpos) self.configuredSatellites.add(orbpos) - def addLNBSimple(self, sec, slotid, diseqcmode, toneburstmode = diseqcParam.NO, diseqcpos = diseqcParam.SENDNO, orbpos = 0, longitude = 0, latitude = 0, loDirection = 0, laDirection = 0, turningSpeed = rotorParam.FAST, useInputPower=True, inputPowerDelta=50, fastDiSEqC = False, setVoltageTone = True): + def addLNBSimple(self, sec, slotid, diseqcmode, toneburstmode = diseqcParam.NO, diseqcpos = diseqcParam.SENDNO, orbpos = 0, longitude = 0, latitude = 0, loDirection = 0, laDirection = 0, turningSpeed = rotorParam.FAST, useInputPower=True, inputPowerDelta=50, fastDiSEqC = False, setVoltageTone = True, diseqc13V = False): if orbpos is None or orbpos == 3601: return #simple defaults @@ -70,7 +70,10 @@ class SecConfigure: if 0 <= diseqcmode < 3: self.addSatellite(sec, orbpos) if setVoltageTone: - sec.setVoltageMode(switchParam.HV) + if diseqc13V: + sec.setVoltageMode(switchParam.HV_13) + else: + sec.setVoltageMode(switchParam.HV) sec.setToneMode(switchParam.HILO) else: sec.setVoltageMode(switchParam._14V) @@ -90,7 +93,10 @@ class SecConfigure: for x in self.NimManager.satList: print "Add sat " + str(x[0]) self.addSatellite(sec, int(x[0])) - sec.setVoltageMode(switchParam.HV) + if diseqc13V: + sec.setVoltageMode(switchParam.HV_13) + else: + sec.setVoltageMode(switchParam.HV) sec.setToneMode(switchParam.HILO) sec.setRotorPosNum(0) # USALS @@ -172,24 +178,24 @@ class SecConfigure: print "diseqcmode: ", nim.diseqcMode.value if nim.diseqcMode.value == "single": #single if nim.simpleSingleSendDiSEqC.value: - self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcA.orbital_position, toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AA) + self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcA.orbital_position, toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AA, diseqc13V = nim.diseqc13V.value) else: - self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcA.orbital_position, toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.NONE, diseqcpos = diseqcParam.SENDNO) + self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcA.orbital_position, toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.NONE, diseqcpos = diseqcParam.SENDNO, diseqc13V = nim.diseqc13V.value) elif nim.diseqcMode.value == "toneburst_a_b": #Toneburst A/B - self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcA.orbital_position, toneburstmode = diseqcParam.A, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.SENDNO) - self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcB.orbital_position, toneburstmode = diseqcParam.B, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.SENDNO) + self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcA.orbital_position, toneburstmode = diseqcParam.A, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.SENDNO, diseqc13V = nim.diseqc13V.value) + self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcB.orbital_position, toneburstmode = diseqcParam.B, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.SENDNO, diseqc13V = nim.diseqc13V.value) elif nim.diseqcMode.value == "diseqc_a_b": #DiSEqC A/B fastDiSEqC = nim.simpleDiSEqCOnlyOnSatChange.value setVoltageTone = nim.simpleDiSEqCSetVoltageTone.value - self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcA.orbital_position, toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AA, fastDiSEqC = fastDiSEqC, setVoltageTone = setVoltageTone) - self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcB.orbital_position, toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AB, fastDiSEqC = fastDiSEqC, setVoltageTone = setVoltageTone) + self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcA.orbital_position, toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AA, fastDiSEqC = fastDiSEqC, setVoltageTone = setVoltageTone, diseqc13V = nim.diseqc13V.value) + self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcB.orbital_position, toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AB, fastDiSEqC = fastDiSEqC, setVoltageTone = setVoltageTone, diseqc13V = nim.diseqc13V.value) elif nim.diseqcMode.value == "diseqc_a_b_c_d": #DiSEqC A/B/C/D fastDiSEqC = nim.simpleDiSEqCOnlyOnSatChange.value setVoltageTone = nim.simpleDiSEqCSetVoltageTone.value - self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcA.orbital_position, toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AA, fastDiSEqC = fastDiSEqC, setVoltageTone = setVoltageTone) - self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcB.orbital_position, toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AB, fastDiSEqC = fastDiSEqC, setVoltageTone = setVoltageTone) - self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcC.orbital_position, toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.BA, fastDiSEqC = fastDiSEqC, setVoltageTone = setVoltageTone) - self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcD.orbital_position, toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.BB, fastDiSEqC = fastDiSEqC, setVoltageTone = setVoltageTone) + self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcA.orbital_position, toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AA, fastDiSEqC = fastDiSEqC, setVoltageTone = setVoltageTone, diseqc13V = nim.diseqc13V.value) + self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcB.orbital_position, toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AB, fastDiSEqC = fastDiSEqC, setVoltageTone = setVoltageTone, diseqc13V = nim.diseqc13V.value) + self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcC.orbital_position, toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.BA, fastDiSEqC = fastDiSEqC, setVoltageTone = setVoltageTone, diseqc13V = nim.diseqc13V.value) + self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcD.orbital_position, toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.BB, fastDiSEqC = fastDiSEqC, setVoltageTone = setVoltageTone, diseqc13V = nim.diseqc13V.value) elif nim.diseqcMode.value == "positioner": #Positioner if nim.latitudeOrientation.value == "north": laValue = rotorParam.NORTH @@ -219,7 +225,8 @@ class SecConfigure: laDirection = laValue, turningSpeed = turning_speed, useInputPower = useInputPower, - inputPowerDelta = inputPowerDelta) + inputPowerDelta = inputPowerDelta, + diseqc13V = nim.diseqc13V.value) elif nim.configMode.value == "advanced": #advanced config self.updateAdvanced(sec, x) print "sec config completed" @@ -383,7 +390,10 @@ class SecConfigure: satpos = y currSat = config.Nims[slotid].advanced.sat[satpos] if currSat.voltage.value == "polarization": - sec.setVoltageMode(switchParam.HV) + if config.Nims[slotid].diseqc13V.value: + sec.setVoltageMode(switchParam.HV_13) + else: + sec.setVoltageMode(switchParam.HV) elif currSat.voltage.value == "13V": sec.setVoltageMode(switchParam._14V) elif currSat.voltage.value == "18V": @@ -902,6 +912,8 @@ def InitNimManager(nimmgr): # nim.configMode.value = "simple" # nim.configMode.save() + nim.diseqc13V = ConfigYesNo(default = False) + nim.diseqcMode = ConfigSelection( choices = [ ("single", _("Single")), -- cgit v1.2.3 From b833353b5285a547eb18c079aa860c9ee2765d6e Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 13 Dec 2008 01:33:05 +0100 Subject: add possibility to set manual lnb priority (only in advanced sat config) range 0..64 to decrease priorities (this is lower as all auto given priorities) range 14000..14064 this is higher than auto given rotor priorities range 19000..19064 this is higher than each auto given priorities --- lib/dvb/sec.cpp | 28 ++++++++++++++++++++++++---- lib/dvb/sec.h | 5 ++++- lib/python/Components/NimManager.py | 10 ++++++++++ lib/python/Screens/Satconfig.py | 1 + 4 files changed, 39 insertions(+), 5 deletions(-) (limited to 'lib/python/Components/NimManager.py') diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index 751a5453..1022b955 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -140,7 +140,7 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite { bool rotor=false; eDVBSatelliteLNBParameters &lnb_param = m_lnbs[idx]; - if ( lnb_param.slot_mask & slot_id ) // lnb for correct tuner? + if ( lnb_param.m_slot_mask & slot_id ) // lnb for correct tuner? { int ret = 0; eDVBSatelliteDiseqcParameters &di_param = lnb_param.m_diseqc_parameters; @@ -297,6 +297,9 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite ret=0; } + if (ret && lnb_param.m_prio != -1) + ret = lnb_param.m_prio; + eSecDebugNoSimulate("ret %d, score old %d", ret, score); if (ret > score) { @@ -309,7 +312,12 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite } } if (score && satcount) - score -= (satcount-1); + { + if (score > (satcount-1)) + score -= (satcount-1); + else + score = 1; // min score + } if (score && direct_connected) score += 5; // increase score for tuners with direct sat connection eSecDebugNoSimulate("final score %d", score); @@ -963,7 +971,8 @@ RESULT eDVBSatelliteEquipmentControl::clear() for (int i=0; i <= m_lnbidx; ++i) { m_lnbs[i].m_satellites.clear(); - m_lnbs[i].slot_mask = 0; + m_lnbs[i].m_slot_mask = 0; + m_lnbs[i].m_prio = -1; // auto } m_lnbidx=-1; @@ -1021,7 +1030,7 @@ RESULT eDVBSatelliteEquipmentControl::setLNBSlotMask(int slotmask) { eSecDebug("eDVBSatelliteEquipmentControl::setLNBSlotMask(%d)", slotmask); if ( currentLNBValid() ) - m_lnbs[m_lnbidx].slot_mask = slotmask; + m_lnbs[m_lnbidx].m_slot_mask = slotmask; else return -ENOENT; return 0; @@ -1067,6 +1076,17 @@ RESULT eDVBSatelliteEquipmentControl::setLNBIncreasedVoltage(bool onoff) return 0; } +RESULT eDVBSatelliteEquipmentControl::setLNBPrio(int prio) +{ + eSecDebug("eDVBSatelliteEquipmentControl::setLNBPrio(%d)", prio); + if ( currentLNBValid() ) + m_lnbs[m_lnbidx].m_prio = prio; + else + return -ENOENT; + return 0; +} + + /* DiSEqC Specific Parameters */ RESULT eDVBSatelliteEquipmentControl::setDiSEqCMode(int diseqcmode) { diff --git a/lib/dvb/sec.h b/lib/dvb/sec.h index 27dcedd5..2efd0b49 100644 --- a/lib/dvb/sec.h +++ b/lib/dvb/sec.h @@ -231,7 +231,7 @@ public: #ifndef SWIG t_12V_relais_state m_12V_relais_state; // 12V relais output on/off - __u8 slot_mask; // useable by slot ( 1 | 2 | 4...) + int m_slot_mask; // useable by slot ( 1 | 2 | 4...) unsigned int m_lof_hi, // for 2 band universal lnb 10600 Mhz (high band offset frequency) m_lof_lo, // for 2 band universal lnb 9750 Mhz (low band offset frequency) @@ -242,6 +242,8 @@ public: std::map m_satellites; eDVBSatelliteDiseqcParameters m_diseqc_parameters; eDVBSatelliteRotorParameters m_rotor_parameters; + + int m_prio; // to override automatic tuner management ... -1 is Auto #endif }; @@ -304,6 +306,7 @@ public: RESULT setLNBLOFH(int lofh); RESULT setLNBThreshold(int threshold); RESULT setLNBIncreasedVoltage(bool onoff); + RESULT setLNBPrio(int prio); /* DiSEqC Specific Parameters */ RESULT setDiSEqCMode(int diseqcmode); RESULT setToneburst(int toneburst); diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index edd3bbbb..168962e9 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -381,6 +381,8 @@ class SecConfigure: sec.setLNBSlotMask(tunermask) + sec.setLNBPrio(int(currLnb.prio.value)) + # finally add the orbital positions for y in lnbSat[x]: self.addSatellite(sec, y) @@ -1026,6 +1028,14 @@ def InitNimManager(nimmgr): nim.advanced.lnb[x].fastTurningBegin = ConfigDateTime(default=mktime(btime.timetuple()), formatstring = _("%H:%M"), increment = 600) etime = datetime(1970, 1, 1, 19, 0); nim.advanced.lnb[x].fastTurningEnd = ConfigDateTime(default=mktime(etime.timetuple()), formatstring = _("%H:%M"), increment = 600) + prio_list = [ ("-1", _("Auto")) ] + for prio in range(65): + prio_list.append((str(prio), str(prio))) + for prio in range(14000,14065): + prio_list.append((str(prio), str(prio))) + for prio in range(19000,19065): + prio_list.append((str(prio), str(prio))) + nim.advanced.lnb[x].prio = ConfigSelection(default="-1", choices=prio_list) elif slot.isCompatible("DVB-C"): nim.configMode = ConfigSelection( choices = { diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 6489f28f..5628926f 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -283,6 +283,7 @@ class NimSetup(Screen, ConfigListScreen): self.list.append(getConfigListEntry(_("Threshold"), currLnb.threshold)) # self.list.append(getConfigListEntry(_("12V Output"), currLnb.output_12v)) self.list.append(getConfigListEntry(_("Increased voltage"), currLnb.increased_voltage)) + self.list.append(getConfigListEntry(_("Priority"), currLnb.prio)) def fillAdvancedList(self): self.list = [ ] -- cgit v1.2.3 From a2f2b1a1523b784e70cf3bd9a74b4cc5cfdbb3de Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 19 Jan 2009 13:24:54 +0100 Subject: add unicable support (thx to adenin) --- lib/dvb/frontend.cpp | 43 ++++ lib/dvb/frontend.h | 4 + lib/dvb/sec.cpp | 378 +++++++++++++++++++++++------------- lib/dvb/sec.h | 24 +++ lib/python/Components/NimManager.py | 183 ++++++++++++++++- lib/python/Screens/Satconfig.py | 76 ++++++-- 6 files changed, 545 insertions(+), 163 deletions(-) (limited to 'lib/python/Components/NimManager.py') diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index 284844dc..aae7bbc2 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -587,6 +587,10 @@ int eDVBFrontend::closeFrontend(bool force) if (m_fd >= 0) { eDebugNoSimulate("close frontend %d", m_dvbid); + if (m_data[SATCR] != -1) + { + turnOffSatCR(m_data[SATCR]); + } setTone(iDVBFrontend::toneOff); setVoltage(iDVBFrontend::voltageOff); m_tuneTimer->stop(); @@ -2552,3 +2556,42 @@ arg_error: "eDVBFrontend::setSlotInfo must get a tuple with first param slotid, second param slot description and third param enabled boolean"); return false; } + +RESULT eDVBFrontend::turnOffSatCR(int satcr) +{ + eSecCommandList sec_sequence; + // check if voltage is disabled + eSecCommand::pair compare; + compare.steps = +9; //nothing to do + compare.voltage = iDVBFrontend::voltageOff; + sec_sequence.push_back( eSecCommand(eSecCommand::IF_NOT_VOLTAGE_GOTO, compare) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50 ) ); + + sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage18_5) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 250) ); + + eDVBDiseqcCommand diseqc; + memset(diseqc.data, 0, MAX_DISEQC_LENGTH); + diseqc.len = 5; + diseqc.data[0] = 0xE0; + diseqc.data[1] = 0x10; + diseqc.data[2] = 0x5A; + diseqc.data[3] = satcr << 5; + diseqc.data[4] = 0x00; + + sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50+20+14*diseqc.len) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) ); + setSecSequence(sec_sequence); + return 0; +} + +RESULT eDVBFrontend::ScanSatCR() +{ + setFrontend(); + usleep(20000); + setTone(iDVBFrontend::toneOff); + return 0; +} diff --git a/lib/dvb/frontend.h b/lib/dvb/frontend.h index 6e272aca..81334886 100644 --- a/lib/dvb/frontend.h +++ b/lib/dvb/frontend.h @@ -63,6 +63,7 @@ public: FREQ_OFFSET, // current frequency offset CUR_VOLTAGE, // current voltage CUR_TONE, // current continuous tone + SATCR, // current SatCR NUM_DATA_ENTRIES }; Signal1 m_stateChanged; @@ -142,6 +143,9 @@ public: int closeFrontend(bool force=false); const char *getDescription() const { return m_description; } bool is_simulate() const { return m_simulate; } + + RESULT turnOffSatCR(int satcr); + RESULT ScanSatCR(); }; #endif // SWIG diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index da2439f9..6f64cf56 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -305,10 +305,16 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA lnb_param.m_satellites.find(sat.orbital_position); if ( sit != lnb_param.m_satellites.end()) { + eSecCommandList sec_sequence; + + lnb_param.guard_offset = 0; //HACK + + frontend.setData(eDVBFrontend::SATCR, lnb_param.SatCR_idx); + eDVBSatelliteSwitchParameters &sw_param = sit->second; bool doSetFrontend = true; bool doSetVoltageToneFrontend = true; - bool sendDiSEqC = false; + bool forceStaticMode = true; bool forceChanged = false; bool needDiSEqCReset = false; long band=0, @@ -367,35 +373,54 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA if ( sat.frequency > lnb_param.m_lof_threshold ) band |= 1; - - if (band&1) - parm.FREQUENCY = sat.frequency - lnb_param.m_lof_hi; - else - parm.FREQUENCY = sat.frequency - lnb_param.m_lof_lo; - - parm.FREQUENCY = abs(parm.FREQUENCY); - - frontend.setData(eDVBFrontend::FREQ_OFFSET, sat.frequency - parm.FREQUENCY); - if (!(sat.polarisation & eDVBFrontendParametersSatellite::Polarisation::Vertical)) band |= 2; - if ( voltage_mode == eDVBSatelliteSwitchParameters::_14V - || ( sat.polarisation & eDVBFrontendParametersSatellite::Polarisation::Vertical - && voltage_mode == eDVBSatelliteSwitchParameters::HV ) ) - voltage = VOLTAGE(13); - else if ( voltage_mode == eDVBSatelliteSwitchParameters::_18V - || ( !(sat.polarisation & eDVBFrontendParametersSatellite::Polarisation::Vertical) - && voltage_mode == eDVBSatelliteSwitchParameters::HV ) ) - voltage = VOLTAGE(18); - if ( (sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::ON) - || ( sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::HILO && (band&1) ) ) - tone = iDVBFrontend::toneOn; - else if ( (sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::OFF) - || ( sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::HILO && !(band&1) ) ) - tone = iDVBFrontend::toneOff; + int lof = (band&1)?lnb_param.m_lof_hi:lnb_param.m_lof_lo; + + int local=0; - eSecCommandList sec_sequence; + + if(lnb_param.SatCR_idx == -1) + { + // calc Frequency + local = abs(sat.frequency + - ((lof - (lof % 1000)) + ((lof % 1000)>500 ? 1000 : 0)) ); //TODO für den Mist mal ein Macro schreiben + parm.FREQUENCY = (local - (local % 125)) + ((local % 125)>62 ? 125 : 0); + frontend.setData(eDVBFrontend::FREQ_OFFSET, sat.frequency - parm.FREQUENCY); + + if ( voltage_mode == eDVBSatelliteSwitchParameters::_14V + || ( sat.polarisation & eDVBFrontendParametersSatellite::Polarisation::Vertical + && voltage_mode == eDVBSatelliteSwitchParameters::HV ) ) + voltage = VOLTAGE(13); + else if ( voltage_mode == eDVBSatelliteSwitchParameters::_18V + || ( !(sat.polarisation & eDVBFrontendParametersSatellite::Polarisation::Vertical) + && voltage_mode == eDVBSatelliteSwitchParameters::HV ) ) + voltage = VOLTAGE(18); + if ( (sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::ON) + || ( sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::HILO && (band&1) ) ) + tone = iDVBFrontend::toneOn; + else if ( (sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::OFF) + || ( sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::HILO && !(band&1) ) ) + tone = iDVBFrontend::toneOff; + } + else + { + unsigned int tmp = abs(sat.frequency + - ((lof - (lof % 1000)) + ((lof % 1000)>500 ? 1000 : 0)) ) + + lnb_param.SatCRvco + - 1400000 + + lnb_param.guard_offset; + parm.FREQUENCY = (lnb_param.SatCRvco - (tmp % 4000))+((tmp%4000)>2000?4000:0)+lnb_param.guard_offset; + lnb_param.UnicableTuningWord = (((tmp / 4000)+((tmp%4000)>2000?1:0)) + | ((band & 1) ? 0x400 : 0) //HighLow + | ((band & 2) ? 0x800 : 0) //VertHor + | ((lnb_param.LNBNum & 1) ? 0 : 0x1000) //Umschaltung LNB1 LNB2 + | (lnb_param.SatCR_idx << 13)); //Adresse des SatCR + eDebug("[prepare] UnicableTuningWord %#04x",lnb_param.UnicableTuningWord); + eDebug("[prepare] guard_offset %d",lnb_param.guard_offset); + frontend.setData(eDVBFrontend::FREQ_OFFSET, sat.frequency - ((lnb_param.UnicableTuningWord & 0x3FF) *4000 + 1400000 - lnb_param.SatCRvco + lof)); + } if (diseqc_mode >= eDVBSatelliteDiseqcParameters::V1_0) { @@ -668,14 +693,13 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA if (di_param.m_seq_repeat && seq_repeat == 0) sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_BEFORE_SEQUENCE_REPEAT]) ); } - sendDiSEqC = true; } eDebugNoSimulate("RotorCmd %02x, lastRotorCmd %02lx", RotorCmd, lastRotorCmd); if ( RotorCmd != -1 && RotorCmd != lastRotorCmd ) { eSecCommand::pair compare; - if (!send_mask) + if (!send_mask && lnb_param.SatCR_idx == -1) { compare.steps = +3; compare.tone = iDVBFrontend::toneOff; @@ -729,112 +753,113 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA diseqc.data[3] = RotorCmd; diseqc.data[4] = 0x00; } - - if ( rotor_param.m_inputpower_parameters.m_use ) - { // use measure rotor input power to detect rotor state - bool turn_fast = need_turn_fast(rotor_param.m_inputpower_parameters.m_turning_speed); - eSecCommand::rotor cmd; - eSecCommand::pair compare; - if (turn_fast) - compare.voltage = VOLTAGE(18); + if(lnb_param.SatCR_idx == -1) + { + if ( rotor_param.m_inputpower_parameters.m_use ) + { // use measure rotor input power to detect rotor state + bool turn_fast = need_turn_fast(rotor_param.m_inputpower_parameters.m_turning_speed); + eSecCommand::rotor cmd; + eSecCommand::pair compare; + if (turn_fast) + compare.voltage = VOLTAGE(18); + else + compare.voltage = VOLTAGE(13); + compare.steps = +3; + sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, compare.voltage) ); + // measure idle power values + compare.steps = -2; + if (turn_fast) { + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MEASURE_IDLE_INPUTPOWER]) ); // wait 150msec after voltage change + sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_IDLE_INPUTPOWER, 1) ); + compare.val = 1; + sec_sequence.push_back( eSecCommand(eSecCommand::IF_MEASURE_IDLE_WAS_NOT_OK_GOTO, compare) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(13)) ); + } + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MEASURE_IDLE_INPUTPOWER]) ); // wait 150msec before measure + sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_IDLE_INPUTPOWER, 0) ); + compare.val = 0; + sec_sequence.push_back( eSecCommand(eSecCommand::IF_MEASURE_IDLE_WAS_NOT_OK_GOTO, compare) ); + //////////////////////////// + sec_sequence.push_back( eSecCommand(eSecCommand::SET_ROTOR_DISEQC_RETRYS, m_params[MOTOR_COMMAND_RETRIES]) ); // 2 retries + sec_sequence.push_back( eSecCommand(eSecCommand::INVALIDATE_CURRENT_ROTORPARMS) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, 40) ); // 2 seconds rotor start timout + // rotor start loop + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // 50msec delay + sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_RUNNING_INPUTPOWER) ); + cmd.direction=1; // check for running rotor + cmd.deltaA=rotor_param.m_inputpower_parameters.m_delta; + cmd.steps=+5; + cmd.okcount=0; + sec_sequence.push_back( eSecCommand(eSecCommand::IF_INPUTPOWER_DELTA_GOTO, cmd ) ); // check if rotor has started + sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +2 ) ); // timeout .. we assume now the rotor is already at the correct position + sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) ); // goto loop start + sec_sequence.push_back( eSecCommand(eSecCommand::IF_NO_MORE_ROTOR_DISEQC_RETRYS_GOTO, turn_fast ? 10 : 9 ) ); // timeout .. we assume now the rotor is already at the correct position + sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -8) ); // goto loop start + //////////////////// + sec_sequence.push_back( eSecCommand(eSecCommand::SET_ROTOR_MOVING) ); + if (turn_fast) + sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(18)) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, m_params[MOTOR_RUNNING_TIMEOUT]*20) ); // 2 minutes running timeout + // rotor running loop + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec + sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_RUNNING_INPUTPOWER) ); + cmd.direction=0; // check for stopped rotor + cmd.steps=+3; + sec_sequence.push_back( eSecCommand(eSecCommand::IF_INPUTPOWER_DELTA_GOTO, cmd ) ); + sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +2 ) ); // timeout ? this should never happen + sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) ); // running loop start + ///////////////////// + sec_sequence.push_back( eSecCommand(eSecCommand::UPDATE_CURRENT_ROTORPARAMS) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_ROTOR_STOPPED) ); + } else + { // use normal turning mode + doSetVoltageToneFrontend=false; + doSetFrontend=false; + eSecCommand::rotor cmd; + eSecCommand::pair compare; compare.voltage = VOLTAGE(13); - compare.steps = +3; - sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, compare.voltage) ); -// measure idle power values - compare.steps = -2; - if (turn_fast) { - sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MEASURE_IDLE_INPUTPOWER]) ); // wait 150msec after voltage change - sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_IDLE_INPUTPOWER, 1) ); - compare.val = 1; - sec_sequence.push_back( eSecCommand(eSecCommand::IF_MEASURE_IDLE_WAS_NOT_OK_GOTO, compare) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(13)) ); + compare.steps = +3; + sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, compare.voltage) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MOTOR_CMD]) ); // wait 150msec after voltage change + + sec_sequence.push_back( eSecCommand(eSecCommand::INVALIDATE_CURRENT_ROTORPARMS) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_ROTOR_MOVING) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) ); + + compare.voltage = voltage; + compare.steps = +3; + sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); // correct final voltage? + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 2000) ); // wait 2 second before set high voltage + sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, voltage) ); + + compare.tone = tone; + sec_sequence.push_back( eSecCommand(eSecCommand::IF_TONE_GOTO, compare) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, tone) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_CONT_TONE]) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) ); + + cmd.direction=1; // check for running rotor + cmd.deltaA=0; + cmd.steps=+3; + cmd.okcount=0; + sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, m_params[MOTOR_RUNNING_TIMEOUT]*4) ); // 2 minutes running timeout + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 250) ); // 250msec delay + sec_sequence.push_back( eSecCommand(eSecCommand::IF_TUNER_LOCKED_GOTO, cmd ) ); + sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +3 ) ); + sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -3) ); // goto loop start + sec_sequence.push_back( eSecCommand(eSecCommand::UPDATE_CURRENT_ROTORPARAMS) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_ROTOR_STOPPED) ); + sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, +3) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) ); + sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) ); } - sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MEASURE_IDLE_INPUTPOWER]) ); // wait 150msec before measure - sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_IDLE_INPUTPOWER, 0) ); - compare.val = 0; - sec_sequence.push_back( eSecCommand(eSecCommand::IF_MEASURE_IDLE_WAS_NOT_OK_GOTO, compare) ); -//////////////////////////// - sec_sequence.push_back( eSecCommand(eSecCommand::SET_ROTOR_DISEQC_RETRYS, m_params[MOTOR_COMMAND_RETRIES]) ); // 2 retries - sec_sequence.push_back( eSecCommand(eSecCommand::INVALIDATE_CURRENT_ROTORPARMS) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, 40) ); // 2 seconds rotor start timout -// rotor start loop - sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // 50msec delay - sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_RUNNING_INPUTPOWER) ); - cmd.direction=1; // check for running rotor - cmd.deltaA=rotor_param.m_inputpower_parameters.m_delta; - cmd.steps=+5; - cmd.okcount=0; - sec_sequence.push_back( eSecCommand(eSecCommand::IF_INPUTPOWER_DELTA_GOTO, cmd ) ); // check if rotor has started - sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +2 ) ); // timeout .. we assume now the rotor is already at the correct position - sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) ); // goto loop start - sec_sequence.push_back( eSecCommand(eSecCommand::IF_NO_MORE_ROTOR_DISEQC_RETRYS_GOTO, turn_fast ? 10 : 9 ) ); // timeout .. we assume now the rotor is already at the correct position - sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -8) ); // goto loop start -//////////////////// - sec_sequence.push_back( eSecCommand(eSecCommand::SET_ROTOR_MOVING) ); - if (turn_fast) - sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(18)) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, m_params[MOTOR_RUNNING_TIMEOUT]*20) ); // 2 minutes running timeout -// rotor running loop - sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec - sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_RUNNING_INPUTPOWER) ); - cmd.direction=0; // check for stopped rotor - cmd.steps=+3; - sec_sequence.push_back( eSecCommand(eSecCommand::IF_INPUTPOWER_DELTA_GOTO, cmd ) ); - sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +2 ) ); // timeout ? this should never happen - sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) ); // running loop start -///////////////////// - sec_sequence.push_back( eSecCommand(eSecCommand::UPDATE_CURRENT_ROTORPARAMS) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SET_ROTOR_STOPPED) ); - } - else - { // use normal turning mode - doSetVoltageToneFrontend=false; - doSetFrontend=false; - eSecCommand::rotor cmd; - eSecCommand::pair compare; - compare.voltage = VOLTAGE(13); - compare.steps = +3; - sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, compare.voltage) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MOTOR_CMD]) ); // wait 150msec after voltage change - - sec_sequence.push_back( eSecCommand(eSecCommand::INVALIDATE_CURRENT_ROTORPARMS) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SET_ROTOR_MOVING) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) ); - - compare.voltage = voltage; - compare.steps = +3; - sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); // correct final voltage? - sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 2000) ); // wait 2 second before set high voltage - sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, voltage) ); - - compare.tone = tone; - sec_sequence.push_back( eSecCommand(eSecCommand::IF_TONE_GOTO, compare) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, tone) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_CONT_TONE]) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) ); - - cmd.direction=1; // check for running rotor - cmd.deltaA=0; - cmd.steps=+3; - cmd.okcount=0; - sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, m_params[MOTOR_RUNNING_TIMEOUT]*4) ); // 2 minutes running timeout - sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 250) ); // 250msec delay - sec_sequence.push_back( eSecCommand(eSecCommand::IF_TUNER_LOCKED_GOTO, cmd ) ); - sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +3 ) ); - sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -3) ); // goto loop start - sec_sequence.push_back( eSecCommand(eSecCommand::UPDATE_CURRENT_ROTORPARAMS) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SET_ROTOR_STOPPED) ); - sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, +3) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) ); - sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) ); } sec_fe->setData(eDVBFrontend::NEW_ROTOR_CMD, RotorCmd); sec_fe->setData(eDVBFrontend::NEW_ROTOR_POS, sat.orbital_position); - sendDiSEqC = true; } } } @@ -844,14 +869,11 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA csw = band; } -// if (sendDiSEqC) - sec_sequence.push_front( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeStatic) ); - sec_fe->setData(eDVBFrontend::NEW_CSW, csw); sec_fe->setData(eDVBFrontend::NEW_UCSW, ucsw); sec_fe->setData(eDVBFrontend::NEW_TONEBURST, di_param.m_toneburst_param); - if (doSetVoltageToneFrontend) + if ((doSetVoltageToneFrontend) && (lnb_param.SatCR_idx == -1)) { eSecCommand::pair compare; compare.voltage = voltage; @@ -867,16 +889,45 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA sec_sequence.push_back( eSecCommand(eSecCommand::UPDATE_CURRENT_SWITCHPARMS) ); + if(lnb_param.SatCR_idx != -1) + { + // check if voltage is disabled + eSecCommand::pair compare; + compare.steps = +3; + compare.voltage = iDVBFrontend::voltageOff; + sec_sequence.push_back( eSecCommand(eSecCommand::IF_NOT_VOLTAGE_GOTO, compare) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50 ) ); + + sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage18_5) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MOTOR_CMD]) ); // wait 150msec after voltage change + + eDVBDiseqcCommand diseqc; + memset(diseqc.data, 0, MAX_DISEQC_LENGTH); + diseqc.len = 5; + diseqc.data[0] = 0xE0; + diseqc.data[1] = 0x10; + diseqc.data[2] = 0x5A; + diseqc.data[3] = lnb_param.UnicableTuningWord >> 8; + diseqc.data[4] = lnb_param.UnicableTuningWord; + + sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_LAST_DISEQC_CMD]) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) ); + } + if (doSetFrontend) { sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT, tunetimeout) ); sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) ); } - -// if (sendDiSEqC) - sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeDynamic) ); - + + if (forceStaticMode) + { + sec_sequence.push_front( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeStatic) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeDynamic) ); + } frontend.setSecSequence(sec_sequence); return 0; @@ -928,6 +979,7 @@ RESULT eDVBSatelliteEquipmentControl::clear() it->m_frontend->setData(eDVBFrontend::LINKED_NEXT_PTR, -1); it->m_frontend->setData(eDVBFrontend::ROTOR_POS, -1); it->m_frontend->setData(eDVBFrontend::ROTOR_CMD, -1); + it->m_frontend->setData(eDVBFrontend::SATCR, -1); } for (eSmartPtrList::iterator it(m_avail_simulate_frontends.begin()); it != m_avail_simulate_frontends.end(); ++it) @@ -937,6 +989,7 @@ RESULT eDVBSatelliteEquipmentControl::clear() it->m_frontend->setData(eDVBFrontend::LINKED_NEXT_PTR, -1); it->m_frontend->setData(eDVBFrontend::ROTOR_POS, -1); it->m_frontend->setData(eDVBFrontend::ROTOR_CMD, -1); + it->m_frontend->setData(eDVBFrontend::SATCR, -1); } return 0; @@ -1016,6 +1069,17 @@ RESULT eDVBSatelliteEquipmentControl::setLNBPrio(int prio) return 0; } +RESULT eDVBSatelliteEquipmentControl::setLNBNum(int LNBNum) +{ + eSecDebug("eDVBSatelliteEquipmentControl::setLNBNum(%d)", LNBNum); + if(!((LNBNum >= 1) && (LNBNum <= MAX_LNBNUM))) + return -EPERM; + if ( currentLNBValid() ) + m_lnbs[m_lnbidx].LNBNum = LNBNum; + else + return -ENOENT; + return 0; +} /* DiSEqC Specific Parameters */ RESULT eDVBSatelliteEquipmentControl::setDiSEqCMode(int diseqcmode) @@ -1159,6 +1223,46 @@ RESULT eDVBSatelliteEquipmentControl::setInputpowerDelta(int delta) return 0; } +/* Unicable Specific Parameters */ +RESULT eDVBSatelliteEquipmentControl::setLNBSatCR(int SatCR_idx) +{ + eSecDebug("eDVBSatelliteEquipmentControl::setLNBSatCR(%d)", SatCR_idx); + if(!((SatCR_idx >=-1) && (SatCR_idx < MAX_SATCR))) + return -EPERM; + if ( currentLNBValid() ) + m_lnbs[m_lnbidx].SatCR_idx = SatCR_idx; + else + return -ENOENT; + return 0; +} + +RESULT eDVBSatelliteEquipmentControl::setLNBSatCRvco(int SatCRvco) +{ + eSecDebug("eDVBSatelliteEquipmentControl::setLNBSatCRvco(%d)", SatCRvco); + if(!((SatCRvco >= 950*1000) && (SatCRvco <= 2150*1000))) + return -EPERM; + if(!((m_lnbs[m_lnbidx].SatCR_idx >= 0) && (m_lnbs[m_lnbidx].SatCR_idx < MAX_SATCR))) + return -ENOENT; + if ( currentLNBValid() ) + m_lnbs[m_lnbidx].SatCRvco = SatCRvco; + else + return -ENOENT; + return 0; +} +RESULT eDVBSatelliteEquipmentControl::getLNBSatCR() +{ + if ( currentLNBValid() ) + return m_lnbs[m_lnbidx].SatCR_idx; + return -ENOENT; +} + +RESULT eDVBSatelliteEquipmentControl::getLNBSatCRvco() +{ + if ( currentLNBValid() ) + return m_lnbs[m_lnbidx].SatCRvco; + return -ENOENT; +} + /* Satellite Specific Parameters */ RESULT eDVBSatelliteEquipmentControl::addSatellite(int orbital_position) { diff --git a/lib/dvb/sec.h b/lib/dvb/sec.h index 2efd0b49..5bff6bf7 100644 --- a/lib/dvb/sec.h +++ b/lib/dvb/sec.h @@ -245,6 +245,23 @@ public: int m_prio; // to override automatic tuner management ... -1 is Auto #endif +public: +#define guard_offset_min -8000 +#define guard_offset_max 8000 +#define guard_offset_step 8000 +#define MAX_SATCR 8 +#define MAX_LNBNUM 32 + + int SatCR_idx; + unsigned int SatCRvco; + unsigned int UnicableTuningWord; + unsigned int UnicableConfigWord; + int old_frequency; + int old_polarisation; + int old_orbital_position; + int guard_offset_old; + int guard_offset; + int LNBNum; }; class eDVBRegisteredFrontend; @@ -307,6 +324,7 @@ public: RESULT setLNBThreshold(int threshold); RESULT setLNBIncreasedVoltage(bool onoff); RESULT setLNBPrio(int prio); + RESULT setLNBNum(int LNBNum); /* DiSEqC Specific Parameters */ RESULT setDiSEqCMode(int diseqcmode); RESULT setToneburst(int toneburst); @@ -324,6 +342,12 @@ public: RESULT setUseInputpower(bool onoff); RESULT setInputpowerDelta(int delta); // delta between running and stopped rotor RESULT setRotorTurningSpeed(int speed); // set turning speed.. +/* Unicable Specific Parameters */ + RESULT setLNBSatCR(int SatCR_idx); + RESULT setLNBSatCRvco(int SatCRvco); +// RESULT checkGuardOffset(const eDVBFrontendParametersSatellite &sat); + RESULT getLNBSatCR(); + RESULT getLNBSatCRvco(); /* Satellite Specific Parameters */ RESULT addSatellite(int orbital_position); RESULT setVoltageMode(int mode); diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 168962e9..1fcbda1a 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -51,6 +51,8 @@ class SecConfigure: elif self.linked.has_key(slotid): for slot in self.linked[slotid]: tunermask |= (1 << slot) + sec.setLNBSatCR(-1) + sec.setLNBNum(1) sec.setLNBLOFL(9750000) sec.setLNBLOFH(10600000) sec.setLNBThreshold(11700000) @@ -255,6 +257,9 @@ class SecConfigure: currLnb = config.Nims[slotid].advanced.lnb[x] sec.addLNB() + if x < 33: + sec.setLNBNum(x) + tunermask = 1 << slotid if self.equal.has_key(slotid): for slot in self.equal[slotid]: @@ -263,10 +268,32 @@ class SecConfigure: for slot in self.linked[slotid]: tunermask |= (1 << slot) + if currLnb.lof.value != "unicable": + sec.setLNBSatCR(-1) + if currLnb.lof.value == "universal_lnb": sec.setLNBLOFL(9750000) sec.setLNBLOFH(10600000) sec.setLNBThreshold(11700000) + elif currLnb.lof.value == "unicable": + sec.setLNBLOFL(9750000) + sec.setLNBLOFH(10600000) + sec.setLNBThreshold(11700000) + if currLnb.unicable.value == "unicable_user": + sec.setLNBSatCR(currLnb.satcruser.index) + sec.setLNBSatCRvco(currLnb.satcrvcouser[currLnb.satcruser.index].value*1000) + elif currLnb.unicable.value == "unicable_matrix": + manufacturer_name = currLnb.unicableMatrixManufacturer.value + manufacturer = currLnb.unicableMatrix[manufacturer_name] + product_name = manufacturer.product.value + sec.setLNBSatCR(manufacturer.scr[product_name].index) + sec.setLNBSatCRvco(manufacturer.vco[product_name][manufacturer.scr[product_name].index].value*1000) + elif currLnb.unicable.value == "unicable_lnb": + manufacturer_name = currLnb.unicableMatrixManufacturer.value + manufacturer = currLnb.unicableMatrix[manufacturer_name] + product_name = manufacturer.product.value + sec.setLNBSatCR(manufacturer.scr[product_name].index) + sec.setLNBSatCRvco(manufacturer.vco[product_name][manufacturer.scr[product_name].index].value*1000) elif currLnb.lof.value == "c_band": sec.setLNBLOFL(5150000) sec.setLNBLOFH(5150000) @@ -892,6 +919,129 @@ def InitNimManager(nimmgr): for x in range(len(nimmgr.nim_slots)): config.Nims.append(ConfigSubsection()) + lnb_choices = { + "universal_lnb": _("Universal LNB"), + "unicable": _("Unicable"), + "c_band": _("C-Band"), + "user_defined": _("User defined")} + lnb_choices_default = "universal_lnb" + + unicablelnbproducts = { + "Humax": {"150 SCR":["1210","1420","1680","2040"]}, + "Inverto": {"IDLP-40UNIQD+S":["1680","1420","2040","1210"]}, + "Kathrein": {"UAS481":["1400","1516","1632","1748"]}, + "Kreiling": {"KR1440":["1680","1420","2040","1210"]}, + "Radix": {"Unicable LNB":["1680","1420","2040","1210"]}, + "Wisi": {"OC 05":["1210","1420","1680","2040"]}} + UnicableLnbManufacturers = unicablelnbproducts.keys() + UnicableLnbManufacturers.sort() + + unicablematrixproducts = { + "Ankaro": { + "UCS 51440":["1400","1632","1284","1516"], + "UCS 51820":["1400","1632","1284","1516","1864","2096","1748","1980"], + "UCS 51840":["1400","1632","1284","1516","1864","2096","1748","1980"], + "UCS 52240":["1400","1632"], + "UCS 52420":["1400","1632","1284","1516"], + "UCS 52440":["1400","1632","1284","1516"], + "UCS 91440":["1400","1632","1284","1516"], + "UCS 91820":["1400","1632","1284","1516","1864","2096","1748","1980"], + "UCS 91840":["1400","1632","1284","1516","1864","2096","1748","1980"], + "UCS 92240":["1400","1632"], + "UCS 92420":["1400","1632","1284","1516"], + "UCS 92440":["1400","1632","1284","1516"]}, + "DCT Delta": { + "SUM518":["1284","1400","1516","1632","1748","1864","1980","2096"], + "SUM918":["1284","1400","1516","1632","1748","1864","1980","2096"], + "SUM928":["1284","1400","1516","1632","1748","1864","1980","2096"]}, + "Inverto": { + "IDLP-UST11O-CUO1O-8PP":["1076","1178","1280","1382","1484","1586","1688","1790"]}, + "Kathrein": { + "EXR501":["1400","1516","1632","1748"], + "EXR551":["1400","1516","1632","1748"], + "EXR552":["1400","1516"]}, + "ROTEK": { + "EKL2/1":["1400","1516"], + "EKL2/1E":["0","0","1632","1748"]}, + "Smart": { + "DPA 51":["1284","1400","1516","1632","1748","1864","1980","2096"]}, + "Technisat": { + "TechniRouter 5/1x8 G":["1284","1400","1516","1632","1748","1864","1980","2096"], + "TechniRouter 5/1x8 K":["1284","1400","1516","1632","1748","1864","1980","2096"], + "TechniRouter 5/2x4 G":["1284","1400","1516","1632"], + "TechniRouter 5/2x4 K":["1284","1400","1516","1632"]}, + "Telstar": { + "SCR 5/1x8 G":["1284","1400","1516","1632","1748","1864","1980","2096"], + "SCR 5/1x8 K":["1284","1400","1516","1632","1748","1864","1980","2096"], + "SCR 5/2x4 G":["1284","1400","1516","1632"], + "SCR 5/2x4 K":["1284","1400","1516","1632"]}} + UnicableMatrixManufacturers = unicablematrixproducts.keys() + UnicableMatrixManufacturers.sort() + + unicable_choices = { + "unicable_lnb": _("Unicable LNB"), + "unicable_matrix": _("Unicable Martix"), + "unicable_user": "Unicable "+_("User defined")} + unicable_choices_default = "unicable_lnb" + + unicableLnb = ConfigSubDict() + for y in unicablelnbproducts: + products = unicablelnbproducts[y].keys() + products.sort() + unicableLnb[y] = ConfigSubsection() + unicableLnb[y].product = ConfigSelection(choices = products, default = products[0]) + unicableLnb[y].scr = ConfigSubDict() + unicableLnb[y].vco = ConfigSubDict() + for z in products: + scrlist = [] + vcolist = unicablelnbproducts[y][z] + unicableLnb[y].vco[z] = ConfigSubList() + for cnt in range(1,1+len(vcolist)): + scrlist.append(("%d" %cnt,"SCR %d" %cnt)) + vcofreq = int(vcolist[cnt-1]) + unicableLnb[y].vco[z].append(ConfigInteger(default=vcofreq, limits = (vcofreq, vcofreq))) + unicableLnb[y].scr[z] = ConfigSelection(choices = scrlist, default = scrlist[0][0]) + + unicableMatrix = ConfigSubDict() + + for y in unicablematrixproducts: + products = unicablematrixproducts[y].keys() + products.sort() + unicableMatrix[y] = ConfigSubsection() + unicableMatrix[y].product = ConfigSelection(choices = products, default = products[0]) + unicableMatrix[y].scr = ConfigSubDict() + unicableMatrix[y].vco = ConfigSubDict() + for z in products: + scrlist = [] + vcolist = unicablematrixproducts[y][z] + unicableMatrix[y].vco[z] = ConfigSubList() + for cnt in range(1,1+len(vcolist)): + vcofreq = int(vcolist[cnt-1]) + if vcofreq == 0: + scrlist.append(("%d" %cnt,"SCR %d " %cnt +_("not used"))) + else: + scrlist.append(("%d" %cnt,"SCR %d" %cnt)) + unicableMatrix[y].vco[z].append(ConfigInteger(default=vcofreq, limits = (vcofreq, vcofreq))) + unicableMatrix[y].scr[z] = ConfigSelection(choices = scrlist, default = scrlist[0][0]) + + satcrvcouser = ConfigSubList() + satcrvcouser.append(ConfigInteger(default=1284, limits = (0, 9999))) + satcrvcouser.append(ConfigInteger(default=1400, limits = (0, 9999))) + satcrvcouser.append(ConfigInteger(default=1516, limits = (0, 9999))) + satcrvcouser.append(ConfigInteger(default=1632, limits = (0, 9999))) + satcrvcouser.append(ConfigInteger(default=1748, limits = (0, 9999))) + satcrvcouser.append(ConfigInteger(default=1864, limits = (0, 9999))) + satcrvcouser.append(ConfigInteger(default=1980, limits = (0, 9999))) + satcrvcouser.append(ConfigInteger(default=2096, limits = (0, 9999))) + + prio_list = [ ("-1", _("Auto")) ] + for prio in range(65): + prio_list.append((str(prio), str(prio))) + for prio in range(14000,14065): + prio_list.append((str(prio), str(prio))) + for prio in range(19000,19065): + prio_list.append((str(prio), str(prio))) + for slot in nimmgr.nim_slots: x = slot.slot nim = config.Nims[x] @@ -990,12 +1140,36 @@ def InitNimManager(nimmgr): nim.advanced.lnb = ConfigSubList() nim.advanced.lnb.append(ConfigNothing()) + + for x in range(1, 37): nim.advanced.lnb.append(ConfigSubsection()) - nim.advanced.lnb[x].lof = ConfigSelection(choices={"universal_lnb": _("Universal LNB"), "c_band": _("C-Band"), "user_defined": _("User defined")}, default="universal_lnb") + nim.advanced.lnb[x].lof = ConfigSelection(choices = lnb_choices, default = lnb_choices_default) + nim.advanced.lnb[x].lofl = ConfigInteger(default=9750, limits = (0, 99999)) nim.advanced.lnb[x].lofh = ConfigInteger(default=10600, limits = (0, 99999)) nim.advanced.lnb[x].threshold = ConfigInteger(default=11700, limits = (0, 99999)) + + nim.advanced.lnb[x].unicable = ConfigSelection(choices = unicable_choices, default = unicable_choices_default) + + nim.advanced.lnb[x].unicableLnb = unicableLnb + nim.advanced.lnb[x].unicableLnbManufacturer = ConfigSelection(choices = UnicableLnbManufacturers, default = UnicableLnbManufacturers[0]) + + nim.advanced.lnb[x].unicableMatrix = unicableMatrix + nim.advanced.lnb[x].unicableMatrixManufacturer = ConfigSelection(choices = UnicableMatrixManufacturers, default = UnicableMatrixManufacturers[0]) + + nim.advanced.lnb[x].satcruser = ConfigSelection(choices=[ + ("1", "SatCR 1"), + ("2", "SatCR 2"), + ("3", "SatCR 3"), + ("4", "SatCR 4"), + ("5", "SatCR 5"), + ("6", "SatCR 6"), + ("7", "SatCR 7"), + ("8", "SatCR 8")], + default="1") + nim.advanced.lnb[x].satcrvcouser = satcrvcouser + # nim.advanced.lnb[x].output_12v = ConfigSelection(choices = [("0V", _("0 V")), ("12V", _("12 V"))], default="0V") nim.advanced.lnb[x].increased_voltage = ConfigYesNo(default=False) nim.advanced.lnb[x].toneburst = ConfigSelection(choices = [("none", _("None")), ("A", _("A")), ("B", _("B"))], default = "none") @@ -1028,13 +1202,6 @@ def InitNimManager(nimmgr): nim.advanced.lnb[x].fastTurningBegin = ConfigDateTime(default=mktime(btime.timetuple()), formatstring = _("%H:%M"), increment = 600) etime = datetime(1970, 1, 1, 19, 0); nim.advanced.lnb[x].fastTurningEnd = ConfigDateTime(default=mktime(etime.timetuple()), formatstring = _("%H:%M"), increment = 600) - prio_list = [ ("-1", _("Auto")) ] - for prio in range(65): - prio_list.append((str(prio), str(prio))) - for prio in range(14000,14065): - prio_list.append((str(prio), str(prio))) - for prio in range(19000,19065): - prio_list.append((str(prio), str(prio))) nim.advanced.lnb[x].prio = ConfigSelection(default="-1", choices=prio_list) elif slot.isCompatible("DVB-C"): nim.configMode = ConfigSelection( diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 320bea84..da6fcc12 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -87,6 +87,10 @@ class NimSetup(Screen, ConfigListScreen): self.uncommittedDiseqcCommand = None self.cableScanType = None self.have_advanced = False + self.advancedUnicable = None + self.advancedType = None + self.advancedManufacturer = None + self.advancedSCR = None if self.nim.isCompatible("DVB-S"): self.configMode = getConfigListEntry(_("Configuration Mode"), self.nimConfig.configMode) @@ -190,6 +194,7 @@ class NimSetup(Screen, ConfigListScreen): checkList = (self.configMode, self.diseqcModeEntry, self.advancedSatsEntry, \ self.advancedLnbsEntry, self.advancedDiseqcMode, self.advancedUsalsEntry, \ self.advancedLof, self.advancedPowerMeasurement, self.turningSpeed, \ + self.advancedType, self.advancedSCR, self.advancedManufacturer, self.advancedUnicable, \ self.uncommittedDiseqcCommand, self.cableScanType) for x in checkList: if self["config"].getCurrent() == x: @@ -216,19 +221,57 @@ class NimSetup(Screen, ConfigListScreen): if isinstance(currLnb, ConfigNothing): currLnb = None - self.list.append(getConfigListEntry(_("Voltage mode"), Sat.voltage)) - self.list.append(getConfigListEntry(_("Tone mode"), Sat.tonemode)) - if currLnb and currLnb.diseqcMode.value == "1_2": - if lnbnum < 33: - self.advancedUsalsEntry = getConfigListEntry(_("Use usals for this sat"), Sat.usals) - self.list.append(self.advancedUsalsEntry) - if not Sat.usals.value: - self.list.append(getConfigListEntry(_("Stored position"), Sat.rotorposition)) - # LNBs self.advancedLnbsEntry = getConfigListEntry(_("LNB"), Sat.lnb) self.list.append(self.advancedLnbsEntry) + if currLnb: + self.list.append(getConfigListEntry(_("Priority"), currLnb.prio)) + self.advancedLof = getConfigListEntry(_("LOF"), currLnb.lof) + self.list.append(self.advancedLof) + if currLnb.lof.value == "user_defined": + self.list.append(getConfigListEntry(_("LOF/L"), currLnb.lofl)) + self.list.append(getConfigListEntry(_("LOF/H"), currLnb.lofh)) + self.list.append(getConfigListEntry(_("Threshold"), currLnb.threshold)) +# self.list.append(getConfigListEntry(_("12V Output"), currLnb.output_12v)) + + if currLnb.lof.value == "unicable": + self.advancedUnicable = getConfigListEntry("Unicable "+_("Configuration Mode"), currLnb.unicable) + self.list.append(self.advancedUnicable) + if currLnb.unicable.value == "unicable_user": + self.advancedSCR = getConfigListEntry(_("Channel"), currLnb.satcruser) + self.list.append(self.advancedSCR) + self.list.append(getConfigListEntry(_("Frequency"), currLnb.satcrvcouser[currLnb.satcruser.index])) + self.list.append(getConfigListEntry(_("LOF/L"), currLnb.lofl)) + self.list.append(getConfigListEntry(_("LOF/H"), currLnb.lofh)) + self.list.append(getConfigListEntry(_("Threshold"), currLnb.threshold)) + elif currLnb.unicable.value == "unicable_matrix": + manufacturer_name = currLnb.unicableMatrixManufacturer.value + manufacturer = currLnb.unicableMatrix[manufacturer_name] + product_name = manufacturer.product.value + self.advancedManufacturer = getConfigListEntry(_("Manufacturer"), currLnb.unicableMatrixManufacturer) + self.advancedType = getConfigListEntry(_("Type"), manufacturer.product) + self.advancedSCR = getConfigListEntry(_("Channel"), manufacturer.scr[product_name]) + self.list.append(self.advancedManufacturer) + self.list.append(self.advancedType) + self.list.append(self.advancedSCR) + self.list.append(getConfigListEntry(_("Frequency"), manufacturer.vco[product_name][manufacturer.scr[product_name].index])) + elif currLnb.unicable.value == "unicable_lnb": + manufacturer_name = currLnb.unicableLnbManufacturer.value + manufacturer = currLnb.unicableLnb[manufacturer_name] + product_name = manufacturer.product.value + self.advancedManufacturer = getConfigListEntry(_("Manufacturer"), currLnb.unicableLnbManufacturer) + self.advancedType = getConfigListEntry(_("Type"), manufacturer.product) + self.advancedSCR = getConfigListEntry(_("Channel"), manufacturer.scr[product_name]) + self.list.append(self.advancedManufacturer) + self.list.append(self.advancedType) + self.list.append(self.advancedSCR) + self.list.append(getConfigListEntry(_("Frequency"), manufacturer.vco[product_name][manufacturer.scr[product_name].index])) + else: #kein Unicable + self.list.append(getConfigListEntry(_("Voltage mode"), Sat.voltage)) + self.list.append(getConfigListEntry(_("Increased voltage"), currLnb.increased_voltage)) + self.list.append(getConfigListEntry(_("Tone mode"), Sat.tonemode)) + if lnbnum < 33: self.advancedDiseqcMode = getConfigListEntry(_("DiSEqC mode"), currLnb.diseqcMode) self.list.append(self.advancedDiseqcMode) @@ -275,15 +318,12 @@ class NimSetup(Screen, ConfigListScreen): if currLnb.powerMeasurement.value: currLnb.powerMeasurement.value = False currLnb.powerMeasurement.save() - self.advancedLof = getConfigListEntry(_("LOF"), currLnb.lof) - self.list.append(self.advancedLof) - if currLnb.lof.value == "user_defined": - self.list.append(getConfigListEntry(_("LOF/L"), currLnb.lofl)) - self.list.append(getConfigListEntry(_("LOF/H"), currLnb.lofh)) - self.list.append(getConfigListEntry(_("Threshold"), currLnb.threshold)) -# self.list.append(getConfigListEntry(_("12V Output"), currLnb.output_12v)) - self.list.append(getConfigListEntry(_("Increased voltage"), currLnb.increased_voltage)) - self.list.append(getConfigListEntry(_("Priority"), currLnb.prio)) + self.advancedUsalsEntry = getConfigListEntry(_("Use usals for this sat"), Sat.usals) + self.list.append(self.advancedUsalsEntry) + if not Sat.usals.value: + self.list.append(getConfigListEntry(_("Stored position"), Sat.rotorposition)) + + def fillAdvancedList(self): self.list = [ ] -- cgit v1.2.3 From 15d7074f55a2c3dd38ce9877626be6ec32b448d2 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 27 Jan 2009 00:04:59 +0100 Subject: fixes for python 2.6 by Moritz Venn --- keymapparser.py | 15 +++++++++++---- lib/actions/parseactions.py | 4 ++-- lib/dvb/epgcache.cpp | 8 ++++++++ lib/python/Components/Converter/EventTime.py | 4 ++-- lib/python/Components/Converter/MovieInfo.py | 4 ++-- lib/python/Components/Converter/ServicePosition.py | 4 ++-- lib/python/Components/Converter/ServiceTime.py | 4 ++-- lib/python/Components/Element.py | 7 +++++++ lib/python/Components/NimManager.py | 6 ++---- lib/python/Components/Renderer/Canvas.py | 2 +- lib/python/Plugins/DemoPlugins/TestPlugin/plugin.py | 2 +- lib/python/Screens/ChannelSelection.py | 2 +- lib/python/Screens/Setup.py | 9 ++++++++- lib/python/Tools/LoadPixmap.py | 2 +- lib/python/python.h | 11 +++++++++++ mytest.py | 2 +- skin.py | 4 ++-- 17 files changed, 64 insertions(+), 26 deletions(-) (limited to 'lib/python/Components/NimManager.py') diff --git a/keymapparser.py b/keymapparser.py index 5023e944..63bca0f9 100644 --- a/keymapparser.py +++ b/keymapparser.py @@ -1,11 +1,18 @@ import enigma import xml.etree.cElementTree -from keyids import KEYIDS; +from keyids import KEYIDS # these are only informational (for help)... from Tools.KeyBindings import addKeyBinding +class KeymapError(Exception): + def __init__(self, message): + self.message = message + + def __str__(self): + return self.message + def parseKeys(context, filename, actionmap, device, keys): for x in keys.findall("key"): get_attr = x.attrib.get @@ -29,12 +36,12 @@ def parseKeys(context, filename, actionmap, device, keys): elif id[1] == 'd': keyid = int(id[2:]) | 0x8000 else: - raise "key id '" + str(id) + "' is neither hex nor dec" + raise KeymapError("key id '" + str(id) + "' is neither hex nor dec") else: try: keyid = KEYIDS[id] except: - raise "key id '" + str(id) + "' is illegal" + raise KeymapError("key id '" + str(id) + "' is illegal") # print context + "::" + mapto + " -> " + device + "." + hex(keyid) actionmap.bindKey(filename, device, keyid, flags, context, mapto) addKeyBinding(filename, keyid, context, mapto, flags) @@ -48,7 +55,7 @@ def readKeymap(filename): try: dom = xml.etree.cElementTree.parse(source) except: - raise "keymap %s not well-formed." % filename + raise KeymapError("keymap %s not well-formed." % filename) keymap = dom.getroot() diff --git a/lib/actions/parseactions.py b/lib/actions/parseactions.py index 4ab71af7..2462a751 100644 --- a/lib/actions/parseactions.py +++ b/lib/actions/parseactions.py @@ -65,7 +65,7 @@ def do_file(f, mode): except: pass - raise "action enum must be simple." + raise Exception("action enum must be simple.") counter = 0 @@ -82,7 +82,7 @@ def do_file(f, mode): if counter: if t != ",": - raise "no comma" + raise Exception("no comma") t = tokens.next() if firsthit: diff --git a/lib/dvb/epgcache.cpp b/lib/dvb/epgcache.cpp index a8eca85b..fdcbe0e9 100644 --- a/lib/dvb/epgcache.cpp +++ b/lib/dvb/epgcache.cpp @@ -2058,7 +2058,11 @@ PyObject *eEPGCache::search(ePyObject arg) ePyObject obj = PyTuple_GET_ITEM(arg,0); if (PyString_Check(obj)) { +#if PY_VERSION_HEX < 0x02060000 argcount = PyString_GET_SIZE(obj); +#else + argcount = PyString_Size(obj); +#endif argstring = PyString_AS_STRING(obj); for (int i=0; i < argcount; ++i) switch(argstring[i]) @@ -2156,7 +2160,11 @@ PyObject *eEPGCache::search(ePyObject arg) { int casetype = PyLong_AsLong(PyTuple_GET_ITEM(arg, 4)); const char *str = PyString_AS_STRING(obj); +#if PY_VERSION_HEX < 0x02060000 int textlen = PyString_GET_SIZE(obj); +#else + int textlen = PyString_Size(obj); +#endif if (querytype == 1) eDebug("lookup for events with '%s' as title(%s)", str, casetype?"ignore case":"case sensitive"); else diff --git a/lib/python/Components/Converter/EventTime.py b/lib/python/Components/Converter/EventTime.py index 966f2ca8..41f1ebf3 100644 --- a/lib/python/Components/Converter/EventTime.py +++ b/lib/python/Components/Converter/EventTime.py @@ -1,7 +1,7 @@ from Converter import Converter from Poll import Poll from time import time -from Components.Element import cached +from Components.Element import cached, ElementError class EventTime(Poll, Converter, object): STARTTIME = 0 @@ -28,7 +28,7 @@ class EventTime(Poll, Converter, object): self.poll_interval = 30*1000 self.poll_enabled = True else: - raise str("'%s' is not for EventTime converter" % type) + raise ElementError("'%s' is not for EventTime converter" % type) @cached def getTime(self): diff --git a/lib/python/Components/Converter/MovieInfo.py b/lib/python/Components/Converter/MovieInfo.py index 068d24d3..be28dcce 100644 --- a/lib/python/Components/Converter/MovieInfo.py +++ b/lib/python/Components/Converter/MovieInfo.py @@ -1,5 +1,5 @@ from Components.Converter.Converter import Converter -from Components.Element import cached +from Components.Element import cached, ElementError from enigma import iServiceInformation from ServiceReference import ServiceReference @@ -16,7 +16,7 @@ class MovieInfo(Converter, object): elif type == "RecordServiceName": self.type = self.MOVIE_REC_SERVICE_NAME else: - raise str("'%s' is not for MovieInfo converter" % type) + raise ElementError("'%s' is not for MovieInfo converter" % type) Converter.__init__(self, type) @cached diff --git a/lib/python/Components/Converter/ServicePosition.py b/lib/python/Components/Converter/ServicePosition.py index d7a55dae..2bcc5492 100644 --- a/lib/python/Components/Converter/ServicePosition.py +++ b/lib/python/Components/Converter/ServicePosition.py @@ -1,7 +1,7 @@ from Converter import Converter from Poll import Poll from enigma import iPlayableService -from Components.Element import cached +from Components.Element import cached, ElementError class ServicePosition(Converter, Poll, object): TYPE_LENGTH = 0 @@ -35,7 +35,7 @@ class ServicePosition(Converter, Poll, object): elif type == "Gauge": self.type = self.TYPE_GAUGE else: - raise "type must be {Length|Position|Remaining|Gauge} with optional arguments {Negate|Detailed|ShowHours|NoSeconds}" + raise ElementError("type must be {Length|Position|Remaining|Gauge} with optional arguments {Negate|Detailed|ShowHours|NoSeconds}") self.poll_enabled = self.type != self.TYPE_LENGTH diff --git a/lib/python/Components/Converter/ServiceTime.py b/lib/python/Components/Converter/ServiceTime.py index 16bcae3a..89965067 100644 --- a/lib/python/Components/Converter/ServiceTime.py +++ b/lib/python/Components/Converter/ServiceTime.py @@ -1,5 +1,5 @@ from Converter import Converter -from Components.Element import cached +from Components.Element import cached, ElementError from enigma import iServiceInformation class ServiceTime(Converter, object): @@ -16,7 +16,7 @@ class ServiceTime(Converter, object): elif type == "Duration": self.type = self.DURATION else: - raise str("'%s' is not for eEventTime converter" % type) + raise ElementError("'%s' is not for eEventTime converter" % type) @cached def getTime(self): diff --git a/lib/python/Components/Element.py b/lib/python/Components/Element.py index 2af57793..f4a8f127 100644 --- a/lib/python/Components/Element.py +++ b/lib/python/Components/Element.py @@ -16,6 +16,13 @@ def cached(f): return cache[name][1] return wrapper +class ElementError(Exception): + def __init__(self, message): + self.message = message + + def __str__(self): + return self.message + class Element(object): CHANGED_DEFAULT = 0 # initial "pull" state CHANGED_ALL = 1 # really everything changed diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 1fcbda1a..2692cb5b 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -14,8 +14,6 @@ from enigma import eDVBSatelliteEquipmentControl as secClass, \ from time import localtime, mktime from datetime import datetime -from sets import Set - def getConfigSatlist(orbpos, satlist): default_orbpos = None for x in satlist: @@ -123,7 +121,7 @@ class SecConfigure: def update(self): sec = secClass.getInstance() - self.configuredSatellites = Set() + self.configuredSatellites = set() sec.clear() ## this do unlinking NIMs too !! print "sec config cleared" @@ -442,7 +440,7 @@ class SecConfigure: def __init__(self, nimmgr): self.NimManager = nimmgr - self.configuredSatellites = Set() + self.configuredSatellites = set() self.update() class NIM(object): diff --git a/lib/python/Components/Renderer/Canvas.py b/lib/python/Components/Renderer/Canvas.py index bd7ffb5e..acf0dbf7 100644 --- a/lib/python/Components/Renderer/Canvas.py +++ b/lib/python/Components/Renderer/Canvas.py @@ -35,7 +35,7 @@ class Canvas(Renderer): self.instance.writeText(eRect(l[1], l[2], l[3], l[4]), gRGB(l[5]), gRGB(l[6]), l[7], l[8], l[9]) else: print "drawlist entry:", l - raise "invalid drawlist entry" + raise RuntimeError("invalid drawlist entry") def changed(self, what): self.pull_updates() diff --git a/lib/python/Plugins/DemoPlugins/TestPlugin/plugin.py b/lib/python/Plugins/DemoPlugins/TestPlugin/plugin.py index a63562c8..69f935e4 100644 --- a/lib/python/Plugins/DemoPlugins/TestPlugin/plugin.py +++ b/lib/python/Plugins/DemoPlugins/TestPlugin/plugin.py @@ -51,7 +51,7 @@ class Test(Screen): def mycallback(self, answer): print "answer:", answer if answer: - raise "test-crash" + raise Exception("test-crash") self.close() def keyLeft(self): diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index b203b24e..ebfbe812 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -76,7 +76,7 @@ def append_when_current_valid(current, menu, args, level = 0): class ChannelContextMenu(Screen): def __init__(self, session, csel): Screen.__init__(self, session) - #raise "we need a better summary screen here" + #raise Exception("we need a better summary screen here") self.csel = csel self.bsel = None diff --git a/lib/python/Screens/Setup.py b/lib/python/Screens/Setup.py index 35918b5b..1d035b8a 100644 --- a/lib/python/Screens/Setup.py +++ b/lib/python/Screens/Setup.py @@ -19,6 +19,13 @@ except: setupdom = xml.etree.cElementTree.parse(setupfile) setupfile.close() +class SetupError(Exception): + def __init__(self, message): + self.message = message + + def __str__(self): + return self.message + class SetupSummary(Screen): skin = """ @@ -145,4 +152,4 @@ def getSetupTitle(id): for x in xmldata.findall("setup"): if x.get("key") == id: return x.get("title", "").encode("UTF-8") - raise "unknown setup id '%s'!" % repr(id) + raise SetupError("unknown setup id '%s'!" % repr(id)) diff --git a/lib/python/Tools/LoadPixmap.py b/lib/python/Tools/LoadPixmap.py index 53e04e54..fff414ad 100644 --- a/lib/python/Tools/LoadPixmap.py +++ b/lib/python/Tools/LoadPixmap.py @@ -14,7 +14,7 @@ def LoadPixmap(path, desktop = None, cached = False): alpha = loadPNG(path + "a.png") ptr = loadJPG(path + "rgb.jpg", alpha) else: - raise "neither .png nor .jpg, please fix file extension" + raise Exception("neither .png nor .jpg, please fix file extension") if ptr and desktop: desktop.makeCompatiblePixmap(ptr) diff --git a/lib/python/python.h b/lib/python/python.h index f56d49bb..52ec6c1e 100644 --- a/lib/python/python.h +++ b/lib/python/python.h @@ -24,6 +24,7 @@ public: #ifdef PYTHON_REFCOUNT_DEBUG inline ePyObject(PyObject *ob, const char *file, int line); #endif + inline ePyObject(PyVarObject *ob); inline ePyObject(PyDictObject *ob); inline ePyObject(PyTupleObject *ob); inline ePyObject(PyListObject *ob); @@ -32,11 +33,13 @@ public: operator bool() { return !!m_ob; } ePyObject &operator=(const ePyObject &); ePyObject &operator=(PyObject *); + ePyObject &operator=(PyVarObject *ob) { return operator=((PyObject*)ob); } ePyObject &operator=(PyDictObject *ob) { return operator=((PyObject*)ob); } ePyObject &operator=(PyTupleObject *ob) { return operator=((PyObject*)ob); } ePyObject &operator=(PyListObject *ob) { return operator=((PyObject*)ob); } ePyObject &operator=(PyStringObject *ob) { return operator=((PyObject*)ob); } operator PyObject*(); + operator PyVarObject*() { return (PyVarObject*)operator PyVarObject*(); } operator PyTupleObject*() { return (PyTupleObject*)operator PyObject*(); } operator PyListObject*() { return (PyListObject*)operator PyObject*(); } operator PyStringObject*() { return (PyStringObject*)operator PyObject*(); } @@ -84,6 +87,14 @@ inline ePyObject::ePyObject(PyObject *ob, const char* file, int line) } #endif +inline ePyObject::ePyObject(PyVarObject *ob) + :m_ob((PyObject*)ob) +#ifdef PYTHON_REFCOUNT_DEBUG + ,m_file(0), m_line(0), m_from(0), m_to(0), m_erased(false) +#endif +{ +} + inline ePyObject::ePyObject(PyDictObject *ob) :m_ob((PyObject*)ob) #ifdef PYTHON_REFCOUNT_DEBUG diff --git a/mytest.py b/mytest.py index 014f94c9..8f23beac 100644 --- a/mytest.py +++ b/mytest.py @@ -277,7 +277,7 @@ class Session: def open(self, screen, *arguments, **kwargs): if len(self.dialog_stack) and not self.in_exec: - raise "modal open are allowed only from a screen which is modal!" + raise RuntimeError("modal open are allowed only from a screen which is modal!") # ...unless it's the very first screen. self.pushCurrent() diff --git a/skin.py b/skin.py index eae6ea4b..03fe96bb 100644 --- a/skin.py +++ b/skin.py @@ -274,7 +274,7 @@ def loadSingleSkinData(desktop, skin, path_prefix): colorNames[name] = parseColor(color) #print "Color:", name, color else: - raise ("need color and name, got %s %s" % (name, color)) + raise SkinError("need color and name, got %s %s" % (name, color)) for c in skin.findall("fonts"): for font in c.findall("font"): @@ -335,7 +335,7 @@ def loadSingleSkinData(desktop, skin, path_prefix): try: style.setColor(eWindowStyleSkinned.__dict__["col" + type], color) except: - raise ("Unknown color %s" % (type)) + raise SkinError("Unknown color %s" % (type)) #pass #print " color:", type, color -- cgit v1.2.3 From 737d231c90d1e7ca5971346a4acddad5a6a58a1c Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 9 Feb 2009 11:53:17 +0100 Subject: speedup / cleanup --- lib/python/Components/NimManager.py | 214 ++++++++++++++++-------------------- 1 file changed, 97 insertions(+), 117 deletions(-) (limited to 'lib/python/Components/NimManager.py') diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 2692cb5b..4be10d53 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -1022,6 +1022,9 @@ def InitNimManager(nimmgr): unicableMatrix[y].vco[z].append(ConfigInteger(default=vcofreq, limits = (vcofreq, vcofreq))) unicableMatrix[y].scr[z] = ConfigSelection(choices = scrlist, default = scrlist[0][0]) + advanced_lnb_satcruser_choices = [ ("1", "SatCR 1"), ("2", "SatCR 2"), ("3", "SatCR 3"), ("4", "SatCR 4"), + ("5", "SatCR 5"), ("6", "SatCR 6"), ("7", "SatCR 7"), ("8", "SatCR 8")] + satcrvcouser = ConfigSubList() satcrvcouser.append(ConfigInteger(default=1284, limits = (0, 9999))) satcrvcouser.append(ConfigInteger(default=1400, limits = (0, 9999))) @@ -1033,70 +1036,78 @@ def InitNimManager(nimmgr): satcrvcouser.append(ConfigInteger(default=2096, limits = (0, 9999))) prio_list = [ ("-1", _("Auto")) ] - for prio in range(65): - prio_list.append((str(prio), str(prio))) - for prio in range(14000,14065): - prio_list.append((str(prio), str(prio))) - for prio in range(19000,19065): - prio_list.append((str(prio), str(prio))) + prio_list += [(str(prio), str(prio)) for prio in range(65)+range(14000,14065)+range(19000,19065)] + + advanced_lnb_csw_choices = [("none", _("None")), ("AA", _("AA")), ("AB", _("AB")), ("BA", _("BA")), ("BB", _("BB"))] + advanced_lnb_csw_choices += [(str(0xF0|y), "Input " + str(y+1)) for y in range(0, 16)] + + advanced_lnb_ucsw_choices = [("0", _("None"))] + [(str(y), "Input " + str(y)) for y in range(1, 17)] + + diseqc_mode_choices = [ + ("single", _("Single")), ("toneburst_a_b", _("Toneburst A/B")), + ("diseqc_a_b", _("DiSEqC A/B")), ("diseqc_a_b_c_d", _("DiSEqC A/B/C/D")), + ("positioner", _("Positioner"))] + positioner_mode_choices = [("usals", _("USALS")), ("manual", _("manual"))] + + diseqc_satlist_choices = [(3601, _('nothing connected'), 1)] + nimmgr.satList + + longitude_orientation_choices = [("east", _("East")), ("west", _("West"))] + latitude_orientation_choices = [("north", _("North")), ("south", _("South"))] + turning_speed_choices = [("fast", _("Fast")), ("slow", _("Slow")), ("fast epoch", _("Fast epoch"))] + + advanced_satlist_choices = nimmgr.satList + [ + (3601, _('All Satellites')+' 1', 1), (3602, _('All Satellites')+' 2', 1), + (3603, _('All Satellites')+' 3', 1), (3604, _('All Satellites')+' 4', 1)] + advanced_lnb_choices = [("0", "not available")] + [(str(y), "LNB " + str(y)) for y in range(1, 33)] + advanced_voltage_choices = [("polarization", _("Polarization")), ("13V", _("13 V")), ("18V", _("18 V"))] + advanced_tonemode_choices = [("band", _("Band")), ("on", _("On")), ("off", _("Off"))] + advanced_lnb_toneburst_choices = [("none", _("None")), ("A", _("A")), ("B", _("B"))] + advanced_lnb_allsat_diseqcmode_choices = [("1_2", _("1.2"))] + advanced_lnb_diseqcmode_choices = [("none", _("None")), ("1_0", _("1.0")), ("1_1", _("1.1")), ("1_2", _("1.2"))] + advanced_lnb_commandOrder1_0_choices = [("ct", "committed, toneburst"), ("tc", "toneburst, committed")] + advanced_lnb_commandOrder_choices = [ + ("ct", "committed, toneburst"), ("tc", "toneburst, committed"), + ("cut", "committed, uncommitted, toneburst"), ("tcu", "toneburst, committed, uncommitted"), + ("uct", "uncommitted, committed, toneburst"), ("tuc", "toneburst, uncommitted, commmitted")] + advanced_lnb_diseqc_repeat_choices = [("none", _("None")), ("one", _("One")), ("two", _("Two")), ("three", _("Three"))] + advanced_lnb_fast_turning_btime = mktime(datetime(1970, 1, 1, 7, 0).timetuple()); + advanced_lnb_fast_turning_etime = mktime(datetime(1970, 1, 1, 19, 0).timetuple()); for slot in nimmgr.nim_slots: x = slot.slot nim = config.Nims[x] if slot.isCompatible("DVB-S"): - choices = { "nothing": _("nothing connected"), - "simple": _("simple"), - "advanced": _("advanced")} + config_mode_choices = [ ("nothing", _("nothing connected")), + ("simple", _("simple")), ("advanced", _("advanced"))] if len(nimmgr.getNimListOfType(slot.type, exception = x)) > 0: - choices["equal"] = _("equal to") - choices["satposdepends"] = _("second cable of motorized LNB") + config_mode_choices.append(("equal", _("equal to"))) + config_mode_choices.append(("satposdepends", _("second cable of motorized LNB"))) if len(nimmgr.canConnectTo(x)) > 0: - choices["loopthrough"] = _("loopthrough to") - nim.configMode = ConfigSelection(choices = choices, default = "nothing") - -# for y in nimmgr.nim_slots: -# if y.slot == 0: -# if not y.isCompatible("DVB-S"): -# # reset to simple -# nim.configMode.value = "simple" -# nim.configMode.save() - - nim.diseqc13V = ConfigYesNo(default = False) - - nim.diseqcMode = ConfigSelection( - choices = [ - ("single", _("Single")), - ("toneburst_a_b", _("Toneburst A/B")), - ("diseqc_a_b", _("DiSEqC A/B")), - ("diseqc_a_b_c_d", _("DiSEqC A/B/C/D")), - ("positioner", _("Positioner"))], - default = "diseqc_a_b") - - choices = [] - for id in nimmgr.getNimListOfType("DVB-S"): - if id != x: - choices.append((str(id), nimmgr.getNimDescription(id))) - nim.connectedTo = ConfigSelection(choices = choices) - nim.simpleSingleSendDiSEqC = ConfigYesNo(default=False) - nim.simpleDiSEqCSetVoltageTone = ConfigYesNo(default=True) - nim.simpleDiSEqCOnlyOnSatChange = ConfigYesNo(default=False) - nim.diseqcA = getConfigSatlist(192, [(3601, _('nothing connected'), 1)] + nimmgr.satList) - nim.diseqcB = getConfigSatlist(130, [(3601, _('nothing connected'), 1)] + nimmgr.satList) - nim.diseqcC = ConfigSatlist(list = [(3601, _('nothing connected'), 1)] + nimmgr.satList) - nim.diseqcD = ConfigSatlist(list = [(3601, _('nothing connected'), 1)] + nimmgr.satList) - nim.positionerMode = ConfigSelection( - choices = [ - ("usals", _("USALS")), - ("manual", _("manual"))], - default = "usals") + config_mode_choices.append(("loopthrough", _("loopthrough to"))) + nim.configMode = ConfigSelection(config_mode_choices, "nothing") + + nim.diseqc13V = ConfigYesNo(False) + + nim.diseqcMode = ConfigSelection(diseqc_mode_choices, "diseqc_a_b") + + nim.connectedTo = ConfigSelection([(str(id), nimmgr.getNimDescription(id)) for id in nimmgr.getNimListOfType("DVB-S") if id != x]) + + nim.simpleSingleSendDiSEqC = ConfigYesNo(False) + nim.simpleDiSEqCSetVoltageTone = ConfigYesNo(True) + nim.simpleDiSEqCOnlyOnSatChange = ConfigYesNo(False) + nim.diseqcA = getConfigSatlist(192, diseqc_satlist_choices) + nim.diseqcB = getConfigSatlist(130, diseqc_satlist_choices) + nim.diseqcC = ConfigSatlist(list = diseqc_satlist_choices) + nim.diseqcD = ConfigSatlist(list = diseqc_satlist_choices) + nim.positionerMode = ConfigSelection(positioner_mode_choices, "usals") nim.longitude = ConfigFloat(default=[5,100], limits=[(0,359),(0,999)]) - nim.longitudeOrientation = ConfigSelection(choices={"east": _("East"), "west": _("West")}, default = "east") + nim.longitudeOrientation = ConfigSelection(longitude_orientation_choices, "east") nim.latitude = ConfigFloat(default=[50,767], limits=[(0,359),(0,999)]) - nim.latitudeOrientation = ConfigSelection(choices={"north": _("North"), "south": _("South")}, default="north") - nim.powerMeasurement = ConfigYesNo(default=True) + nim.latitudeOrientation = ConfigSelection(latitude_orientation_choices, "north") + nim.powerMeasurement = ConfigYesNo(True) nim.powerThreshold = ConfigInteger(default=hw.get_device_name() == "dm8000" and 15 or 50, limits=(0, 100)) - nim.turningSpeed = ConfigSelection(choices = [("fast", _("Fast")), ("slow", _("Slow")), ("fast epoch", _("Fast epoch")) ], default = "fast") + nim.turningSpeed = ConfigSelection(turning_speed_choices, "fast") btime = datetime(1970, 1, 1, 7, 0); nim.fastTurningBegin = ConfigDateTime(default = mktime(btime.timetuple()), formatstring = _("%H:%M"), increment = 900) etime = datetime(1970, 1, 1, 19, 0); @@ -1104,103 +1115,72 @@ def InitNimManager(nimmgr): # advanced config: nim.advanced = ConfigSubsection() - tmp = [(3601, _('All Satellites')+' 1', 1), (3602, _('All Satellites')+' 2', 1), (3603, _('All Satellites')+' 3', 1), (3604, _('All Satellites')+' 4', 1)] - nim.advanced.sats = getConfigSatlist(192,nimmgr.satList+tmp) + nim.advanced.sats = getConfigSatlist(192, advanced_satlist_choices) nim.advanced.sat = ConfigSubDict() - lnbs = [("0", "not available")] - for y in range(1, 33): - lnbs.append((str(y), "LNB " + str(y))) for x in nimmgr.satList: nim.advanced.sat[x[0]] = ConfigSubsection() - nim.advanced.sat[x[0]].voltage = ConfigSelection(choices={"polarization": _("Polarization"), "13V": _("13 V"), "18V": _("18 V")}, default = "polarization") - nim.advanced.sat[x[0]].tonemode = ConfigSelection(choices={"band": _("Band"), "on": _("On"), "off": _("Off")}, default = "band") - nim.advanced.sat[x[0]].usals = ConfigYesNo(default=True) + nim.advanced.sat[x[0]].voltage = ConfigSelection(advanced_voltage_choices, "polarization") + nim.advanced.sat[x[0]].tonemode = ConfigSelection(advanced_tonemode_choices, "band") + nim.advanced.sat[x[0]].usals = ConfigYesNo(True) nim.advanced.sat[x[0]].rotorposition = ConfigInteger(default=1, limits=(1, 255)) - nim.advanced.sat[x[0]].lnb = ConfigSelection(choices = lnbs) + nim.advanced.sat[x[0]].lnb = ConfigSelection(advanced_lnb_choices, "0") for x in range(3601, 3605): nim.advanced.sat[x] = ConfigSubsection() - nim.advanced.sat[x].voltage = ConfigSelection(choices={"polarization": _("Polarization"), "13V": _("13 V"), "18V": _("18 V")}, default = "polarization") - nim.advanced.sat[x].tonemode = ConfigSelection(choices={"band": _("Band"), "on": _("On"), "off": _("Off")}, default = "band") + nim.advanced.sat[x].voltage = ConfigSelection(advanced_voltage_choices, "polarization") + nim.advanced.sat[x].tonemode = ConfigSelection(advanced_tonemode_choices, "band") nim.advanced.sat[x].usals = ConfigYesNo(default=True) nim.advanced.sat[x].rotorposition = ConfigInteger(default=1, limits=(1, 255)) lnbnum = 33+x-3601 - nim.advanced.sat[x].lnb = ConfigSelection(choices = [("0", "not available"), (str(lnbnum), "LNB %d"%(lnbnum))], default="0") - - csw = [("none", _("None")), ("AA", _("AA")), ("AB", _("AB")), ("BA", _("BA")), ("BB", _("BB"))] - for y in range(0, 16): - csw.append((str(0xF0|y), "Input " + str(y+1))) - - ucsw = [("0", _("None"))] - for y in range(1, 17): - ucsw.append((str(y), "Input " + str(y))) + nim.advanced.sat[x].lnb = ConfigSelection([("0", "not available"), (str(lnbnum), "LNB %d"%(lnbnum))], "0") nim.advanced.lnb = ConfigSubList() nim.advanced.lnb.append(ConfigNothing()) - for x in range(1, 37): nim.advanced.lnb.append(ConfigSubsection()) - nim.advanced.lnb[x].lof = ConfigSelection(choices = lnb_choices, default = lnb_choices_default) + nim.advanced.lnb[x].lof = ConfigSelection(lnb_choices, lnb_choices_default) nim.advanced.lnb[x].lofl = ConfigInteger(default=9750, limits = (0, 99999)) nim.advanced.lnb[x].lofh = ConfigInteger(default=10600, limits = (0, 99999)) nim.advanced.lnb[x].threshold = ConfigInteger(default=11700, limits = (0, 99999)) - nim.advanced.lnb[x].unicable = ConfigSelection(choices = unicable_choices, default = unicable_choices_default) + nim.advanced.lnb[x].unicable = ConfigSelection(unicable_choices, unicable_choices_default) - nim.advanced.lnb[x].unicableLnb = unicableLnb - nim.advanced.lnb[x].unicableLnbManufacturer = ConfigSelection(choices = UnicableLnbManufacturers, default = UnicableLnbManufacturers[0]) + nim.advanced.lnb[x].unicableLnb = unicableLnb # is this okay? all lnb use the same ConfigSubDict ? ! ? + nim.advanced.lnb[x].unicableLnbManufacturer = ConfigSelection(UnicableLnbManufacturers, UnicableLnbManufacturers[0]) - nim.advanced.lnb[x].unicableMatrix = unicableMatrix - nim.advanced.lnb[x].unicableMatrixManufacturer = ConfigSelection(choices = UnicableMatrixManufacturers, default = UnicableMatrixManufacturers[0]) + nim.advanced.lnb[x].unicableMatrix = unicableMatrix # is this okay? all lnb use the same ConfigSubDict ? ! ? + nim.advanced.lnb[x].unicableMatrixManufacturer = ConfigSelection(UnicableMatrixManufacturers, UnicableMatrixManufacturers[0]) - nim.advanced.lnb[x].satcruser = ConfigSelection(choices=[ - ("1", "SatCR 1"), - ("2", "SatCR 2"), - ("3", "SatCR 3"), - ("4", "SatCR 4"), - ("5", "SatCR 5"), - ("6", "SatCR 6"), - ("7", "SatCR 7"), - ("8", "SatCR 8")], - default="1") - nim.advanced.lnb[x].satcrvcouser = satcrvcouser + nim.advanced.lnb[x].satcruser = ConfigSelection(advanced_lnb_satcruser_choices, "1") + nim.advanced.lnb[x].satcrvcouser = satcrvcouser # is this okay? all lnb use the same ConfigSubDict ? ! ? # nim.advanced.lnb[x].output_12v = ConfigSelection(choices = [("0V", _("0 V")), ("12V", _("12 V"))], default="0V") - nim.advanced.lnb[x].increased_voltage = ConfigYesNo(default=False) - nim.advanced.lnb[x].toneburst = ConfigSelection(choices = [("none", _("None")), ("A", _("A")), ("B", _("B"))], default = "none") + nim.advanced.lnb[x].increased_voltage = ConfigYesNo(False) + nim.advanced.lnb[x].toneburst = ConfigSelection(advanced_lnb_toneburst_choices, "none") if x > 32: - nim.advanced.lnb[x].diseqcMode = ConfigSelection(choices = [("1_2", _("1.2"))], default = "1_2") + nim.advanced.lnb[x].diseqcMode = ConfigSelection(advanced_lnb_allsat_diseqcmode_choices, "1_2") else: - nim.advanced.lnb[x].diseqcMode = ConfigSelection(choices = [("none", _("None")), ("1_0", _("1.0")), ("1_1", _("1.1")), ("1_2", _("1.2"))], default = "none") - nim.advanced.lnb[x].commitedDiseqcCommand = ConfigSelection(choices = csw) - nim.advanced.lnb[x].fastDiseqc = ConfigYesNo(default=False) - nim.advanced.lnb[x].sequenceRepeat = ConfigYesNo(default=False) - nim.advanced.lnb[x].commandOrder1_0 = ConfigSelection(choices = [("ct", "committed, toneburst"), ("tc", "toneburst, committed")], default = "ct") - nim.advanced.lnb[x].commandOrder = ConfigSelection(choices = [ - ("ct", "committed, toneburst"), - ("tc", "toneburst, committed"), - ("cut", "committed, uncommitted, toneburst"), - ("tcu", "toneburst, committed, uncommitted"), - ("uct", "uncommitted, committed, toneburst"), - ("tuc", "toneburst, uncommitted, commmitted")], - default="ct") - nim.advanced.lnb[x].uncommittedDiseqcCommand = ConfigSelection(choices = ucsw) - nim.advanced.lnb[x].diseqcRepeats = ConfigSelection(choices = [("none", _("None")), ("one", _("One")), ("two", _("Two")), ("three", _("Three"))], default = "none") + nim.advanced.lnb[x].diseqcMode = ConfigSelection(advanced_lnb_diseqcmode_choices, "none") + nim.advanced.lnb[x].commitedDiseqcCommand = ConfigSelection(advanced_lnb_csw_choices) + nim.advanced.lnb[x].fastDiseqc = ConfigYesNo(False) + nim.advanced.lnb[x].sequenceRepeat = ConfigYesNo(False) + nim.advanced.lnb[x].commandOrder1_0 = ConfigSelection(advanced_lnb_commandOrder1_0_choices, "ct") + nim.advanced.lnb[x].commandOrder = ConfigSelection(advanced_lnb_commandOrder_choices, "ct") + nim.advanced.lnb[x].uncommittedDiseqcCommand = ConfigSelection(advanced_lnb_ucsw_choices) + nim.advanced.lnb[x].diseqcRepeats = ConfigSelection(advanced_lnb_diseqc_repeat_choices, "none") nim.advanced.lnb[x].longitude = ConfigFloat(default = [5,100], limits = [(0,359),(0,999)]) - nim.advanced.lnb[x].longitudeOrientation = ConfigSelection(choices = [("east", _("East")), ("west", _("West"))], default = "east") + nim.advanced.lnb[x].longitudeOrientation = ConfigSelection(longitude_orientation_choices, "east") nim.advanced.lnb[x].latitude = ConfigFloat(default = [50,767], limits = [(0,359),(0,999)]) - nim.advanced.lnb[x].latitudeOrientation = ConfigSelection(choices = [("north", _("North")), ("south", _("South"))], default = "north") + nim.advanced.lnb[x].latitudeOrientation = ConfigSelection(latitude_orientation_choices, "north") nim.advanced.lnb[x].powerMeasurement = ConfigYesNo(default=True) nim.advanced.lnb[x].powerThreshold = ConfigInteger(default=hw.get_device_name() == "dm8000" and 15 or 50, limits=(0, 100)) - nim.advanced.lnb[x].turningSpeed = ConfigSelection(choices = [("fast", _("Fast")), ("slow", _("Slow")), ("fast epoch", _("Fast epoch"))], default = "fast") - btime = datetime(1970, 1, 1, 7, 0); - nim.advanced.lnb[x].fastTurningBegin = ConfigDateTime(default=mktime(btime.timetuple()), formatstring = _("%H:%M"), increment = 600) - etime = datetime(1970, 1, 1, 19, 0); - nim.advanced.lnb[x].fastTurningEnd = ConfigDateTime(default=mktime(etime.timetuple()), formatstring = _("%H:%M"), increment = 600) - nim.advanced.lnb[x].prio = ConfigSelection(default="-1", choices=prio_list) + nim.advanced.lnb[x].turningSpeed = ConfigSelection(turning_speed_choices, "fast") + nim.advanced.lnb[x].fastTurningBegin = ConfigDateTime(default=advanced_lnb_fast_turning_btime, formatstring = _("%H:%M"), increment = 600) + nim.advanced.lnb[x].fastTurningEnd = ConfigDateTime(default=advanced_lnb_fast_turning_etime, formatstring = _("%H:%M"), increment = 600) + nim.advanced.lnb[x].prio = ConfigSelection(prio_list, "-1") elif slot.isCompatible("DVB-C"): nim.configMode = ConfigSelection( choices = { -- cgit v1.2.3