Skip to content

Commit

Permalink
Send frequency update to terminal every time a trunk update is performed
Browse files Browse the repository at this point in the history
  • Loading branch information
boatbod committed Apr 18, 2018
1 parent 8b7ff64 commit d8c0058
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions op25/gr-op25_repeater/apps/rx.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def __init__(self, options):
self.eye_sink = None
self.mixer_sink = None
self.target_freq = 0.0
self.last_freq_params = {'freq' : 0.0, 'tgid' : None, 'tag' : "", 'tdma' : None}

self.src = None
if (not options.input) and (not options.audio) and (not options.audio_if):
Expand Down Expand Up @@ -196,8 +197,6 @@ def __init__(self, options):
self.terminal = op25_terminal(self.input_q, self.output_q, self.options.terminal_type)
if self.terminal is None:
sys.exit(1)
if self.options.frequency:
self.freq_update()

# attach audio thread
if self.options.udp_player:
Expand Down Expand Up @@ -348,6 +347,7 @@ def configure_tdma(self, params):
self.demod.clock.set_omega(float(sps))

def change_freq(self, params):
self.last_freq_params = params
freq = params['freq']
offset = params['offset']
center_freq = params['center_frequency']
Expand All @@ -373,13 +373,11 @@ def change_freq(self, params):
else:
self.set_freq(freq + offset)

self.options.frequency = freq
self.configure_tdma(params)
self.freq_update(params)
self.freq_update()

def freq_update(self, params = {}):
if 'freq' not in params:
params = {'freq' : self.options.frequency, 'tgid' : None, 'tag' : "", 'tdma' : None}
def freq_update(self):
params = self.last_freq_params
params['json_type'] = 'change_freq'
params['fine_tune'] = self.options.fine_tune
js = json.dumps(params)
Expand Down Expand Up @@ -689,6 +687,7 @@ def open_usrp(self):
"source-decim": 1 }
self.__set_rx_from_osmosdr()
if self.options.frequency:
self.last_freq_params['freq'] = self.options.frequency
self.set_freq(self.options.frequency)
# except Exception, x:
# wx.MessageBox("Cannot open USRP: " + x.message, "USRP Error", wx.CANCEL | wx.ICON_EXCLAMATION)
Expand All @@ -710,6 +709,7 @@ def process_qmsg(self, msg):
s = msg.to_string()
if s == 'quit': return True
elif s == 'update':
self.freq_update()
if self.trunk_rx is None:
return False ## possible race cond - just ignore
js = self.trunk_rx.to_json()
Expand Down

0 comments on commit d8c0058

Please sign in to comment.