From fb888a2e08e5b586d35625f96b98862e6e726b8f Mon Sep 17 00:00:00 2001 From: "James C. Ahlstrom" Date: Tue, 1 Oct 2024 14:22:23 -0400 Subject: [PATCH] Quisk version 4.2.39 --- CHANGELOG.txt | 7 +++++++ __init__.py | 2 +- multuspkg/quisk_hardware.py | 23 ++++++++++++++++++++++- quisk.py | 6 +++++- quisk_hardware_model.py | 2 ++ setup.py | 2 +- 6 files changed, 38 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d5a7fb0..b37413e 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,10 @@ +Quisk Version 4.2.39 October 2024 +================================== +I added an optional Hardware method PollGuiControl(self). If you define this in your Hardware file, +the GUI thread will call it frequently. It can be used to set PTT from your hardware. + +I am trying to work around a wxPython quirk that causes mouse wheel tuning to fail. Please test. + Quisk Version 4.2.38 September 2024 ==================================== This is a bugfix release. I fixed a bug in the Hamlib serial port when using a physical TTY instead diff --git a/__init__.py b/__init__.py index 4a240be..51359a3 100644 --- a/__init__.py +++ b/__init__.py @@ -1,2 +1,2 @@ -#Quisk version 4.2.38 +#Quisk version 4.2.39 from .quisk import main diff --git a/multuspkg/quisk_hardware.py b/multuspkg/quisk_hardware.py index a27711d..614b2db 100644 --- a/multuspkg/quisk_hardware.py +++ b/multuspkg/quisk_hardware.py @@ -91,6 +91,8 @@ def __init__(self, app, conf): conf.si570_direct_control = False conf.si570_xtal_freq = 114285000 conf.repeater_delay = 0.25 + self.ptt_count = 200 + self.ptt_on = 0 BaseHardware.__init__(self, app, conf) QS.set_sparams(multus_cw_samples=1) self.use_softrock = True @@ -104,6 +106,13 @@ def TransferOut(self, address, message): # message is a bytes array or an intege self.usb_dev.ctrl_transfer(OUT, address, self.si570_i2c_address + 0x700, 0, message) if DEBUG: print ("USB send to 0x%X" % address, message) + def TransferIn(self, address, length): + if self.usb_dev: + recv = self.usb_dev.ctrl_transfer(IN, address, self.si570_i2c_address + 0x700, 0, length) + if DEBUG: + print ("USB receive from 0x%X" % address, recv) + return recv + return None def open(self): text = BaseHardware.open(self) self.InitKeyer() @@ -120,8 +129,20 @@ def ChangeMode(self, mode): print ("Mode is not CW") self.TransferOut(0x70, cw_mode) return ret - def PollCwKey(self): # Called frequently by Quisk to check the CW key status + def PollCwKey(self): # Called frequently from the sound thread to check the CW key status return # Quisk is always in Rx + def PollGuiControl(self): # Called frequently from the GUI thread + self.ptt_count -= 1 + if self.ptt_count <= 0: + self.ptt_count = 200 + reply = self.TransferIn(0xA5, 1) + if DEBUG: + print ("PollGuiControl got", reply) + if reply: + ptt = reply[0] # This is 255 for error + if ptt in (0, 1) and ptt != self.ptt_on: + self.ptt_on = ptt + self.application.pttButton.SetValue(ptt, True) def InitKeyer(self): # Initialize the keyer parameters conf = self.conf diff --git a/quisk.py b/quisk.py index 29bd405..32951bd 100644 --- a/quisk.py +++ b/quisk.py @@ -2123,7 +2123,7 @@ def GetMousePosition(self, event): """For mouse clicks in our display, translate to our screen coordinates.""" mouse_x, mouse_y = event.GetPosition() win = event.GetEventObject() - if win is not self: + if win and win is not self: x, y = win.GetPosition().Get() mouse_x += x mouse_y += y @@ -3524,6 +3524,7 @@ def OnInit(self): if not os.path.isdir(self.QuiskFilesDir): self.QuiskFilesDir = DefaultConfigDir self.std_out_err = StdOutput(self) + self.std_out_err.Logfile("WxPython " + wx.version()) QS.set_params(quisk_is_vna=0) # We are not the VNA program # Read in configuration from the selected radio self.BandPlan = [] @@ -3614,6 +3615,7 @@ def OnInit(self): setattr(conf, 'widgets_file_name', '') Hardware = self.Hardware self.use_fast_heart_beat = hasattr(Hardware, "FastHeartBeat") + self.poll_gui_control = hasattr(Hardware, "PollGuiControl") # Initialization - may be over-written by persistent state self.local_conf.Initialize() self.clip_time0 = 0 # timer to display a CLIP message on ADC overflow @@ -6455,6 +6457,8 @@ def OnReadSound(self): # called at frequent intervals self.hamlib_com2_handler.Process() if self.use_fast_heart_beat: Hardware.FastHeartBeat() + if self.poll_gui_control: + Hardware.PollGuiControl() if conf.do_repeater_offset: hold = QS.tx_hold_state(-1) if hold == 2: # Tx is being held for an FM repeater TX frequency shift diff --git a/quisk_hardware_model.py b/quisk_hardware_model.py index 37f5664..ed964f7 100644 --- a/quisk_hardware_model.py +++ b/quisk_hardware_model.py @@ -120,6 +120,8 @@ def InitBscope(self, int_size, endian, clock, length): # Bandscope initializatio self.application.bandscope_clock = clock #def PollCwKey(self): # Optional. Called frequently by the sound thread to check the CW key status. # pass # Do not define if not needed. + #def PollGuiControl(self): # Optional. Called frequently by the GUI thread to change GUI settings (PTT etc.) + # pass # Do not define if not needed. def StartSamples(self): # Quisk calls this from the sound thread to start sending samples. # If you return a string, it replaces the string returned from hardware open() pass diff --git a/setup.py b/setup.py index 0c56ba6..1eff385 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ # You must define the version here. A title string including # the version will be written to __init__.py and read by quisk.py. -Version = '4.2.38' +Version = '4.2.39' fp = open("__init__.py", "w") # write title string fp.write("#Quisk version %s\n" % Version)