def OnButtonPTT(self, event): btn = event.GetEventObject() if btn.GetValue(): QS.set_PTT(1) QS.set_key_down(1) else: QS.set_PTT(0) QS.set_key_down(0)
def SetVNA(self, key_down=None, vna_start=None, vna_stop=None, vna_count=None, do_tx=False): if vna_count is not None: # must be called first self.vna_count = vna_count if not self.vna_started: self.pc2hermes[4 * 9] = 63 # C0 index == 0x1001, C1[7:0] Tx level self.ChangeLNA(2) # Preamp and Rx gain if vna_start is None: start = 0 stop = 0 else: # Set the start and stop frequencies and the frequency change for each point # vna_start and vna_stop must be specified together self.pc2hermes[ 4] = vna_start >> 24 & 0xff # C0 index == 1, C1, C2, C3, C4: Tx freq, MSB in C1 self.pc2hermes[ 5] = vna_start >> 16 & 0xff # used for vna starting frequency self.pc2hermes[6] = vna_start >> 8 & 0xff self.pc2hermes[7] = vna_start & 0xff N = self.vna_count - 1 ph_start = self.Freq2Phase(vna_start) # Calculate using phases ph_stop = self.Freq2Phase(vna_stop) delta = (ph_stop - ph_start + N // 2) // N delta = int(float(delta) * self.conf.rx_udp_clock / 2.0**32 + 0.5) self.pc2hermes[ 8] = delta >> 24 & 0xff # C0 index == 2, C1, C2, C3, C4: Rx freq, MSB in C1 self.pc2hermes[ 9] = delta >> 16 & 0xff # used for the frequency to add for each point self.pc2hermes[10] = delta >> 8 & 0xff self.pc2hermes[11] = delta & 0xff self.pc2hermes[4 * 9 + 2] = ( self.vna_count >> 8) & 0xff # C0 index == 0x1001, C3 self.pc2hermes[4 * 9 + 3] = self.vna_count & 0xff # C0 index == 0x1001, C4 QS.pc_to_hermes(self.pc2hermes) start = self.ReturnVfoFloat(vna_start) phase = ph_start + self.Freq2Phase(delta) * N stop = float(phase) * self.conf.rx_udp_clock / 2.0**32 start = int(start + 0.5) stop = int(stop + 0.5) if DEBUG: print("Change VNA start", vna_start, start, "stop", vna_stop, stop) if key_down is None: pass elif key_down: if not self.vna_started: self.vna_started = True self.SetControlByte(9, 2, 0x80) # turn on VNA mode QS.set_PTT(1) else: QS.set_PTT(0) return start, stop # Return actual frequencies after all phase rounding
def OnButtonPTT(self, event): btn = event.GetEventObject() if btn.GetValue(): QS.set_PTT(1) else: QS.set_PTT(0)