コード例 #1
0
 def open(self):
   ##self.application.config_screen.config.tx_phase.Enable(1)
   # Create the proper broadcast address for rx_udp_ip.
   nm = self.conf.rx_udp_ip_netmask.split('.')
   ip = self.conf.rx_udp_ip.split('.')
   nm = map(int, nm)
   ip = map(int, ip)
   bc = ''
   for i in range(4):
     x = (ip[i] | ~ nm[i]) & 0xFF
     bc = bc + str(x) + '.'
   self.broadcast_addr = bc[:-1]
   # This socket is used for the Simple Network Discovery Protocol by AE4JY
   self.socket_sndp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
   self.socket_sndp.setblocking(0)
   self.socket_sndp.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
   self.sndp_request = chr(56) + chr(0) + chr(0x5A) + chr(0xA5) + chr(0) * 52
   self.sndp_rx_active = True
   # conf.rx_udp_port is used for returning ADC samples
   # conf.rx_udp_port + 1 is used for control
   self.rx_udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
   self.rx_udp_socket.setblocking(0)
   self.rx_udp_socket.connect((self.conf.rx_udp_ip, self.conf.rx_udp_port + 1))
   # conf.tx_audio_port + 1 is used for control
   if self.conf.tx_ip:
     self.sndp_tx_active = True
     self.tx_udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
     self.tx_udp_socket.setblocking(0)
     self.tx_udp_socket.connect((self.conf.tx_ip, self.conf.tx_audio_port + 1))
   else:
     self.sndp_tx_active = False
   QS.change_rates(96000, 0, 96000, 0)
   self.application.test1Button.Enable(0)
   return QS.open_rx_udp(self.conf.rx_udp_ip, self.conf.rx_udp_port)
コード例 #2
0
ファイル: uhfrx.py プロジェクト: jimahlstrom/Quisk-PA_async
 def ChangeFrequency(self, tx_freq, vfo_freq, source='', band='', event=None):
   self.tx_frequency = tx_freq
   if not self.adf4351_freq - 3E6 < vfo_freq < self.adf4351_freq + 3E6:
     self.NewAdf4351(vfo_freq)
     self.vfo_frequency = -1
   if self.vfo_frequency != vfo_freq:
     self.vfo_frequency = vfo_freq
     self.scan_deltaf = int(1152E3 * self.fft_scan_valid + 0.5)
     self.scan_phase = int(1152.E3 * self.fft_scan_valid / self.conf.rx_udp_clock * 2.0**32 + 0.5)
     self.scan_vfo0 = vfo_freq
     rx_phase1 = int((vfo_freq - self.adf4351_freq) / self.conf.rx_udp_clock * 2.0**32 + 0.5)
     if self.scan_enable:
       self.scan_vfo0 = self.scan_vfo0 - self.scan_deltaf * (self.scan_blocks - 1) / 2
       rx_phase1 = rx_phase1 - int(self.scan_phase * (self.scan_blocks - 1) / 2.0 + 0.5)
     self.rx_phase1 = rx_phase1 & 0xFFFFFFFF
     rx_tune_freq = float(rx_phase1) * self.conf.rx_udp_clock / 2.0**32
     QS.change_rates(96000, tx_freq, self.vfo_sample_rate, vfo_freq)
     QS.change_scan(self.scan_blocks, 1152000, self.fft_scan_valid, self.scan_vfo0, self.scan_deltaf)
     if DEBUG:
       #print( "vfo", vfo_freq, "adf4351", self.adf4351_freq, "phase", rx_phase1, "rx_tune", self.adf4351_freq - vfo_freq, rx_tune_freq)
       #print ("VFO", self.adf4351_freq + rx_tune_freq)
       print ("Change to Tx %d Vfo %d; VFO %.0f = adf4351_freq %.0f + rx_tune_freq %.0f" % (tx_freq, vfo_freq, self.adf4351_freq + rx_tune_freq,
             self.adf4351_freq, rx_tune_freq))
       #print ("scan_enable %d, scan_blocks %d, scan_vfo0 %d, scan_deltaf %d" % (self.scan_enable, self.scan_blocks, self.scan_vfo0, self.scan_deltaf))
   else:
     QS.change_rates(96000, tx_freq, self.vfo_sample_rate, self.vfo_frequency)
   rx_phase0 = int((tx_freq - self.adf4351_freq) / self.conf.rx_udp_clock * 2.0**32 + 0.5)
   self.rx_phase0 = rx_phase0 & 0xFFFFFFFF
   self.NewUdpStatus()
   self.NewStatus()
   return tx_freq, vfo_freq
コード例 #3
0
 def ChangeFrequency(self,
                     tx_freq,
                     vfo_freq,
                     source='',
                     band='',
                     event=None):
     self.tx_frequency = tx_freq
     if not self.Rx4351.frequency - 3E6 < vfo_freq < self.Rx4351.frequency + 3E6:
         self.NewAdf4351(self.Rx4351, vfo_freq)
         self.vfo_frequency = -1
     self.NewAd9951(tx_freq)
     if abs(self.ad9951_freq - 10.7e6) > 15000:
         self.NewAdf4351(self.Tx4351, tx_freq)
         self.NewAd9951(tx_freq)
     self.NewAd9951(tx_freq)
     if self.vfo_frequency != vfo_freq:
         self.vfo_frequency = vfo_freq
         self.scan_deltaf = int(1152E3 * self.fft_scan_valid + 0.5)
         self.scan_phase = int(1152.E3 * self.fft_scan_valid /
                               self.conf.rx_udp_clock * 2.0**32 + 0.5)
         self.scan_vfo0 = vfo_freq
         rx_phase1 = int((vfo_freq - self.Rx4351.frequency) /
                         self.conf.rx_udp_clock * 2.0**32 + 0.5)
         if self.scan_enable:
             self.scan_vfo0 = self.scan_vfo0 - self.scan_deltaf * (
                 self.scan_blocks - 1) // 2
             rx_phase1 = rx_phase1 - int(self.scan_phase *
                                         (self.scan_blocks - 1) / 2.0 + 0.5)
         self.rx_phase1 = rx_phase1 & 0xFFFFFFFF
         rx_tune_freq = float(rx_phase1) * self.conf.rx_udp_clock / 2.0**32
         QS.change_rates(96000, tx_freq, self.vfo_sample_rate, vfo_freq)
         QS.change_scan(self.scan_blocks, 1152000, self.fft_scan_valid,
                        self.scan_vfo0, self.scan_deltaf)
         if DEBUG:
             #print( "vfo", vfo_freq, "adf4351", self.Rx4351.frequency, "phase", rx_phase1, "rx_tune", self.Rx4351.frequency - vfo_freq, rx_tune_freq)
             #print ("VFO", self.Rx4351.frequency + rx_tune_freq)
             print(
                 "Change to Tx %d Vfo %d; VFO %.0f = adf4351_freq %.0f + rx_tune_freq %.0f"
                 % (tx_freq, vfo_freq, self.Rx4351.frequency + rx_tune_freq,
                    self.Rx4351.frequency, rx_tune_freq))
             #print ("scan_enable %d, scan_blocks %d, scan_vfo0 %d, scan_deltaf %d" % (self.scan_enable, self.scan_blocks, self.scan_vfo0, self.scan_deltaf))
     else:
         QS.change_rates(96000, tx_freq, self.vfo_sample_rate,
                         self.vfo_frequency)
     rx_phase0 = int((tx_freq - self.Rx4351.frequency) /
                     self.conf.rx_udp_clock * 2.0**32 + 0.5)
     self.rx_phase0 = rx_phase0 & 0xFFFFFFFF
     self.NewUdpStatus()
     if self.application.bottom_widgets:
         Rx1 = self.Rx4351.frequency * 1e-6
         Rx2 = (self.ReturnVfoFloat() - self.Rx4351.frequency) * 1e-6
         t = "Rx Div %d; ADF4351 %.6f + rx_tune %.6f = %.6f    Tx Adf4351 %.6f AD9951 %.6f" % (
             2**self.Rx4351.rf_divider, Rx1, Rx2, Rx1 + Rx2,
             self.Tx4351.frequency * 1e-6, self.ad9951_freq * 1e-6)
         self.application.bottom_widgets.UpdateText(t)
     return tx_freq, vfo_freq
コード例 #4
0
ファイル: uhfrx.py プロジェクト: jmharvey1/SdrCwXcvr
 def ChangeFrequency(self,
                     tx_freq,
                     vfo_freq,
                     source='',
                     band='',
                     event=None):
     self.tx_frequency = tx_freq
     if not self.adf4351_freq - 3E6 < vfo_freq < self.adf4351_freq + 3E6:
         self.NewAdf4351(vfo_freq)
         self.vfo_frequency = -1
     if self.vfo_frequency != vfo_freq:
         self.vfo_frequency = vfo_freq
         self.scan_deltaf = int(1152E3 * self.fft_scan_valid + 0.5)
         self.scan_phase = int(1152.E3 * self.fft_scan_valid /
                               self.conf.rx_udp_clock * 2.0**32 + 0.5)
         self.scan_vfo0 = vfo_freq
         rx_phase1 = int((vfo_freq - self.adf4351_freq) /
                         self.conf.rx_udp_clock * 2.0**32 + 0.5)
         if self.scan_enable:
             self.scan_vfo0 = self.scan_vfo0 - self.scan_deltaf * (
                 self.scan_blocks - 1) / 2
             rx_phase1 = rx_phase1 - int(self.scan_phase *
                                         (self.scan_blocks - 1) / 2.0 + 0.5)
         self.rx_phase1 = rx_phase1 & 0xFFFFFFFF
         rx_tune_freq = float(rx_phase1) * self.conf.rx_udp_clock / 2.0**32
         QS.change_rates(96000, tx_freq, self.vfo_sample_rate, vfo_freq)
         QS.change_scan(self.scan_blocks, 1152000, self.fft_scan_valid,
                        self.scan_vfo0, self.scan_deltaf)
         if DEBUG:
             #print( "vfo", vfo_freq, "adf4351", self.adf4351_freq, "phase", rx_phase1, "rx_tune", self.adf4351_freq - vfo_freq, rx_tune_freq)
             #print ("VFO", self.adf4351_freq + rx_tune_freq)
             print(
                 "Change to Tx %d Vfo %d; VFO %.0f = adf4351_freq %.0f + rx_tune_freq %.0f"
                 % (tx_freq, vfo_freq, self.adf4351_freq + rx_tune_freq,
                    self.adf4351_freq, rx_tune_freq))
             #print ("scan_enable %d, scan_blocks %d, scan_vfo0 %d, scan_deltaf %d" % (self.scan_enable, self.scan_blocks, self.scan_vfo0, self.scan_deltaf))
     else:
         QS.change_rates(96000, tx_freq, self.vfo_sample_rate,
                         self.vfo_frequency)
     rx_phase0 = int((tx_freq - self.adf4351_freq) /
                     self.conf.rx_udp_clock * 2.0**32 + 0.5)
     self.rx_phase0 = rx_phase0 & 0xFFFFFFFF
     self.NewUdpStatus()
     self.NewStatus()
     return tx_freq, vfo_freq
コード例 #5
0
ファイル: uhfrx_conf.py プロジェクト: gonesurfing/quisk-main
 def ChangeFrequency(self, tx_freq, vfo_freq, source='', band='', event=None):
   self.tx_frequency = tx_freq
   if not self.Rx4351.frequency - 3E6 < vfo_freq < self.Rx4351.frequency + 3E6:
     self.NewAdf4351(self.Rx4351, vfo_freq)
     self.vfo_frequency = -1
   self.NewAd9951(tx_freq)
   if abs(self.ad9951_freq - 10.7e6) > 15000:
     self.NewAdf4351(self.Tx4351, tx_freq)
     self.NewAd9951(tx_freq)
   self.NewAd9951(tx_freq)
   if self.vfo_frequency != vfo_freq:
     self.vfo_frequency = vfo_freq
     self.scan_deltaf = int(1152E3 * self.fft_scan_valid + 0.5)
     self.scan_phase = int(1152.E3 * self.fft_scan_valid / self.conf.rx_udp_clock * 2.0**32 + 0.5)
     self.scan_vfo0 = vfo_freq
     rx_phase1 = int((vfo_freq - self.Rx4351.frequency) / self.conf.rx_udp_clock * 2.0**32 + 0.5)
     if self.scan_enable:
       self.scan_vfo0 = self.scan_vfo0 - self.scan_deltaf * (self.scan_blocks - 1) / 2
       rx_phase1 = rx_phase1 - int(self.scan_phase * (self.scan_blocks - 1) / 2.0 + 0.5)
     self.rx_phase1 = rx_phase1 & 0xFFFFFFFF
     rx_tune_freq = float(rx_phase1) * self.conf.rx_udp_clock / 2.0**32
     QS.change_rates(96000, tx_freq, self.vfo_sample_rate, vfo_freq)
     QS.change_scan(self.scan_blocks, 1152000, self.fft_scan_valid, self.scan_vfo0, self.scan_deltaf)
     if DEBUG:
       #print( "vfo", vfo_freq, "adf4351", self.Rx4351.frequency, "phase", rx_phase1, "rx_tune", self.Rx4351.frequency - vfo_freq, rx_tune_freq)
       #print ("VFO", self.Rx4351.frequency + rx_tune_freq)
       print ("Change to Tx %d Vfo %d; VFO %.0f = adf4351_freq %.0f + rx_tune_freq %.0f" % (tx_freq, vfo_freq,
             self.Rx4351.frequency + rx_tune_freq, self.Rx4351.frequency, rx_tune_freq))
       #print ("scan_enable %d, scan_blocks %d, scan_vfo0 %d, scan_deltaf %d" % (self.scan_enable, self.scan_blocks, self.scan_vfo0, self.scan_deltaf))
   else:
     QS.change_rates(96000, tx_freq, self.vfo_sample_rate, self.vfo_frequency)
   rx_phase0 = int((tx_freq - self.Rx4351.frequency) / self.conf.rx_udp_clock * 2.0**32 + 0.5)
   self.rx_phase0 = rx_phase0 & 0xFFFFFFFF
   self.NewUdpStatus()
   if self.application.bottom_widgets:
     Rx1 = self.Rx4351.frequency * 1e-6
     Rx2 = (self.ReturnVfoFloat() - self.Rx4351.frequency) * 1e-6
     t = "Rx Div %d; ADF4351 %.6f + rx_tune %.6f = %.6f    Tx Adf4351 %.6f AD9951 %.6f" % (
        2**self.Rx4351.rf_divider, Rx1, Rx2, Rx1 + Rx2, self.Tx4351.frequency * 1e-6, self.ad9951_freq * 1e-6)
     self.application.bottom_widgets.UpdateText(t)
   return tx_freq, vfo_freq