Skip to content

Commit

Permalink
[blindscan] Add support for Circular 10750 LNB
Browse files Browse the repository at this point in the history
Thanks to elbandido
  • Loading branch information
atvcaptain committed Aug 12, 2016
1 parent b40b946 commit f71be2e
Showing 1 changed file with 81 additions and 24 deletions.
105 changes: 81 additions & 24 deletions Blindscan/src/plugin.py
Expand Up @@ -305,6 +305,8 @@ def createConfig(self):

self.blindscan_Ku_band_start_frequency = ConfigInteger(default = 10700, limits = (10700, 12749))
self.blindscan_Ku_band_stop_frequency = ConfigInteger(default = 12750, limits = (10701, 12750))
self.blindscan_circular_band_start_frequency = ConfigInteger(default = 11700, limits = (11700, 12749))
self.blindscan_circular_band_stop_frequency = ConfigInteger(default = 12750, limits = (11701, 12750))
self.blindscan_C_band_start_frequency = ConfigInteger(default = 3600, limits = (3000, 4199))
self.blindscan_C_band_stop_frequency = ConfigInteger(default = 4200, limits = (3001, 4200))
self.blindscan_start_symbol = ConfigInteger(default = 2, limits = (1, 44))
Expand Down Expand Up @@ -412,7 +414,10 @@ def createSetup(self):
if self.is_c_band_scan :
self.list.append(getConfigListEntry(_('Scan start frequency'), self.blindscan_C_band_start_frequency,_('Frequency values must be between 3000 MHz and 4199 MHz (C-band)')))
self.list.append(getConfigListEntry(_('Scan stop frequency'), self.blindscan_C_band_stop_frequency,_('Frequency values must be between 3001 MHz and 4200 MHz (C-band)')))
else:
if self.is_circular_band_scan:
self.list.append(getConfigListEntry(_('Scan start frequency'), self.blindscan_circular_band_start_frequency,_('Frequency values must be between 117000 MHz and 12749 MHz (Circular-band)')))
self.list.append(getConfigListEntry(_('Scan stop frequency'), self.blindscan_circular_band_stop_frequency,_('Frequency values must be between 11701 MHz and 12750 MHz (Circular-band)')))
if self.is_Ku_band_scan:
self.list.append(getConfigListEntry(_('Scan start frequency'), self.blindscan_Ku_band_start_frequency,_('Frequency values must be between 10700 MHz and 12749 MHz')))
self.list.append(getConfigListEntry(_('Scan stop frequency'), self.blindscan_Ku_band_stop_frequency,_('Frequency values must be between 10701 MHz and 12750 MHz')))
self.list.append(getConfigListEntry(_("Polarisation"), self.scan_sat.polarization,_('The suggested polarisation for this satellite is "%s"') % (self.suggestedPolarisation)))
Expand Down Expand Up @@ -467,28 +472,40 @@ def keyGo(self):
idx_selected_sat = int(self.getSelectedSatIndex(self.scan_nims.value))
tmp_list=[self.satList[int(self.scan_nims.value)][self.scan_satselection[idx_selected_sat].index]]

if self.is_c_band_scan :
if self.is_c_band_scan:
self.blindscan_start_frequency = self.blindscan_C_band_start_frequency
self.blindscan_stop_frequency = self.blindscan_C_band_stop_frequency
else :
if self.is_circular_band_scan:
self.blindscan_start_frequency = self.blindscan_circular_band_start_frequency
self.blindscan_stop_frequency = self.blindscan_circular_band_stop_frequency
if self.is_Ku_band_scan:
self.blindscan_start_frequency = self.blindscan_Ku_band_start_frequency
self.blindscan_stop_frequency = self.blindscan_Ku_band_stop_frequency
if self.is_user_defined_scan:
self.blindscan_start_frequency = self.blindscan_Ku_band_start_frequency
self.blindscan_stop_frequency = self.blindscan_Ku_band_stop_frequency

# swap start and stop values if entered the wrong way round
if self.blindscan_start_frequency.value > self.blindscan_stop_frequency.value :
temp = self.blindscan_stop_frequency.value
temp = self.blindscan_stop_frequency.value
self.blindscan_stop_frequency.value = self.blindscan_start_frequency.value
self.blindscan_start_frequency.value = temp
del temp

# swap start and stop values if entered the wrong way round
if self.blindscan_start_symbol.value > self.blindscan_stop_symbol.value :
temp = self.blindscan_stop_symbol.value
temp = self.blindscan_stop_symbol.value
self.blindscan_stop_symbol.value = self.blindscan_start_symbol.value
self.blindscan_start_symbol.value = temp
del temp

uni_lnb_cutoff = 11700
if self.is_circular_band_scan and self.blindscan_circular_band_start_frequency.value > 11699: #10750 l.o. Needs to start 150 MHz lower
self.blindscan_circular_band_start_frequency.value = self.blindscan_circular_band_start_frequency.value - 150

if self.is_circular_band_scan:
uni_lnb_cutoff = 11550 #10750 l.o. Needs to start 150 MHz lower
else:
uni_lnb_cutoff = 11700
if self.blindscan_start_frequency.value < uni_lnb_cutoff and self.blindscan_stop_frequency.value > uni_lnb_cutoff :
tmp_band=["low","high"]
elif self.blindscan_start_frequency.value < uni_lnb_cutoff :
Expand Down Expand Up @@ -615,6 +632,8 @@ def prepareScanData(self, orb, pol, band, is_scan):
c_band_loc_osc = 5150
uni_lnb_loc_osc = {"high" : 10600, "low" : 9750}
uni_lnb_cutoff = 11700
if self.is_circular_band_scan:
uni_lnb_cutoff = 11550
if self.is_c_band_scan :
temp_start_int_freq = c_band_loc_osc - self.blindscan_stop_frequency.value
temp_end_int_freq = c_band_loc_osc - self.blindscan_start_frequency.value
Expand Down Expand Up @@ -722,6 +741,8 @@ def prepareScanData(self, orb, pol, band, is_scan):
display_pol = _("horizontal")
if display_pol == "vertical":
display_pol = _("vertical")
if self.is_circular_band_scan and status_box_start_freq < 11700:
status_box_start_freq = 11700

if self.SundtekScan:
tmpmes = _(" Starting Sundtek hardware blind scan.")
Expand Down Expand Up @@ -1071,6 +1092,11 @@ def correctBugsCausedByDriver(self, tplist) :
if tplist[x].frequency > (4200*1000) :
tplist[x].frequency = (5150*1000) - (tplist[x].frequency - (9750*1000))
x += 1
elif self.is_circular_band_scan: # Add Standard 10750 L.O. LNB
x = 0
for transponders in tplist:
tplist[x].frequency = (150*1000) + tplist[x].frequency
x += 1

x = 0
for transponders in tplist :
Expand Down Expand Up @@ -1169,28 +1195,23 @@ def SatBandCheck(self) :
band = 'Unknown'
self.is_c_band_scan = False
self.is_circular_band_scan = False
self.is_Ku_band_scan = False
self.is_user_defined_scan = False
self.suggestedPolarisation = _("vertical and horizontal")
# check in satellites.xml to work out band
tp_list = self.getKnownTransponders(pos)
Len = len(tp_list)
if Len :
freq = int(tp_list[Len - 1].frequency)
if int(tp_list[Len - 1].polarisation) > 1 : # for hints text
self.suggestedPolarisation = _("circular right and circular left")
if freq :
if freq < 4201000 and freq > 2999000 :
band = 'C'
self.is_c_band_scan = True
elif freq < 12751000 and freq > 10700000 :
band = 'Ku'
# if satellites.xml didn't contain any entries for this satellite check
# LNB type instead. Assumes the tuner is configured correctly for C-band.
if band == "Unknown" and self.isCbandLNB(pos):
band = 'C'
self.is_c_band_scan = True
if pos == 360 or pos == 560:
self.suggestedPolarisation = _("circular right & circular left")
if band == "Unknown" and self.isCircularLNB(pos):
band = 'circular'
self.is_circular_band_scan = True
if band == "Unknown" and self.isKuLNB(pos):
band = 'Ku'
self.is_Ku_band_scan = True
if band == "Unknown" and self.isUserDefinedLNB(pos):
band = 'user_defined'
self.is_user_defined_scan = True
# if satellites.xml didn't contain any entries for this satellite check
# LNB type instead. Assumes the tuner is configured correctly for C-band.
print "[Blindscan] SatBandCheck band = %s" % (band)

def isCbandLNB(self, cur_orb_pos):
Expand All @@ -1209,6 +1230,42 @@ def isCbandLNB(self, cur_orb_pos):
return True
return False

def isCircularLNB(self, cur_orb_pos): #added for 10750 LNB
nim = nimmanager.nim_slots[int(self.scan_nims.value)]
if nim.config.configMode.getValue() == "advanced":
currSat = nim.config.advanced.sat[cur_orb_pos]
lnbnum = int(currSat.lnb.getValue())
currLnb = nim.config.advanced.lnb[lnbnum]
lof = currLnb.lof.getValue()
print "[Blind scan] LNB type: ", lof
if lof == "circular_lnb":
return True
return False

def isKuLNB(self, cur_orb_pos): #added for 10750 LNB
nim = nimmanager.nim_slots[int(self.scan_nims.value)]
if nim.config.configMode.getValue() == "advanced":
currSat = nim.config.advanced.sat[cur_orb_pos]
lnbnum = int(currSat.lnb.getValue())
currLnb = nim.config.advanced.lnb[lnbnum]
lof = currLnb.lof.getValue()
print "[Blind scan] LNB type: ", lof
if lof == "universal_lnb":
return True
return False

def isUserDefinedLNB(self, cur_orb_pos): #added for 10750 LNB
nim = nimmanager.nim_slots[int(self.scan_nims.value)]
if nim.config.configMode.getValue() == "advanced":
currSat = nim.config.advanced.sat[cur_orb_pos]
lnbnum = int(currSat.lnb.getValue())
currLnb = nim.config.advanced.lnb[lnbnum]
lof = currLnb.lof.getValue()
print "[Blind scan] LNB type: ", lof
if lof == "user_defined":
return True
return False

def getOrbPos(self):
idx_selected_sat = int(self.getSelectedSatIndex(self.scan_nims.value))
tmp_list=[self.satList[int(self.scan_nims.value)][self.scan_satselection[idx_selected_sat].index]]
Expand Down Expand Up @@ -1240,7 +1297,7 @@ def startDishMovingIfRotorSat(self):
tps = nimmanager.getTransponders(orb_pos)
if len(tps) < 1:
return False
# freq, sr, pol, fec, inv, orb, sys, mod, roll, pilot
# freq, sr, pol, fec, inv, orb, sys, mod, roll, pilot
transponder = (tps[0][1] / 1000, tps[0][2] / 1000, tps[0][3], tps[0][4], 2, orb_pos, tps[0][5], tps[0][6], tps[0][8], tps[0][9])
if not self.prepareFrontend():
return False
Expand Down

1 comment on commit f71be2e

@Huevos
Copy link
Member

@Huevos Huevos commented on f71be2e Aug 11, 2017

Choose a reason for hiding this comment

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

This commit needs reverting. Not properly tested. It breaks the plugin for every user that is using "Configuration Mode" == "Simple". Other errors too.

Please sign in to comment.