Skip to content

Commit

Permalink
add jess mode thx adenin
Browse files Browse the repository at this point in the history
  • Loading branch information
Captain committed Apr 16, 2015
1 parent 88af85b commit cb18d2f
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 44 deletions.
113 changes: 91 additions & 22 deletions lib/dvb/sec.cpp
Expand Up @@ -391,7 +391,8 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, const eDVB
// calc Frequency
int local= abs(sat.frequency
- lof);
frequency = ((((local * 2) / 125) + 1) / 2) * 125;
volatile unsigned int tmp= (125 + 2 * local) / (2 * 125); //round to multiple of 125
frequency = 125 * tmp;
frontend.setData(eDVBFrontend::FREQ_OFFSET, sat.frequency - frequency);

/* Dishpro bandstacking HACK */
Expand All @@ -414,22 +415,47 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, const eDVB
}
else
{
int tmp1 = abs(sat.frequency
-lof)
+ lnb_param.SatCRvco
- 1400000
+ lnb_param.guard_offset;
int tmp2 = ((((tmp1 * 2) / 4000) + 1) / 2) * 4000;
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 4000
frequency = lnb_param.SatCRvco - (tmp1 - (1000 * tmp2));
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);
frontend.setData(eDVBFrontend::FREQ_OFFSET, lnb_param.SatCRvco);
}
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
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);
}
}

if (diseqc_mode >= eDVBSatelliteDiseqcParameters::V1_0)
Expand Down Expand Up @@ -728,15 +754,39 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, const eDVB

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;
switch(lnb_param.SatCR_format)
{
case 1: //JESS
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;
break;
case 0: //DiSEqC
default:
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]) );
//>>> HACK (adenin20150413)
eDVBDiseqcCommand jess;
memset(jess.data, 0, MAX_DISEQC_LENGTH);
jess.len = 4;
jess.data[0] = 0x70;
jess.data[1] = satcr << 3;
jess.data[2] = 0x00;
jess.data[3] = 0x00;

sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, jess) );
sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_LAST_DISEQC_CMD]) );
//<<< End of HACK (adenin20150413)
sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(13)) );
if ( RotorCmd != -1 && RotorCmd != lastRotorCmd && !rotor_param.m_inputpower_parameters.m_use)
sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MOTOR_CMD]) ); // wait 150msec after voltage change
Expand Down Expand Up @@ -1268,6 +1318,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);
Expand Down Expand Up @@ -1313,6 +1375,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() )
Expand Down
7 changes: 5 additions & 2 deletions lib/dvb/sec.h
Expand Up @@ -260,11 +260,12 @@ class eDVBSatelliteLNBParameters
#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;
Expand Down Expand Up @@ -357,9 +358,11 @@ class eDVBSatelliteEquipmentControl: public iDVBSatelliteEquipmentControl
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();
Expand Down
50 changes: 31 additions & 19 deletions lib/python/Components/NimManager.py
Expand Up @@ -338,9 +338,9 @@ def updateAdvanced(self, sec, slotid):
elif currLnb.lof.value == "unicable" or currLnb.lof.value == "jess":
def setupUnicable(configManufacturer, ProductDict):
if currLnb.lof.value == "jess":
print "jess mode switch function coming soon"
sec.setLNBSatCRformat(1) #JESS
else:
print "unicable mode switch function coming soon"
sec.setLNBSatCRformat(0) #DiSEqC
manufacturer_name = configManufacturer.value
manufacturer = ProductDict[manufacturer_name]
product_name = manufacturer.product.value
Expand Down Expand Up @@ -1189,7 +1189,9 @@ def InitNimManager(nimmgr):
m={}
for product in manufacturer.getchildren():
scr=[]
lscr=("scr1","scr2","scr3","scr4","scr5","scr6","scr7","scr8","scr9","scr10","scr11","scr12")
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 i in range(len(lscr)):
scr.append(product.get(lscr[i],"0"))
for i in range(len(lscr)):
Expand All @@ -1198,6 +1200,7 @@ def InitNimManager(nimmgr):
else:
break
lof= [int(product.get("positions", 1)), int(product.get("lofl", 9750)), int(product.get("lofh", 10600)), int(product.get("threshold", 11700))]
scr.append(product.get("format","DiSEqC"))
scr.append(tuple(lof))
m.update({product.get("name"):tuple(scr)})
unicablelnbproducts.update({manufacturer.get("name"):m})
Expand All @@ -1207,7 +1210,9 @@ def InitNimManager(nimmgr):
m={}
for product in manufacturer.getchildren():
scr=[]
lscr=("scr1","scr2","scr3","scr4","scr5","scr6","scr7","scr8","scr9","scr10","scr11","scr12")
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 i in range(len(lscr)):
scr.append(product.get(lscr[i],"0"))
for i in range(len(lscr)):
Expand All @@ -1216,6 +1221,7 @@ def InitNimManager(nimmgr):
else:
break
lof= [int(product.get("positions", 1)), int(product.get("lofl", 9750)), int(product.get("lofh", 10600)), int(product.get("threshold", 11700))]
scr.append(product.get("format","DiSEqC"))
scr.append(tuple(lof))
m.update({product.get("name"):tuple(scr)})
unicablematrixproducts.update({manufacturer.get("name"):m})
Expand Down Expand Up @@ -1289,10 +1295,13 @@ def configLOFChanged(configElement):

if configElement.value == "jess":
advanced_lnb_satcruser_choices = [ ("1", "ID 1"), ("2", "ID 2"), ("3", "ID 3"), ("4", "ID 4"),
("5", "ID 5"), ("6", "ID 6"), ("7", "ID 7"), ("8", "ID8"),("9", "ID 9"), ("10", "ID 10"), ("11", "ID 11"), ("12", "ID 12")]
("5", "ID 5"), ("6", "ID 6"), ("7", "ID 7"), ("8", "ID 8"),("9", "ID 9"), ("10", "ID 10"), ("11", "ID 11"), ("12", "ID 12"),
("13", "ID 13"), ("14", "ID 14"), ("15", "ID 15"), ("16", "ID 16"),("17", "ID 17"), ("18", "ID 18"), ("19", "ID 19"), ("20", "ID 20"),
("21", "ID 21"), ("22", "ID 22"), ("23", "ID 23"), ("24", "ID 24"),("25", "ID 25"), ("26", "ID 26"), ("27", "ID 27"), ("28", "ID 28"),
("29", "ID 29"), ("30", "ID 30"), ("31", "ID 31"), ("32", "ID 32")]
else:
advanced_lnb_satcruser_choices = [ ("1", "ID 1"), ("2", "ID 2"), ("3", "ID 3"), ("4", "ID 4"),
("5", "ID 5"), ("6", "ID 6"), ("7", "ID 7"), ("8", "ID8")]
("5", "ID 5"), ("6", "ID 6"), ("7", "ID 7"), ("8", "ID8")]

section.satcruser = ConfigSelection(advanced_lnb_satcruser_choices, default="1")
tmp = ConfigSubList()
Expand Down Expand Up @@ -1340,11 +1349,12 @@ def fillUnicableConf(sectionDict, unicableproducts, vco_null_check):
tmp.lofh = ConfigSubDict()
tmp.loft = ConfigSubDict()
tmp.positions = ConfigSubDict()
tmp.format = ConfigSubDict()
for z in products:
scrlist = []
vcolist = unicableproducts[y][z]
tmp.vco[z] = ConfigSubList()
for cnt in range(1,1+len(vcolist)-1):
for cnt in range(1,len(vcolist)-1):
vcofreq = int(vcolist[cnt-1])
if vcofreq == 0 and vco_null_check:
scrlist.append(("%d" %cnt,"ID %d " %cnt +_("not used")))
Expand All @@ -1353,21 +1363,23 @@ def fillUnicableConf(sectionDict, unicableproducts, vco_null_check):
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)))
format = [vcolist[len(vcolist)-2]]
tmp.format[z] = ConfigSelection(choices = format, default = format)
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)))
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)))
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)))
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:
Expand Down
2 changes: 1 addition & 1 deletion lib/python/Screens/Satconfig.py
Expand Up @@ -360,7 +360,7 @@ def fillListWithAdvancedSatEntrys(self, Sat):
self.list.append(getConfigListEntry(_("Increased voltage"), currLnb.increased_voltage))
self.list.append(getConfigListEntry(_("Tone mode"), Sat.tonemode))

if lnbnum < 65:
if lnbnum < 65 and not currLnb.unicable.value == "unicable_matrix" and not currLnb.unicable.value == "unicable_lnb":
self.advancedDiseqcMode = getConfigListEntry(_("DiSEqC mode"), currLnb.diseqcMode)
self.list.append(self.advancedDiseqcMode)
if currLnb.diseqcMode.value != "none":
Expand Down

2 comments on commit cb18d2f

@Huevos
Copy link
Contributor

@Huevos Huevos commented on cb18d2f Apr 17, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly does this commit do?

@atvcaptain
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add en50607 support

Please sign in to comment.