From 7b7a80a1f979b0bd9c68aa33af968db25bf63f81 Mon Sep 17 00:00:00 2001 From: hschang Date: Mon, 29 Jun 2015 17:34:19 +0900 Subject: [PATCH] [unicable] Support JESS(EN50607) and update unicable.xml, thanks to adenin. --- data/unicable.xml | 183 ++++++++++++++++++-- lib/dvb/frontend.cpp | 2 +- lib/dvb/frontend.h | 2 + lib/dvb/idvb.h | 2 +- lib/dvb/sec.cpp | 235 ++++++++++++++++++++++---- lib/dvb/sec.h | 9 +- lib/python/Components/NimManager.py | 326 ++++++++++++++++++++++++------------ lib/python/Screens/Satconfig.py | 48 ++++-- 8 files changed, 635 insertions(+), 172 deletions(-) diff --git a/data/unicable.xml b/data/unicable.xml index 33951d7..d461bc5 100644 --- a/data/unicable.xml +++ b/data/unicable.xml @@ -1,5 +1,5 @@ - + - - + + + + + + + + + + + + + @@ -82,6 +96,18 @@ unicable (version) + + + + + + + + + + + + @@ -101,31 +127,116 @@ unicable (version) + + + + + + + + + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -142,28 +253,74 @@ unicable (version) + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index cf6ef6f..ae40483 100755 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -666,7 +666,7 @@ int eDVBFrontend::closeFrontend(bool force, bool no_delayed) { if (!no_delayed) { - m_sec->prepareTurnOffSatCR(*this, m_data[SATCR]); + m_sec->prepareTurnOffSatCR(*this); m_tuneTimer->start(0, true); if(!m_tuneTimer->isActive()) { diff --git a/lib/dvb/frontend.h b/lib/dvb/frontend.h index 3e8cdbd..11c5dfd 100644 --- a/lib/dvb/frontend.h +++ b/lib/dvb/frontend.h @@ -64,6 +64,8 @@ public: CUR_VOLTAGE, // current voltage CUR_TONE, // current continuous tone SATCR, // current SatCR + DICTION, // current diction + PIN, // pin NUM_DATA_ENTRIES }; Signal1 m_stateChanged; diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index da844c5..3dd3481 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -491,7 +491,7 @@ class iDVBSatelliteEquipmentControl: public iObject { public: virtual RESULT prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, const eDVBFrontendParametersSatellite &sat, int frontend_id, unsigned int timeout)=0; - virtual void prepareTurnOffSatCR(iDVBFrontend &frontend, int satcr)=0; + virtual void prepareTurnOffSatCR(iDVBFrontend &frontend)=0; virtual int canTune(const eDVBFrontendParametersSatellite &feparm, iDVBFrontend *fe, int frontend_id, int *highest_score_lnb=0)=0; virtual void setRotorMoving(int slotid, bool)=0; }; diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index 851e9b1..08976ef 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -330,7 +330,6 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA lnb_param.guard_offset = 0; //HACK - frontend.setData(eDVBFrontend::SATCR, lnb_param.SatCR_idx); if (diseqc13V) voltage_mode = eDVBSatelliteSwitchParameters::HV; @@ -400,21 +399,52 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA } else { - int tmp1 = abs(sat.frequency - -lof) - + lnb_param.SatCRvco - - 1400000 - + lnb_param.guard_offset; - int tmp2 = ((((tmp1 * 2) / 4000) + 1) / 2) * 4000; - parm.FREQUENCY = lnb_param.SatCRvco - (tmp1-tmp2) + lnb_param.guard_offset; - lnb_param.UnicableTuningWord = ((tmp2 / 4000) - | ((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, (lnb_param.UnicableTuningWord & 0x3FF) *4000 + 1400000 + lof - (2 * (lnb_param.SatCRvco - (tmp1-tmp2))) ); + switch(lnb_param.SatCR_format) + { + case 1: + { + eDebug("[prepare] JESS"); + + int tmp1 = abs(sat.frequency + -lof) + - 100000; + volatile unsigned int tmp2 = (1000 + 2 * tmp1) / (2 *1000); //round to multiple of 1000 + parm.FREQUENCY = lnb_param.SatCRvco - (tmp1 - (1000 * tmp2)); + frontend.setData(eDVBFrontend::FREQ_OFFSET, sat.frequency - lof -(lnb_param.SatCRvco - parm.FREQUENCY)); + + lnb_param.UnicableTuningWord = + (band & 0x3) //Bit0:HighLow Bit1:VertHor + | (((lnb_param.LNBNum - 1) & 0x3F) << 2) //position number (max. 63) + | ((tmp2 & 0x7FF)<< 8) //frequency (-100MHz Offset) + | ((lnb_param.SatCR_idx & 0x1F) << 19); //adresse of SatCR (max. 32) + + eDebug("[prepare] UnicableTuningWord %#06x",lnb_param.UnicableTuningWord); + } + break; + case 0: + default: + { + eDebug("[prepare] Unicable"); + int tmp1 = abs(sat.frequency + -lof) + + lnb_param.SatCRvco + - 1400000 + + lnb_param.guard_offset; + volatile unsigned int tmp2 = (4000 + 2 * tmp1) / (2 *4000); //round to multiple of 4000 + + parm.FREQUENCY = lnb_param.SatCRvco - (tmp1 - (4000 * tmp2)) + lnb_param.guard_offset; + lnb_param.UnicableTuningWord = tmp2 + | ((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, (lnb_param.UnicableTuningWord & 0x3FF) *4000 + 1400000 + lof - (2 * (lnb_param.SatCRvco - (tmp1 - (4000 * tmp2)))) ); + } + } voltage = VOLTAGE(13); } @@ -711,15 +741,104 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(18)) ); sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) ); sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_SWITCH_CMDS]) ); // wait 20 ms 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; + + long oldSatcr, oldPin, oldDiction; + frontend.getData(eDVBFrontend::SATCR, oldSatcr); + frontend.getData(eDVBFrontend::PIN, oldPin); + frontend.getData(eDVBFrontend::DICTION, oldDiction); + + if((oldSatcr != -1) && (oldSatcr != lnb_param.SatCR_idx)) + { + switch (oldDiction) + { + case 1: + if(oldPin < 1) + { + diseqc.len = 4; + diseqc.data[0] = 0x70; + } + else + { + diseqc.len = 5; + diseqc.data[0] = 0x71; + diseqc.data[4] = oldPin; + } + diseqc.data[1] = oldSatcr << 3; + diseqc.data[2] = 0x00; + diseqc.data[3] = 0x00; + break; + case 0: + default: + if(oldPin < 1) + { + diseqc.len = 5; + diseqc.data[2] = 0x5A; + } + else + { + diseqc.len = 6; + diseqc.data[2] = 0x5C; + diseqc.data[5] = oldPin; + } + diseqc.data[0] = 0xE0; + diseqc.data[1] = 0x10; + diseqc.data[3] = oldSatcr << 5; + diseqc.data[4] = 0x00; + break; + } + sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_LAST_DISEQC_CMD]) ); + frontend.setData(eDVBFrontend::SATCR, -1); + } + + frontend.setData(eDVBFrontend::DICTION, lnb_param.SatCR_format); +//TODO frontend.setData(eDVBFrontend::PIN, lnb_param.SatCR_pin); + + long pin = 0; // hack + + switch(lnb_param.SatCR_format) + { + case 1: //JESS + if(pin < 1) + { + diseqc.len = 4; + diseqc.data[0] = 0x70; + diseqc.data[1] = lnb_param.UnicableTuningWord >> 16; + diseqc.data[2] = lnb_param.UnicableTuningWord >> 8; + diseqc.data[3] = lnb_param.UnicableTuningWord; + } + else + { + diseqc.len = 5; + diseqc.data[0] = 0x71; + diseqc.data[4] = pin; + } + diseqc.data[1] = lnb_param.UnicableTuningWord >> 16; + diseqc.data[2] = lnb_param.UnicableTuningWord >> 8; + diseqc.data[3] = lnb_param.UnicableTuningWord; + break; + case 0: //DiSEqC + default: + if(pin < 1) + { + diseqc.len = 5; + diseqc.data[2] = 0x5A; + } + else + { + diseqc.len = 6; + diseqc.data[2] = 0x5C; + diseqc.data[5] = pin; + } + diseqc.data[0] = 0xE0; + diseqc.data[1] = 0x10; + diseqc.data[3] = lnb_param.UnicableTuningWord >> 8; + diseqc.data[4] = lnb_param.UnicableTuningWord; + } + frontend.setData(eDVBFrontend::SATCR, lnb_param.SatCR_idx); sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) ); sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_LAST_DISEQC_CMD]) ); @@ -954,8 +1073,9 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA return -1; } -void eDVBSatelliteEquipmentControl::prepareTurnOffSatCR(iDVBFrontend &frontend, int satcr) +void eDVBSatelliteEquipmentControl::prepareTurnOffSatCR(iDVBFrontend &frontend) { + long satcr, diction, pin; eSecCommandList sec_sequence; // check if voltage is disabled @@ -973,12 +1093,48 @@ void eDVBSatelliteEquipmentControl::prepareTurnOffSatCR(iDVBFrontend &frontend, 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; + frontend.getData(eDVBFrontend::SATCR, satcr); + frontend.getData(eDVBFrontend::DICTION, diction); + frontend.getData(eDVBFrontend::PIN, pin); + + switch (diction) + { + case 1: + if(pin < 1) + { + diseqc.len = 4; + diseqc.data[0] = 0x70; + } + else + { + diseqc.len = 5; + diseqc.data[0] = 0x71; + diseqc.data[4] = pin; + } + diseqc.data[1] = satcr << 3; + diseqc.data[2] = 0x00; + diseqc.data[3] = 0x00; + break; + case 0: + default: + if(pin < 1) + { + diseqc.len = 5; + diseqc.data[2] = 0x5A; + } + else + { + diseqc.len = 6; + diseqc.data[2] = 0x5C; + diseqc.data[5] = pin; + } + diseqc.data[0] = 0xE0; + diseqc.data[1] = 0x10; + diseqc.data[3] = satcr << 5; + diseqc.data[4] = 0x00; + break; + } + frontend.setData(eDVBFrontend::SATCR, -1); sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) ); sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_LAST_DISEQC_CMD]) ); @@ -1254,6 +1410,18 @@ RESULT eDVBSatelliteEquipmentControl::setInputpowerDelta(int delta) } /* Unicable Specific Parameters */ +RESULT eDVBSatelliteEquipmentControl::setLNBSatCRformat(int SatCR_format) +{ + eSecDebug("eDVBSatelliteEquipmentControl::setLNBSatCRformat(%d)", SatCR_format); + if(!((SatCR_format >-1) && (SatCR_format < 2))) + return -EPERM; + if ( currentLNBValid() ) + m_lnbs[m_lnbidx].SatCR_format = SatCR_format; + else + return -ENOENT; + return 0; +} + RESULT eDVBSatelliteEquipmentControl::setLNBSatCR(int SatCR_idx) { eSecDebug("eDVBSatelliteEquipmentControl::setLNBSatCR(%d)", SatCR_idx); @@ -1299,6 +1467,13 @@ RESULT eDVBSatelliteEquipmentControl::getLNBSatCRpositions() return -ENOENT; } +RESULT eDVBSatelliteEquipmentControl::getLNBSatCRformat() +{ + if ( currentLNBValid() ) + return m_lnbs[m_lnbidx].SatCR_format; + return -ENOENT; +} + RESULT eDVBSatelliteEquipmentControl::getLNBSatCR() { if ( currentLNBValid() ) diff --git a/lib/dvb/sec.h b/lib/dvb/sec.h index ef8b1e0..ca3e7f2 100644 --- a/lib/dvb/sec.h +++ b/lib/dvb/sec.h @@ -260,11 +260,12 @@ public: #define guard_offset_min -8000 #define guard_offset_max 8000 #define guard_offset_step 8000 -#define MAX_SATCR 8 -#define MAX_LNBNUM 32 +#define MAX_SATCR 32 +#define MAX_LNBNUM 64 int SatCR_positions; int SatCR_idx; + int SatCR_format; unsigned int SatCRvco; unsigned int UnicableTuningWord; unsigned int UnicableConfigWord; @@ -323,7 +324,7 @@ public: #ifndef SWIG eDVBSatelliteEquipmentControl(eSmartPtrList &avail_frontends, eSmartPtrList &avail_simulate_frontends); RESULT prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, const eDVBFrontendParametersSatellite &sat, int frontend_id, unsigned int tunetimeout); - void prepareTurnOffSatCR(iDVBFrontend &frontend, int satcr); // used for unicable + void prepareTurnOffSatCR(iDVBFrontend &frontend); // used for unicable int canTune(const eDVBFrontendParametersSatellite &feparm, iDVBFrontend *, int frontend_id, int *highest_score_lnb=0); bool currentLNBValid() { return m_lnbidx > -1 && m_lnbidx < (int)(sizeof(m_lnbs) / sizeof(eDVBSatelliteLNBParameters)); } #endif @@ -357,9 +358,11 @@ public: RESULT setInputpowerDelta(int delta); // delta between running and stopped rotor RESULT setRotorTurningSpeed(int speed); // set turning speed.. /* Unicable Specific Parameters */ + RESULT setLNBSatCRformat(int SatCR_format); //DiSEqc or JESS (or ...) RESULT setLNBSatCR(int SatCR_idx); RESULT setLNBSatCRvco(int SatCRvco); RESULT setLNBSatCRpositions(int SatCR_positions); + RESULT getLNBSatCRformat(); //DiSEqc or JESS (or ...) RESULT getLNBSatCR(); RESULT getLNBSatCRvco(); RESULT getLNBSatCRpositions(); diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index c68e521..ce063b4 100755 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -265,7 +265,7 @@ class SecConfigure: pass lnbSat = {} - for x in range(1,37): + for x in range(1,69): lnbSat[x] = [] #wildcard for all satellites ( for rotor ) @@ -282,12 +282,12 @@ class SecConfigure: print "add", x[0], "to", lnb lnbSat[lnb].append(x[0]) - for x in range(1,37): + for x in range(1,69): if len(lnbSat[x]) > 0: currLnb = config.Nims[slotid].advanced.lnb[x] sec.addLNB() - if x < 33: + if x < 65: sec.setLNBNum(x) tunermask = 1 << slotid @@ -310,24 +310,46 @@ class SecConfigure: manufacturer_name = configManufacturer.value manufacturer = ProductDict[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) - sec.setLNBSatCRpositions(manufacturer.positions[product_name][0].value) - sec.setLNBLOFL(manufacturer.lofl[product_name][0].value * 1000) - sec.setLNBLOFH(manufacturer.lofh[product_name][0].value * 1000) - sec.setLNBThreshold(manufacturer.loft[product_name][0].value * 1000) - configManufacturer.save_forced = True - manufacturer.product.save_forced = True - manufacturer.vco[product_name][manufacturer.scr[product_name].index].save_forced = True - + manufacturer_scr = manufacturer.scr + manufacturer_positions_value = manufacturer.positions[product_name][0].value + position_idx = (x-1) % manufacturer_positions_value + if product_name in manufacturer_scr: + diction = manufacturer.diction[product_name].value + if x <= manufacturer_positions_value or diction !="EN50607": #for every allowed position + sec.setLNBSatCR(manufacturer_scr[product_name].index) + + if diction =="EN50607": + sec.setLNBSatCRformat(1) #JESS + else: + sec.setLNBSatCRformat(0) #DiSEqC + sec.setLNBSatCRvco(manufacturer.vco[product_name][manufacturer_scr[product_name].index].value*1000) + sec.setLNBSatCRpositions(manufacturer_positions_value) + sec.setLNBLOFL(manufacturer.lofl[product_name][position_idx].value * 1000) + sec.setLNBLOFH(manufacturer.lofh[product_name][position_idx].value * 1000) + sec.setLNBThreshold(manufacturer.loft[product_name][position_idx].value * 1000) + configManufacturer.save_forced = True + manufacturer.product.save_forced = True + manufacturer.vco[product_name][manufacturer_scr[product_name].index].save_forced = True + else: #positionnumber out of range + print "positionnumber out of range" + else: + print "no product in list" + if currLnb.unicable.value == "unicable_user": #TODO satpositions for satcruser + if currLnb.dictionuser.value == "EN50607": + sec.setLNBSatCRformat(1) + sec.setLNBSatCR(currLnb.satcruserEN50607.index) + sec.setLNBSatCRvco(currLnb.satcrvcouserEN50607[currLnb.satcruserEN50607.index].value*1000) + else: + sec.setLNBSatCRformat(0) + sec.setLNBSatCR(currLnb.satcruserEN50494.index) + sec.setLNBSatCRvco(currLnb.satcrvcouserEN50494[currLnb.satcruserEN50494.index].value*1000) + sec.setLNBLOFL(currLnb.lofl.value * 1000) sec.setLNBLOFH(currLnb.lofh.value * 1000) sec.setLNBThreshold(currLnb.threshold.value * 1000) - sec.setLNBSatCR(currLnb.satcruser.index) - sec.setLNBSatCRvco(currLnb.satcrvcouser[currLnb.satcruser.index].value*1000) - sec.setLNBSatCRpositions(1) #HACK + sec.setLNBSatCRpositions(64) #HACK elif currLnb.unicable.value == "unicable_matrix": setupUnicable(currLnb.unicableMatrixManufacturer, currLnb.unicableMatrix) elif currLnb.unicable.value == "unicable_lnb": @@ -452,8 +474,8 @@ class SecConfigure: # finally add the orbital positions for y in lnbSat[x]: self.addSatellite(sec, y) - if x > 32: - satpos = x > 32 and (3604-(36 - x)) or y + if x > 64: + satpos = x > 64 and (3604-(68 - x)) or y else: satpos = y currSat = config.Nims[slotid].advanced.sat[satpos] @@ -474,7 +496,7 @@ class SecConfigure: elif currSat.tonemode.value == "off": sec.setToneMode(switchParam.OFF) - if not currSat.usals.value and x < 34: + if not currSat.usals.value and x < 66: sec.setRotorPosNum(currSat.rotorposition.value) else: sec.setRotorPosNum(0) #USALS @@ -1122,11 +1144,15 @@ def InitNimManager(nimmgr): root = doc.getroot() entry = root.find("lnb") + lscr=("scr1","scr2","scr3","scr4","scr5","scr6","scr7","scr8","scr9","scr10", + "scr11","scr12","scr13","scr14","scr15","scr16","scr17","scr18","scr19","scr20", + "scr21","scr22","scr23","scr24","scr25","scr26","scr27","scr28","scr29","scr30", + "scr31","scr32") for manufacturer in entry.getchildren(): m={} for product in manufacturer.getchildren(): + p={} #new dict empty for new product scr=[] - lscr=("scr1","scr2","scr3","scr4","scr5","scr6","scr7","scr8") for i in range(len(lscr)): scr.append(product.get(lscr[i],"0")) for i in range(len(lscr)): @@ -1134,21 +1160,36 @@ def InitNimManager(nimmgr): scr.pop() else: break; - lof=[] - lof.append(int(product.get("positions",1))) - lof.append(int(product.get("lofl",9750))) - lof.append(int(product.get("lofh",10600))) - lof.append(int(product.get("threshold",11700))) - scr.append(tuple(lof)) - m.update({product.get("name"):tuple(scr)}) + + p.update({"frequencies":tuple(scr)}) #add scr frequencies to dict product + + diction = product.get("format","EN50494").upper() + if diction =="JESS" or diction =="UNICABLE2" or diction =="SCD2" or diction =="EN50607": + diction = "EN50607" + else: + diction = "EN50494" + p.update({"diction":tuple([diction])}) #add diction to dict product + + positions=[] + positions.append(int(product.get("positions",1))) + for cnt in range(positions[0]): + lof=[] + lof.append(int(product.get("lofl",9750))) + lof.append(int(product.get("lofh",10600))) + lof.append(int(product.get("threshold",11700))) + positions.append(tuple(lof)) + + p.update({"positions":tuple(positions)}) #add positons to dict product. + + m.update({product.get("name"):p}) #add dict product to dict manufacturer unicablelnbproducts.update({manufacturer.get("name"):m}) entry = root.find("matrix") for manufacturer in entry.getchildren(): m={} for product in manufacturer.getchildren(): + p={} #new dict empty for new product scr=[] - lscr=("scr1","scr2","scr3","scr4","scr5","scr6","scr7","scr8") for i in range(len(lscr)): scr.append(product.get(lscr[i],"0")) for i in range(len(lscr)): @@ -1156,14 +1197,29 @@ def InitNimManager(nimmgr): scr.pop() else: break; - lof=[] - lof.append(int(product.get("positions",1))) - lof.append(int(product.get("lofl",9750))) - lof.append(int(product.get("lofh",10600))) - lof.append(int(product.get("threshold",11700))) - scr.append(tuple(lof)) - m.update({product.get("name"):tuple(scr)}) - unicablematrixproducts.update({manufacturer.get("name"):m}) + + p.update({"frequencies":tuple(scr)}) #add scr frequencies to dict product + + diction = product.get("format","EN50494").upper() + if diction =="JESS" or diction =="UNICABLE2" or diction =="SCD2" or diction =="EN50607": + diction = "EN50607" + else: + diction = "EN50494" + p.update({"diction":tuple([diction])}) #add diction to dict product + + positions=[] + positions.append(int(product.get("positions",1))) + for cnt in range(positions[0]): + lof=[] + lof.append(int(product.get("lofl",9750))) + lof.append(int(product.get("lofh",10600))) + lof.append(int(product.get("threshold",11700))) + positions.append(tuple(lof)) + + p.update({"positions":tuple(positions)}) #add positons to dict product + + m.update({product.get("name"):p}) #add dict product to dict manufacturer + unicablematrixproducts.update({manufacturer.get("name"):m}) #add dict manufacturer to dict unicablematrixproducts UnicableLnbManufacturers = unicablelnbproducts.keys() UnicableLnbManufacturers.sort() @@ -1176,8 +1232,14 @@ def InitNimManager(nimmgr): "unicable_user": "Unicable "+_("User defined")} unicable_choices_default = "unicable_lnb" - 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")] + advanced_lnb_satcr_user_choicesEN50494 = [("1", "SatCR 1"), ("2", "SatCR 2"), ("3", "SatCR 3"), ("4", "SatCR 4"), ("5", "SatCR 5"), ("6", "SatCR 6"), ("7", "SatCR 7"), ("8", "SatCR 8")] + + advanced_lnb_satcr_user_choicesEN50607 = [("1", "SatCR 1"), ("2", "SatCR 2"), ("3", "SatCR 3"), ("4", "SatCR 4"), ("5", "SatCR 5"), ("6", "SatCR 6"), ("7", "SatCR 7"), ("8", "SatCR 8"), + ("9", "SatCR 9"), ("10", "SatCR 10"), ("11", "SatCR 11"), ("12", "SatCR 12"), ("13", "SatCR 13"), ("14", "SatCR 14"), ("15", "SatCR 15"), ("16", "SatCR 16"), + ("17", "SatCR 17"), ("18", "SatCR 18"), ("19", "SatCR 19"), ("20", "SatCR 20"), ("21", "SatCR 21"), ("22", "SatCR 22"), ("23", "SatCR 23"), ("24", "SatCR 24"), + ("25", "SatCR 25"), ("26", "SatCR 26"), ("27", "SatCR 27"), ("28", "SatCR 28"), ("29", "SatCR 29"), ("30", "SatCR 30"), ("31", "SatCR 31"), ("32", "SatCR 32")] + + advanced_lnb_diction_user_choices = [("EN50494", "Unicable(EN50494)"), ("EN50607", "JESS(EN50607)")] prio_list = [ ("-1", _("Auto")) ] prio_list += [(str(prio), str(prio)) for prio in range(65)+range(14000,14065)+range(19000,19065)] @@ -1203,7 +1265,7 @@ def InitNimManager(nimmgr): 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_lnb_choices = [("0", "not available")] + [(str(y), "LNB " + str(y)) for y in range(1, 65)] 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"))] @@ -1228,81 +1290,127 @@ def InitNimManager(nimmgr): if isinstance(section.unicable, ConfigNothing): if lnb == 1: section.unicable = ConfigSelection(unicable_choices, unicable_choices_default) - elif lnb == 2: - section.unicable = ConfigSelection(choices = {"unicable_matrix": _("Unicable Martix"),"unicable_user": "Unicable "+_("User defined")}, default = "unicable_matrix") +# elif lnb == 2: else: - section.unicable = ConfigSelection(choices = {"unicable_user": _("User defined")}, default = "unicable_user") - - def fillUnicableConf(sectionDict, unicableproducts, vco_null_check): - for y in unicableproducts: - products = unicableproducts[y].keys() - products.sort() - tmp = ConfigSubsection() - tmp.product = ConfigSelection(choices = products, default = products[0]) - tmp.scr = ConfigSubDict() - tmp.vco = ConfigSubDict() - tmp.lofl = ConfigSubDict() - tmp.lofh = ConfigSubDict() - tmp.loft = ConfigSubDict() - tmp.positions = ConfigSubDict() - for z in products: + section.unicable = ConfigSelection(choices = {"unicable_matrix": _("Unicable Martix"),"unicable_user": "Unicable "+_("User defined")}, default = "unicable_matrix") +# section.unicable = ConfigSelection(choices = {"unicable_user": _("User defined")}, default = "unicable_user") + def fillUnicableConf(sectionDict, unicableproducts, vco_null_check): + for manufacturer in unicableproducts: + products = unicableproducts[manufacturer].keys() + products.sort() + products_valide = [] + products_valide_append = products_valide.append + tmp = ConfigSubsection() + tmp.scr = ConfigSubDict() + tmp.vco = ConfigSubDict() + tmp.lofl = ConfigSubDict() + tmp.lofh = ConfigSubDict() + tmp.loft = ConfigSubDict() + tmp.positions = ConfigSubDict() + tmp.diction = ConfigSubDict() + for article in products: + positionslist = unicableproducts[manufacturer][article].get("positions") + positions = int(positionslist[0]) + dictionlist = [unicableproducts[manufacturer][article].get("diction")] + if lnb <= positions or dictionlist[0][0] !="EN50607": + tmp.positions[article] = ConfigSubList() + tmp.positions[article].append(ConfigInteger(default=positions, limits = (positions, positions))) + tmp.diction[article] = ConfigSelection(choices = dictionlist, default = dictionlist[0][0]) + scrlist = [] - vcolist = unicableproducts[y][z] - tmp.vco[z] = ConfigSubList() - for cnt in range(1,1+len(vcolist)-1): + scrlist_append = scrlist.append + vcolist=unicableproducts[manufacturer][article].get("frequencies") + tmp.vco[article] = ConfigSubList() + for cnt in range(1,len(vcolist)+1): vcofreq = int(vcolist[cnt-1]) if vcofreq == 0 and vco_null_check: - scrlist.append(("%d" %cnt,"SCR %d " %cnt +_("not used"))) + scrlist_append(("%d" %cnt,"SCR %d " %cnt +_("not used"))) else: - scrlist.append(("%d" %cnt,"SCR %d" %cnt)) - tmp.vco[z].append(ConfigInteger(default=vcofreq, limits = (vcofreq, vcofreq))) - tmp.scr[z] = ConfigSelection(choices = scrlist, default = scrlist[0][0]) - - positions = int(vcolist[len(vcolist)-1][0]) - tmp.positions[z] = ConfigSubList() - tmp.positions[z].append(ConfigInteger(default=positions, limits = (positions, positions))) - - lofl = vcolist[len(vcolist)-1][1] - tmp.lofl[z] = ConfigSubList() - tmp.lofl[z].append(ConfigInteger(default=lofl, limits = (lofl, lofl))) - - lofh = int(vcolist[len(vcolist)-1][2]) - tmp.lofh[z] = ConfigSubList() - tmp.lofh[z].append(ConfigInteger(default=lofh, limits = (lofh, lofh))) - - loft = int(vcolist[len(vcolist)-1][3]) - tmp.loft[z] = ConfigSubList() - tmp.loft[z].append(ConfigInteger(default=loft, limits = (loft, loft))) - sectionDict[y] = tmp - - if lnb < 3: - print "MATRIX" - section.unicableMatrix = ConfigSubDict() - section.unicableMatrixManufacturer = ConfigSelection(UnicableMatrixManufacturers, UnicableMatrixManufacturers[0]) - fillUnicableConf(section.unicableMatrix, unicablematrixproducts, True) - - if lnb < 2: - print "LNB" - section.unicableLnb = ConfigSubDict() - section.unicableLnbManufacturer = ConfigSelection(UnicableLnbManufacturers, UnicableLnbManufacturers[0]) - fillUnicableConf(section.unicableLnb, unicablelnbproducts, False) + scrlist_append(("%d" %cnt,"SCR %d" %cnt)) + tmp.vco[article].append(ConfigInteger(default=vcofreq, limits = (vcofreq, vcofreq))) + + tmp.scr[article] = ConfigSelection(choices = scrlist, default = scrlist[0][0]) + + tmp.lofl[article] = ConfigSubList() + tmp.lofh[article] = ConfigSubList() + tmp.loft[article] = ConfigSubList() + + tmp_lofl_article_append = tmp.lofl[article].append + tmp_lofh_article_append = tmp.lofh[article].append + tmp_loft_article_append = tmp.loft[article].append + + for cnt in range(1,positions+1): + lofl = int(positionslist[cnt][0]) + lofh = int(positionslist[cnt][1]) + loft = int(positionslist[cnt][2]) + tmp_lofl_article_append(ConfigInteger(default=lofl, limits = (lofl, lofl))) + tmp_lofh_article_append(ConfigInteger(default=lofh, limits = (lofh, lofh))) + tmp_loft_article_append(ConfigInteger(default=loft, limits = (loft, loft))) + products_valide_append(article) + + if len(products_valide)==0: + products_valide_append("None") + tmp.product = ConfigSelection(choices = products_valide, default = products_valide[0]) + sectionDict[manufacturer] = tmp + + if lnb < 65: + print "MATRIX" + section.unicableMatrix = ConfigSubDict() + section.unicableMatrixManufacturer = ConfigSelection(UnicableMatrixManufacturers, UnicableMatrixManufacturers[0]) + fillUnicableConf(section.unicableMatrix, unicablematrixproducts, True) + + if lnb < 2: #Konfiguration nur fuer LNB1 zulassen + print "LNB" + section.unicableLnb = ConfigSubDict() + section.unicableLnbManufacturer = ConfigSelection(UnicableLnbManufacturers, UnicableLnbManufacturers[0]) + fillUnicableConf(section.unicableLnb, unicablelnbproducts, False) #TODO satpositions for satcruser - section.satcruser = ConfigSelection(advanced_lnb_satcruser_choices, default="1") - tmp = ConfigSubList() - tmp.append(ConfigInteger(default=1284, limits = (950, 2150))) - tmp.append(ConfigInteger(default=1400, limits = (950, 2150))) - tmp.append(ConfigInteger(default=1516, limits = (950, 2150))) - tmp.append(ConfigInteger(default=1632, limits = (950, 2150))) - tmp.append(ConfigInteger(default=1748, limits = (950, 2150))) - tmp.append(ConfigInteger(default=1864, limits = (950, 2150))) - tmp.append(ConfigInteger(default=1980, limits = (950, 2150))) - tmp.append(ConfigInteger(default=2096, limits = (950, 2150))) - section.satcrvcouser = tmp - - nim.advanced.unicableconnected = ConfigYesNo(default=False) - nim.advanced.unicableconnectedTo = ConfigSelection([(str(id), nimmgr.getNimDescription(id)) for id in nimmgr.getNimListOfType("DVB-S") if id != x]) - + + section.dictionuser = ConfigSelection(advanced_lnb_diction_user_choices, default="EN50494") + section.satcruserEN50494 = ConfigSelection(advanced_lnb_satcr_user_choicesEN50494, default="1") + section.satcruserEN50607 = ConfigSelection(advanced_lnb_satcr_user_choicesEN50607, default="1") + + tmp = ConfigSubList() + tmp.append(ConfigInteger(default=1284, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1400, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1516, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1632, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1748, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1864, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1980, limits = (950, 2150))) + tmp.append(ConfigInteger(default=2096, limits = (950, 2150))) + section.satcrvcouserEN50494 = tmp + + tmp.append(ConfigInteger(default=1284, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1400, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1516, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1632, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1748, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1864, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1980, limits = (950, 2150))) + tmp.append(ConfigInteger(default=2096, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1284, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1400, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1516, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1632, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1748, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1864, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1980, limits = (950, 2150))) + tmp.append(ConfigInteger(default=2096, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1284, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1400, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1516, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1632, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1748, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1864, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1980, limits = (950, 2150))) + tmp.append(ConfigInteger(default=2096, limits = (950, 2150))) + section.satcrvcouserEN50607 = tmp + + nim.advanced.unicableconnected = ConfigYesNo(default=False) + nim.advanced.unicableconnectedTo = ConfigSelection([(str(id), nimmgr.getNimDescription(id)) for id in nimmgr.getNimListOfType("DVB-S") if id != x]) + def configDiSEqCModeChanged(configElement): section = configElement.section if configElement.value == "1_2" and isinstance(section.longitude, ConfigNothing): @@ -1333,7 +1441,7 @@ def InitNimManager(nimmgr): section.increased_voltage = ConfigYesNo(False) section.toneburst = ConfigSelection(advanced_lnb_toneburst_choices, "none") section.longitude = ConfigNothing() - if lnb > 32: + if lnb > 64: tmp = ConfigSelection(advanced_lnb_allsat_diseqcmode_choices, "1_2") tmp.section = section configDiSEqCModeChanged(tmp) @@ -1384,7 +1492,7 @@ def InitNimManager(nimmgr): tmp.tonemode = ConfigSelection(advanced_tonemode_choices, "band") tmp.usals = ConfigYesNo(default=True) tmp.rotorposition = ConfigInteger(default=1, limits=(1, 255)) - lnbnum = 33+x-3601 + lnbnum = 65+x-3601 lnb = ConfigSelection([("0", "not available"), (str(lnbnum), "LNB %d"%(lnbnum))], "0") lnb.slot_id = slot_id lnb.addNotifier(configLNBChanged, initial_call = False) diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index bce6525..c5366f9 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -95,6 +95,7 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): self.advancedType = None self.advancedManufacturer = None self.advancedSCR = None + self.advancedDiction = None self.advancedConnected = None if self.nim.isMultiType(): @@ -206,7 +207,7 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): 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.advancedConnected, \ + self.advancedType, self.advancedSCR, self.advancedDiction, self.advancedManufacturer, self.advancedUnicable, self.advancedConnected, \ self.uncommittedDiseqcCommand, self.cableScanType, self.multiType) if self["config"].getCurrent() == self.multiType: from Components.NimManager import InitNimManager @@ -236,7 +237,7 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): def fillListWithAdvancedSatEntrys(self, Sat): lnbnum = int(Sat.lnb.value) currLnb = self.nimConfig.advanced.lnb[lnbnum] - + diction = None if isinstance(currLnb, ConfigNothing): currLnb = None @@ -258,34 +259,51 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): 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.advancedDiction = getConfigListEntry(_("Diction"), currLnb.dictionuser) + self.list.append(self.advancedDiction) + + if currLnb.dictionuser.value == "EN50494": + satcr = currLnb.satcruserEN50494 + stcrvco = currLnb.satcrvcouserEN50494[currLnb.satcruserEN50494.index] + elif currLnb.dictionuser.value == "EN50607": + satcr = currLnb.satcruserEN50607 + stcrvco = currLnb.satcrvcouserEN50607[currLnb.satcruserEN50607.index] + + self.advancedSCR = getConfigListEntry(_("Channel"), satcr) self.list.append(self.advancedSCR) - self.list.append(getConfigListEntry(_("Frequency"), currLnb.satcrvcouser[currLnb.satcruser.index])) + self.list.append(getConfigListEntry(_("Frequency"), stcrvco)) + 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] +# if "product" in manufacturer.content: 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])) + if product_name in manufacturer.scr: + diction = manufacturer.diction[product_name].value + self.advancedType = getConfigListEntry(_("Type"), manufacturer.product) + self.advancedSCR = getConfigListEntry(_("Channel"), manufacturer.scr[product_name]) + 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] +# if "product" in manufacturer.content: 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])) + if product_name in manufacturer.scr: + diction = manufacturer.diction[product_name].value + self.advancedType = getConfigListEntry(_("Type"), manufacturer.product) + self.advancedSCR = getConfigListEntry(_("Channel"), manufacturer.scr[product_name]) + self.list.append(self.advancedType) + self.list.append(self.advancedSCR) + self.list.append(getConfigListEntry(_("Frequency"), manufacturer.vco[product_name][manufacturer.scr[product_name].index])) choices = [] connectable = nimmanager.canConnectTo(self.slotid) @@ -303,7 +321,7 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): self.list.append(getConfigListEntry(_("Increased voltage"), currLnb.increased_voltage)) self.list.append(getConfigListEntry(_("Tone mode"), Sat.tonemode)) - if lnbnum < 33: + if lnbnum < 65 and diction !="EN50607": self.advancedDiseqcMode = getConfigListEntry(_("DiSEqC mode"), currLnb.diseqcMode) self.list.append(self.advancedDiseqcMode) if currLnb.diseqcMode.value != "none": -- 2.7.4