Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c209457dc | ||
|
|
7e8a0846f7 | ||
|
|
fb888a2e08 | ||
|
|
78a1ca3d60 | ||
|
|
14a80f09d5 | ||
|
|
1c9f81254b | ||
|
|
76208643a0 | ||
|
|
31ecbce146 | ||
|
|
a1343c1264 | ||
|
|
71146c9eaf | ||
|
|
814e4ce08c |
@@ -1,3 +1,89 @@
|
||||
Quisk Version 4.2.41 January 2025
|
||||
==================================
|
||||
I made some improvements to the top-level Config/Radios screen. There is now an option to
|
||||
make a new radio by copying settings from an existing radio. I worked around a bug in wxPython
|
||||
and gtk3 that caused drawing problems on the config screens. This problem is not present on Windows.
|
||||
|
||||
Quisk Version 4.2.40 November 2024
|
||||
===================================
|
||||
Python 3.13 eliminated the telnetlib module, so I wrote a replacement. I fixed a bug in window sizing.
|
||||
If you use the Dx Cluster feature, please report any problems. Dx Cluster used to use the telnetlib module
|
||||
but is now new code.
|
||||
|
||||
I updated the install to Python 3.13. Please report any problems with Python 3.13.
|
||||
|
||||
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
|
||||
of a pseudo-tty. The Hamlib ZZFA command now changes the receive frequency instead of the transmit
|
||||
frequency. I fixed some window sizing issues.
|
||||
|
||||
Quisk Version 4.2.37 August 2024
|
||||
=================================
|
||||
Quisk now has a new option "Fixed tune offset" on the Config/radio/Options screen. This is meant for
|
||||
Softrock radios that need a constant audio frequency to simplify amplitude and phase corrections.
|
||||
The value zero means no change to Quisk tuning. Otherwise enter the fixed frequency offset from center.
|
||||
If you are using the obsolete "mouse_tune_method = 1" please delete it and use this new feature.
|
||||
If you use softrock_tune_vfo.py as your hardware file, you should replace it with softrock/hardware_usb.py.
|
||||
|
||||
Quisk now works on Python 3.12. And I fixed a bug in the small screen graph width.
|
||||
|
||||
Quisk Version 4.2.36 August 2024
|
||||
=================================
|
||||
I added two new color schemes by Michael, DK1MI. The On/Off button color and text color can
|
||||
now be configured. (Michael, send me the final colors). There are a few other small changes.
|
||||
|
||||
Quisk Version 4.2.35 June 2024
|
||||
===============================
|
||||
There is a new item "File play level" on the Config/radio/Sound screen to reduce the volume when playing files.
|
||||
Use it to reduce the volume of the CQ message relative to radio sound.
|
||||
|
||||
Dan, AI2M, provided a patch to compile in MacOS on Apple Silicon. Thanks Dan!
|
||||
|
||||
I am working on better amplitude and phase adjustments when using SoftRock radios. The new corrections
|
||||
screen has a spreadsheet to display the VFO and tune offset. And there is a feature to automatically
|
||||
measure the corrections when using a signal generator as a source. If you use Quisk with SoftRock or similar
|
||||
radios, please let me know what you think.
|
||||
|
||||
Quisk Version 4.2.34 May 2024
|
||||
==============================
|
||||
For the Hermes-Lite2 the inhibit Tx function (CN8) now releases the Spot button.
|
||||
|
||||
Quisk displays the band plan below the X-axis as colored bars, and there are eighteen possible colors.
|
||||
If you hover the mouse over a bar, Quisk now displays the name of the mode. Recall that there is a dialog
|
||||
box so you can set the band plan to what you want.
|
||||
|
||||
Quisk Version 4.2.33 May 2024
|
||||
==============================
|
||||
Added the get_level Hamlib command "l STRENGTH". It returns the S-meter reading. I finally found some Hamlib
|
||||
documentation, often not an easy task. The return value of STRENGTH is in dB with zero dB equal to S9.
|
||||
There are 6 dB per S-unit. So a STRENGTH of 4 is 4dB over S9, and -6, -12, -18 is S8, S7, S6. I also added
|
||||
the corresponding FlexRadio command ZZSM.
|
||||
|
||||
Quisk Version 4.2.32 April 2024
|
||||
================================
|
||||
I found and fixed a bug in the microphone filters that can result in a buffer overrun. You should update Quisk.
|
||||
|
||||
Some Linux digital programs can not use the usual Quisk Pulse loopback device and must use an
|
||||
Alsa loopback. I added more documentation for Alsa loopbacks, added more information on the Sound
|
||||
screen and I changed the default Alsa sample size to 16 bit.
|
||||
|
||||
Quisk now responds to the Hermes Lite2 Tx inhibit input by displaying a message and extinguishing the "Tx" light.
|
||||
There is a new item "Hermes Lite2 protocol" on the Hardware screen to control this behavior.
|
||||
|
||||
Quisk Version 4.2.31 March 2024
|
||||
================================
|
||||
The "Tune" item was missing from the Midi menus. I fixed it but I didn't test it because I did
|
||||
not borrow Ben's Midi controller. Please test it yourself and let me know if it works. The Midi
|
||||
speed can be set from the menu too.
|
||||
|
||||
Quisk Version 4.2.30 March 2024
|
||||
================================
|
||||
A new option "Tx-Rx silence msec" on the Timing configuration screen controls how long
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
#Quisk version 4.2.30
|
||||
#Quisk version 4.2.41
|
||||
from .quisk import main
|
||||
|
||||
+574
-268
File diff suppressed because it is too large
Load Diff
@@ -194,7 +194,7 @@ Quisk is free open source software written in Python and C. It is hosted on the
|
||||
<br>
|
||||
<p>
|
||||
If you have Python 3 installed on your computer, just continue to use that version.
|
||||
<b>On Windows Quisk requires Python 3.8 or 3.9 or 3.10 or 3.11.</b>
|
||||
<b>On Windows Quisk requires Python 3.8, 3.9, 3.10, 3.11, 3.12 or 3.13.</b>
|
||||
If you want to install a more recent version of Python, uninstall the old version first.
|
||||
Running multiple versions of Python is possible but can be confusing and is not necessary.
|
||||
A Quisk installation is needed for each version of Python you have.
|
||||
@@ -204,7 +204,7 @@ A Quisk installation is needed for each version of Python you have.
|
||||
<p>
|
||||
Windows does not include Python, so you must first install a recent version of 64-bit Python 3.
|
||||
If you already have 64-bit Python 3 installed, just keep using it.
|
||||
<b>On Windows Quisk requires Python 3.8 or 3.9 or 3.10 or 3.11.</b>
|
||||
<b>On Windows Quisk requires Python 3.8, 3.9, 3.10, 3.11, 3.12 or 3.13.</b>
|
||||
There may be newer versions of Python, but until support is added, use the versions listed above.
|
||||
Python is available from <a href="http://www.python.org/">http://www.python.org</a>.
|
||||
There is an option to <b>Add Python to PATH</b>. You MUST select
|
||||
@@ -239,17 +239,24 @@ python -m pip install --upgrade pyserial
|
||||
<br><br>
|
||||
python -m pip install --upgrade quisk
|
||||
<br><br>
|
||||
You should then be able to start Quisk with the command "quisk".
|
||||
You can also start Quisk with "python -m quisk".
|
||||
To create a Quisk shortcut on your desktop, right-click an empty space and select "New" and "Shortcut".
|
||||
Use "quisk.exe" as the command and "Quisk" as the name.
|
||||
The "quisk.exe" program is in <b>your_install_directory</b>\Scripts.
|
||||
Enter this as the location of the item:
|
||||
</p>
|
||||
<br>
|
||||
<pre>
|
||||
pythonw -m quisk
|
||||
</pre>
|
||||
<br>
|
||||
<p>
|
||||
and then name the shortcut, perhaps "Quisk".
|
||||
If you check the properties you will see that Windows expanded the location and start directory to the full path.
|
||||
If you are curious, Quisk and its Python source files are installed in "<b>your_install_directory</b>\Lib\site-packages\quisk".
|
||||
If you change to that directory you can run Quisk with "python quisk.py".
|
||||
If you change to that directory you can run Quisk with "pythonw quisk.py".
|
||||
</p>
|
||||
<br>
|
||||
<p>
|
||||
To get started you must tell Quisk what kind of radio hardware you have. Press the Config button and select Radios.
|
||||
Add a radio from the list of hardware radios available. Or add the best match.
|
||||
Then set your sound devices for that radio; the device for the radio speakers, the microphone and so forth. All configuration
|
||||
is (mostly) from the Config button. Ignore old directions and don't bother with a config file.
|
||||
</p>
|
||||
@@ -379,6 +386,7 @@ You run Quisk by running the file quisk.py with python3. For example, "python3 /
|
||||
You can create a desktop icon to do that, but the method depends on your version of Linux.
|
||||
<b>Never run Quisk with root privelege by using sudo. Fix the permission problem instead.</b>
|
||||
To get started you must tell Quisk what kind of radio hardware you have. Press the Config button and select Radios.
|
||||
Add a radio from the list of hardware radios available. Or add the best match.
|
||||
Then set your sound devices for that radio; the device for the radio speakers, the microphone and so forth. All configuration
|
||||
is (mostly) from the Config button. Ignore old directions and don't bother with a config file.
|
||||
To uninstall Quisk, just delete the quisk directory.
|
||||
@@ -526,7 +534,7 @@ When you first install Quisk, you will not have any settings for your radio.
|
||||
Press the Config button and go to the Radios screen.
|
||||
Then create a radio by specifying the general hardware type and give it a name of your choosing.
|
||||
For a Hermes-Lite, specify "Hermes" as the hardware type and call it "HL2" (or some other name).
|
||||
Press "Add" and a new tab for your radio will appear. Look through the various settings on the HL2 tab.
|
||||
Press "Apply" and a new tab for your radio will appear. Look through the various settings on the HL2 tab.
|
||||
The parameters for the radios are stored in the file quisk_settings.json.
|
||||
<br>
|
||||
<br>
|
||||
@@ -824,8 +832,14 @@ SoftRock radios use an analog mixer to change the RF signal to stereo audio, and
|
||||
A high quality sound card is advisable. The analog mixer is not perfect, and it will be necessary to adjust the I and Q
|
||||
signals to equal amplitude and 90 degrees phase difference. Use the Config/Config screen buttons to
|
||||
bring up an adjustment screen. Adjustments must be made for each band, and separately for transmit and receive.
|
||||
The adjustment depends on both the VFO frequency and the tuning offset from the VFO. See my paper
|
||||
The adjustment depends on both the VFO frequency and the tuning offset from the VFO.
|
||||
Quisk has an option to fix the tuning offset to a constant and to tune with the hardware.
|
||||
The tuning offset then has a constant correction and it is only necessary to correct for the VFO,
|
||||
a much less sensitive correction.
|
||||
See my paper
|
||||
<a href="http://james.ahlstrom.name/phase_corr.html">http://james.ahlstrom.name/phase_corr.html</a> for more information.
|
||||
<br>
|
||||
<br>
|
||||
A good strategy is to pick a VFO near the band center, and record corrections at an Rx frequency of -15000, -1000, 1000 and 15000 Hertz.
|
||||
If the corrections are sensitive to VFO, record the corrections for these same Rx frequencies at VFOs equal to
|
||||
or slightly outside the upper and lower band edges.
|
||||
@@ -834,15 +848,20 @@ You can add as many correction points as desired. The corrections are saved in t
|
||||
by hand if you are a Python expert. Otherwise you can just read the values.
|
||||
<br>
|
||||
<br>
|
||||
If you fix the tuning offset to a constant, you can create a correction for VFO at the band center, or
|
||||
the center and both edges.
|
||||
<br>
|
||||
<br>
|
||||
To create a Receive correction point for a given VFO and frequency, attach a signal generator to the SoftRock through an attenuator,
|
||||
and look at the image on the graph screen. If the signal is 3500 Hertz above the VFO, the image is 3500 Hertz below it.
|
||||
If you don't have a signal generator, find a strong station on the band and look at its image. Minimize the image by adjusting
|
||||
the amplitude and phase sliders on the adjustment screen, and then press "Save".
|
||||
Choose "Measure" to measure the corrections and then "Add Cell".
|
||||
If you don't have a signal generator, find a strong station on the band and look at its image. Choose "Manual adjustment".
|
||||
Minimize the image by adjusting the amplitude and phase sliders on the adjustment screen, and then press "Add cell".
|
||||
<br>
|
||||
<br>
|
||||
To create a Transmit correction point for a given VFO and frequency, attach the SoftRock RF output to a spectrum analyzer through an attenuator,
|
||||
and look at the image. If you don't have a spectrum analyzer use a second receiver tuned to the image. Minimize the image by adjusting
|
||||
the amplitude and phase sliders on the adjustment screen, and then press "Save".
|
||||
the amplitude and phase sliders on the adjustment screen, and then press "Add cell".
|
||||
<br>
|
||||
<br>
|
||||
</p>
|
||||
@@ -1468,28 +1487,47 @@ show the devices being used. Change the Fldigi playback to QuiskDigitalInput, an
|
||||
Monitor of QuiskDigitalOutput. Then everything should work. You do not need to use pavucontrol again because PulseAudio will
|
||||
remember the settings.
|
||||
<br>
|
||||
|
||||
<br>
|
||||
If you don't have PulseAudio or don't want to use it, you can use the ALSA loopback device.
|
||||
The ALSA loopback device works the same way as the Windows VAC. First
|
||||
create the loopback device with the command "modprobe snd-aloop" (you
|
||||
will need to be root). You can create the loopback device
|
||||
when the system starts, but the way to do that depends on your version of
|
||||
Linux. I added snd-aloop to /etc/modules. You could put the modprobe command in /etc/rc.local instead.
|
||||
Michael, DK1MI/N1BSD, has written a nice description of how to set up Fldigi. It is available
|
||||
at his site <a href="https://dk1mi.radio/quisk-fldigi/">https://dk1mi.radio/quisk-fldigi/</a>.
|
||||
<br>
|
||||
<br>
|
||||
If your digital program only uses Alsa devices or you don't want to use PulseAudio,
|
||||
you can use the ALSA loopback device.
|
||||
It works the same way as the Windows VAC. First create the loopback device with this command:
|
||||
<br>
|
||||
<br>
|
||||
<pre>
|
||||
sudo modprobe snd-aloop index=19
|
||||
</pre>
|
||||
<br>
|
||||
<p>
|
||||
The "index" is the card number, and it is best to use a number higher than your regular cards.
|
||||
The loopback device will be gone on the next restart.
|
||||
You can create the loopback device every time the system starts, but the way to do that depends on your version of Linux.
|
||||
You could add this line to /etc/modprobe.d/alsa-base.conf:
|
||||
</p>
|
||||
<br>
|
||||
<pre>
|
||||
options snd-aloop index=19
|
||||
</pre>
|
||||
<br>
|
||||
<p>
|
||||
Or you could add snd-aloop to /etc/modules or put the modprobe command in /etc/rc.local instead.
|
||||
Restart Linux. Now you can enter "cat /proc/asound/cards" to
|
||||
print out your sound cards, and you should see a "Loopback" card
|
||||
listed. The cards are also shown on the Quisk Sound
|
||||
screen. The Loopback card has one side that connects to Quisk and
|
||||
print out your sound cards, and you should see a "Loopback" card listed.
|
||||
The Loopback card has one side that connects to Quisk and
|
||||
another side that connects to your digital program. For the Quisk
|
||||
side connect both Digital Input and Digital Output to Loopback,0.
|
||||
side connect both Digital Input and Digital Output to the Loopback at hw:19,0.
|
||||
Note that the Loopback card is full duplex, and handles both
|
||||
input and output. There are actually eight loopbacks created at once,
|
||||
but we are only using subdevice 0. For the digital program side, set the input and
|
||||
output to "Loopback,1".
|
||||
output to the Loopback at hw:19,1.
|
||||
Your audio is now connected and you
|
||||
should be able to receive digital signals. Be sure to test your
|
||||
transmit signal off the air. You may need to reduce power to
|
||||
improve linearity.
|
||||
</p>
|
||||
<br>
|
||||
|
||||
<br>
|
||||
|
||||
+87
-39
@@ -1,9 +1,9 @@
|
||||
from __future__ import absolute_import
|
||||
# This code was contributed by Christof, DJ4CM. Many Thanks!!
|
||||
# Modified November 2024 by N2ADR to remove deprecated telnetlib module.
|
||||
|
||||
import threading
|
||||
import socket
|
||||
import time
|
||||
import telnetlib
|
||||
import quisk_conf_defaults as conf
|
||||
|
||||
class DxEntry:
|
||||
@@ -81,61 +81,109 @@ class DxEntry:
|
||||
|
||||
class DxCluster(threading.Thread):
|
||||
def __init__(self):
|
||||
self.do_init = 1
|
||||
self.error = 'Starting'
|
||||
self.dxSpots = []
|
||||
threading.Thread.__init__(self)
|
||||
self.doQuit = threading.Event()
|
||||
self.dxSpots = []
|
||||
self.doQuit.clear()
|
||||
self.dxLock = threading.Lock()
|
||||
self.addr = conf.dxClHost + ':' + str(conf.dxClPort)
|
||||
self.msg_no_spots = "No DX Cluster data from " + self.addr
|
||||
self.msg_one_spot = '1 DX spot received from ' + self.addr
|
||||
self.msg_spots = ' DX spots received from ' + self.addr
|
||||
|
||||
def run(self):
|
||||
self.telnetInit()
|
||||
self.telnetConnect()
|
||||
if self.error:
|
||||
self.sock.close()
|
||||
return
|
||||
while not self.doQuit.isSet():
|
||||
try:
|
||||
self.telnetRead()
|
||||
by = self.sock.recv(1024)
|
||||
except TimeoutError:
|
||||
continue
|
||||
except:
|
||||
self.tn.close()
|
||||
time.sleep(20)
|
||||
by = b''
|
||||
if by:
|
||||
with self.dxLock:
|
||||
self.bytes += by
|
||||
else:
|
||||
self.sock.close()
|
||||
self.error = "Restarting " + self.addr
|
||||
time.sleep(2)
|
||||
if not self.doQuit.isSet():
|
||||
self.telnetConnect()
|
||||
self.tn.close()
|
||||
|
||||
def setListener (self, listener):
|
||||
self.listener = listener
|
||||
if self.error:
|
||||
self.sock.close()
|
||||
return
|
||||
self.sock.close()
|
||||
|
||||
def telnetInit(self):
|
||||
self.tn = telnetlib.Telnet()
|
||||
|
||||
def telnetConnect(self):
|
||||
self.bytes = bytearray(0)
|
||||
self.error = 'Starting'
|
||||
self.sock = socket.socket()
|
||||
self.sock.settimeout(20)
|
||||
try:
|
||||
self.sock.connect( (conf.dxClHost, conf.dxClPort) )
|
||||
except:
|
||||
self.error = "Failed to connect to " + self.addr
|
||||
return
|
||||
self.sock.settimeout(1)
|
||||
for i in range(10):
|
||||
try:
|
||||
self.tn.open(conf.dxClHost, conf.dxClPort, 10)
|
||||
self.tn.read_until(b"login:", 10)
|
||||
self.tn.write(conf.user_call_sign.encode('utf-8', errors='ignore') + b"\n") # user_call_sign may be Unicode
|
||||
break
|
||||
self.bytes += self.sock.recv(1024)
|
||||
except:
|
||||
time.sleep(0.5)
|
||||
pass
|
||||
if b"login:" in self.bytes:
|
||||
break
|
||||
else:
|
||||
self.error = 'No "login:" prompt from ' + self.addr
|
||||
return
|
||||
self.sock.sendall(conf.user_call_sign.encode('utf-8', errors='ignore') + b"\r\n")
|
||||
if conf.dxClPassword:
|
||||
self.tn.read_until(b"Password: ")
|
||||
self.tn.write(conf.dxClPassword.encode('utf-8', errors='ignore') + b"\n")
|
||||
for i in range(10):
|
||||
try:
|
||||
self.bytes += self.sock.recv(1024)
|
||||
except:
|
||||
pass
|
||||
if b"Password:" in self.bytes:
|
||||
break
|
||||
else:
|
||||
self.error = 'No "Password:" prompt from ' + self.addr
|
||||
return
|
||||
self.sock.sendall(conf.dxClPassword.encode('utf-8', errors='ignore') + b"\r\n")
|
||||
self.error = ''
|
||||
self.bytes = bytearray(0)
|
||||
|
||||
def telnetRead(self):
|
||||
message = self.tn.read_until(b'\n', 60).decode(encoding='utf-8', errors='replace')
|
||||
if self.doQuit.isSet() == False:
|
||||
dxEntry = DxEntry();
|
||||
if dxEntry.parseMessage(message):
|
||||
for i, listElement in enumerate(self.dxSpots):
|
||||
if (listElement.equal(dxEntry)):
|
||||
listElement.join (dxEntry)
|
||||
return
|
||||
if listElement.isExpired():
|
||||
del (self.dxSpots[i])
|
||||
self.dxSpots.append(dxEntry)
|
||||
if self.listener:
|
||||
self.listener()
|
||||
|
||||
def getHost(self):
|
||||
return self.tn.host + ':' + str(self.tn.port)
|
||||
def Poll(self):
|
||||
with self.dxLock:
|
||||
index = self.bytes.find(b"\n")
|
||||
if index >= 0:
|
||||
message = self.bytes[0:index + 1]
|
||||
self.bytes = self.bytes[index + 1:]
|
||||
else:
|
||||
return
|
||||
message = message.decode(encoding='utf-8', errors='replace')
|
||||
dxEntry = DxEntry()
|
||||
if dxEntry.parseMessage(message):
|
||||
for i, listElement in enumerate(self.dxSpots):
|
||||
if (listElement.equal(dxEntry)):
|
||||
listElement.join (dxEntry)
|
||||
return True
|
||||
if listElement.isExpired():
|
||||
del (self.dxSpots[i])
|
||||
self.dxSpots.append(dxEntry)
|
||||
return True
|
||||
|
||||
def stop(self):
|
||||
self.doQuit.set()
|
||||
|
||||
def dxStatus(self):
|
||||
if self.error:
|
||||
return self.error
|
||||
nSpots = len(self.dxSpots)
|
||||
if nSpots == 0:
|
||||
return self.msg_no_spots
|
||||
elif nSpots == 1:
|
||||
return self.msg_one_spot
|
||||
return str(nSpots) + self.msg_spots
|
||||
|
||||
@@ -402,6 +402,8 @@ class Hardware(BaseHardware):
|
||||
if do_tx:
|
||||
try:
|
||||
self.rx_udp_socket.send(s)
|
||||
if DEBUG:
|
||||
self.PrintStatus(' Send', self.want_udp_status)
|
||||
except:
|
||||
pass
|
||||
def SetVNA(self, key_down=None, vna_start=None, vna_stop=None, vna_count=None, do_tx=False):
|
||||
|
||||
+7
-6
@@ -372,7 +372,7 @@ static void process_alc(complex double * cSamples, int count, struct alc * pt, r
|
||||
|
||||
static int tx_filter(complex double * filtered, int count)
|
||||
{ // Input samples are creal(filtered), output is filtered. The input rate must be 8000 or 48000 sps.
|
||||
int i, is_ssb;
|
||||
int i, is_ssb, mic_interp;
|
||||
int sample_rate = 8000;
|
||||
double dsample, dtmp, magn;
|
||||
complex double csample;
|
||||
@@ -423,9 +423,10 @@ static int tx_filter(complex double * filtered, int count)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
mic_interp = MIC_OUT_RATE / sample_rate;
|
||||
// check size of dsamples[] and csamples[] buffer
|
||||
if (count > samples_size) {
|
||||
samples_size = count * 2;
|
||||
samples_size = count * 2 * mic_interp;
|
||||
if (dsamples)
|
||||
free(dsamples);
|
||||
if (csamples)
|
||||
@@ -541,8 +542,8 @@ static int tx_filter(complex double * filtered, int count)
|
||||
// remove clipping distortion
|
||||
count = quisk_cDecimate(csamples, count, &cfiltAudio3, 1);
|
||||
// Interpolate up to 48000
|
||||
if (MIC_OUT_RATE != sample_rate)
|
||||
count = quisk_cInterpolate(csamples, count, &cfiltInterp, MIC_OUT_RATE / sample_rate);
|
||||
if (mic_interp != 1)
|
||||
count = quisk_cInterpolate(csamples, count, &cfiltInterp, mic_interp);
|
||||
// convert back to 16 bits
|
||||
for (i = 0; i < count; i++) {
|
||||
filtered[i] = csamples[i] * CLIP16;
|
||||
@@ -573,8 +574,8 @@ static int tx_filter(complex double * filtered, int count)
|
||||
// remove clipping distortion
|
||||
count = quisk_dFilter(dsamples, count, &dfiltAudio3);
|
||||
// Interpolate up to 48000
|
||||
if (MIC_OUT_RATE != sample_rate)
|
||||
count = quisk_dInterpolate(dsamples, count, &dfiltInterp, MIC_OUT_RATE / sample_rate);
|
||||
if (mic_interp != 1)
|
||||
count = quisk_dInterpolate(dsamples, count, &dfiltInterp, mic_interp);
|
||||
// convert back to 16 bits
|
||||
for (i = 0; i < count; i++) {
|
||||
filtered[i] = dsamples[i] * CLIP16;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
#
|
||||
@@ -0,0 +1,209 @@
|
||||
# This file is part of the Multus project. See https://www.multus-sdr.com/.
|
||||
# It controls what items appear on the Hardware configuration screen and
|
||||
# provides logic for each radio.
|
||||
|
||||
|
||||
################ Receivers Multus CW, A transceiver from the Multus project.
|
||||
## hardware_file_name Hardware file path, rfile
|
||||
# This is the file that contains the control logic for each radio.
|
||||
#hardware_file_name = "multuspkg/quisk_hardware.py"
|
||||
|
||||
## widgets_file_name Widget file path, rfile
|
||||
# This optional file adds additional controls for the radio.
|
||||
#widgets_file_name = ""
|
||||
|
||||
## rx_max_amplitude_correct Max ampl correct, number
|
||||
# If you get your I/Q samples from a sound card, you will need to correct the
|
||||
# amplitude and phase for inaccuracies in the analog hardware. The correction is
|
||||
# entered using the controls from the "Rx Phase" button on the config screen.
|
||||
# You must enter a positive number. This controls the range of the control.
|
||||
#rx_max_amplitude_correct = 0.2
|
||||
|
||||
## rx_max_phase_correct Max phase correct, number
|
||||
# If you get your I/Q samples from a sound card, you will need to correct the
|
||||
# amplitude and phase for inaccuracies in the analog hardware. The correction is
|
||||
# entered using the controls from the "Rx Phase" button on the config screen.
|
||||
# You must enter a positive number. This controls the range of the control in degrees.
|
||||
#rx_max_phase_correct = 10.0
|
||||
|
||||
## tx_level Tx Level, dict
|
||||
# This is the level of the Tx audio sent to SoftRock hardware after all processing as a percentage
|
||||
# number from 0 to 100.
|
||||
# The level should be below 100 to allow headroom for amplitude and phase adjustments.
|
||||
# Changes are immediate (no need to restart).
|
||||
#tx_level = {}
|
||||
|
||||
## digital_tx_level Digital Tx power %, integer
|
||||
# Digital modes reduce power by the percentage on the config screen.
|
||||
# This is the maximum value of the slider.
|
||||
#digital_tx_level = 100
|
||||
|
||||
## keyer_speed Keyer speed WPM, integer
|
||||
# This sets the keyer speed in words per minute.
|
||||
#keyer_speed = 8
|
||||
#keyer_speed = 13
|
||||
#keyer_speed = 18
|
||||
#keyer_speed = 20
|
||||
#keyer_speed = 30
|
||||
#keyer_speed = 40
|
||||
|
||||
## keyer_type Type of keyer, text choice
|
||||
# Use "Straight" mode for a straight key or a bug. Connect the tip of the key to the transceiver.
|
||||
# Otherwise, select Iambic-A or Iambic-B mode of operation.
|
||||
#keyer_type = "Straight"
|
||||
#keyer_type = "Iambic-A"
|
||||
#keyer_type = "Iambic-B"
|
||||
|
||||
## keyer_space Keyer space, text choice
|
||||
# This sets the type of spacing between elements or letters.
|
||||
# "Element" attempts to provide proper spacing between the elements of a character.
|
||||
# (The keyer always provides proper spacing between elements).
|
||||
# "Letter" turns on letter spacing. This attempts to provide proper spacing between characters.
|
||||
#keyer_space = "Element"
|
||||
#keyer_space = "Letter"
|
||||
|
||||
## keyer_weight Keyer weight, integer choice
|
||||
# A weight of 50% means that the dit time equals the inter-element time, which is standard.
|
||||
# Reducing the weight increases the inter-element time, increasing the weight reduces it.
|
||||
#keyer_weight = 50
|
||||
#keyer_weight = 25
|
||||
#keyer_weight = 75
|
||||
|
||||
## keyer_paddle Keyer paddle, text choice
|
||||
# "Normal" means the left paddle is DIT. "Reverse" means the left paddle is DAH.
|
||||
#keyer_paddle = "Normal"
|
||||
#keyer_paddle = "Reverse"
|
||||
|
||||
import configure
|
||||
import softrock
|
||||
from softrock.hardware_usb import Hardware as BaseHardware
|
||||
from softrock.hardware_usb import IN, OUT, UBYTE2, UBYTE4
|
||||
import _quisk as QS
|
||||
|
||||
DEBUG = 0
|
||||
|
||||
class Hardware(BaseHardware):
|
||||
def __init__(self, app, conf):
|
||||
# Set constant parameters here:
|
||||
conf.usb_vendor_id = 0x16c0
|
||||
conf.usb_product_id = 0x05dc
|
||||
conf.si570_i2c_address = 0x55
|
||||
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
|
||||
if DEBUG:
|
||||
print ("The name of this radio is", configure.Settings[1])
|
||||
print ("The hardware file type is", conf.hardware_file_type)
|
||||
def TransferOut(self, address, message): # message is a bytes array or an integer 0 to 255
|
||||
if isinstance(message, int):
|
||||
message = message.to_bytes(1, 'big')
|
||||
if self.usb_dev:
|
||||
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()
|
||||
return text
|
||||
def ChangeMode(self, mode):
|
||||
ret = BaseHardware.ChangeMode(self, mode)
|
||||
if mode in ("CWL", "CWU"):
|
||||
cw_mode = b'C' # Adding "b" does not affect the value sent
|
||||
if DEBUG:
|
||||
print ("Mode is CW")
|
||||
else:
|
||||
cw_mode = b'U'
|
||||
if DEBUG:
|
||||
print ("Mode is not CW")
|
||||
self.TransferOut(0x70, cw_mode)
|
||||
return ret
|
||||
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
|
||||
if not hasattr(conf, "keyer_speed"):
|
||||
conf.keyer_speed = 18
|
||||
if not hasattr(conf, "keyer_type"):
|
||||
conf.keyer_type = "Straight"
|
||||
if not hasattr(conf, "keyer_space"):
|
||||
conf.keyer_space = "Element"
|
||||
if not hasattr(conf, "keyer_weight"):
|
||||
conf.keyer_weight = 50
|
||||
if not hasattr(conf, "keyer_paddle"):
|
||||
conf.keyer_paddle = "Normal"
|
||||
# We need to initialize in case the persistent hardware values differ from the Quisk values.
|
||||
for name in ("keyer_speed", "keyer_type", "keyer_space", "keyer_weight", "keyer_paddle", "cwTone"):
|
||||
self.ImmediateChange(name)
|
||||
def ImmediateChange(self, name):
|
||||
BaseHardware.ImmediateChange(self, name)
|
||||
value = getattr(self.conf, name)
|
||||
if DEBUG:
|
||||
print ("ImmediateChange", name, value)
|
||||
if name == "keyer_speed":
|
||||
self.TransferOut(0x7B, value)
|
||||
elif name == "keyer_type":
|
||||
if value == "Straight":
|
||||
mode = 0
|
||||
elif value == "Iambic-A":
|
||||
mode = 1
|
||||
elif value == "Iambic-B":
|
||||
mode = 2
|
||||
else:
|
||||
mode = 0
|
||||
self.TransferOut(0x71, mode)
|
||||
elif name == "keyer_space":
|
||||
if value == "Element":
|
||||
spacing = 0
|
||||
elif value == "Letter":
|
||||
spacing = 1
|
||||
else:
|
||||
spacing = 0
|
||||
self.TransferOut(0x75, spacing)
|
||||
elif name == "keyer_weight":
|
||||
weight = int(value)
|
||||
self.TransferOut(0x77, weight)
|
||||
elif name == "keyer_paddle":
|
||||
if value == "Normal":
|
||||
paddle = 0
|
||||
elif value == "Reverse":
|
||||
paddle = 1
|
||||
else:
|
||||
paddle = 0
|
||||
self.TransferOut(0x73, paddle)
|
||||
elif name == "cwTone":
|
||||
if value < 500:
|
||||
tone_index = 0 # 400 Hz
|
||||
elif 500 <= value < 700:
|
||||
tone_index = 1 # 600 Hz
|
||||
elif 700 <= value < 900:
|
||||
tone_index = 2 # 800 Hz
|
||||
else:
|
||||
tone_index = 3 # 1000 Hz
|
||||
self.TransferOut(0x7F, tone_index)
|
||||
|
||||
|
||||
@@ -152,9 +152,14 @@ static int quisk_use_sidetone; // is there a sidetone volume control?
|
||||
static int hl2_txbuf_errors; // errors in the Hermes-Lite2 Tx buffer
|
||||
static int hl2_txbuf_state; // state machine for errors in the Hermes-Lite2 Tx buffer
|
||||
static int freedv_monitor; // pass the Freedv audio to the speakers instead of to the demodulator
|
||||
static int softrock_correct_freq; // gain and phase corrections for SoftRock
|
||||
static double softrock_correct_gain;
|
||||
static double softrock_correct_phase;
|
||||
static int softrock_correct_active; // 0 No correction adjustment; 1 Manual adjustment; 2 Calculate Rx corrections
|
||||
|
||||
static complex double PySampleBuf[SAMP_BUFFER_SIZE]; // buffer for samples returned from Python
|
||||
static int PySampleCount; // count of samples in buffer
|
||||
static bool quisk_tx_inhibit;
|
||||
|
||||
static int multirx_data_width; // width of graph data to return
|
||||
static int multirx_fft_width; // size of FFT samples
|
||||
@@ -1971,7 +1976,7 @@ static int quisk_process_demodulate(complex double * cSamples, double * dsamples
|
||||
ssb_squelch(dsamples, nSamples, quisk_filter_srate, MeasureSquelch + bank);
|
||||
d_delay(dsamples, nSamples, bank, SQUELCH_FFT_SIZE);
|
||||
}
|
||||
quisk_calc_audio_graph(pow(2, 31) - 1, NULL, dsamples, nSamples, 1);
|
||||
//quisk_calc_audio_graph(pow(2, 31) - 1, NULL, dsamples, nSamples, 1);
|
||||
nSamples = quisk_dInterpolate(dsamples, nSamples, &Storage[bank].filtAudio24p4, 2);
|
||||
nSamples = quisk_dInterp2HB45(dsamples, nSamples, &Storage[bank].HalfBand7);
|
||||
//quisk_calc_audio_graph(pow(2, 31) - 1, NULL, dsamples, nSamples, 1);
|
||||
@@ -2741,7 +2746,7 @@ int quisk_process_samples(complex double * cSamples, int nSamples)
|
||||
multirx_cSamples[0][i] = dsamples2[i] + I * dsamples2[i];
|
||||
process_agc(&Agc3, multirx_cSamples[0], n, 0);
|
||||
}
|
||||
play_sound_interface(quiskPlaybackDevices[QUISK_INDEX_SUB_RX1], n, multirx_cSamples[0], 1, 1.0);
|
||||
play_sound_interface(quiskPlaybackDevices[QUISK_INDEX_SUB_RX1], n, multirx_cSamples[0], 1, digital_output_level);
|
||||
}
|
||||
|
||||
// Perhaps decimate by an additional fraction
|
||||
@@ -3156,6 +3161,10 @@ static PyObject * get_params(PyObject * self, PyObject * args)
|
||||
return PyInt_FromLong(quisk_serial_ptt);
|
||||
if (strcmp(name, "hl2_txbuf_errors") == 0)
|
||||
return PyInt_FromLong(hl2_txbuf_errors);
|
||||
if (strcmp(name, "softrock_correct_active") == 0)
|
||||
return PyInt_FromLong((long)softrock_correct_active);
|
||||
if (strcmp(name, "quisk_tx_inhibit") == 0)
|
||||
return PyInt_FromLong((long)quisk_tx_inhibit);
|
||||
Py_INCREF (Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
@@ -3759,6 +3768,7 @@ static int read_rx_udp10(complex double * samp) // Read samples from UDP using t
|
||||
//code_version = quisk_hermes_to_pc[3];
|
||||
if ((quisk_hermes_to_pc[0] & 0x01) != 0) // C1
|
||||
quisk_sound_state.overrange++;
|
||||
quisk_tx_inhibit = (quisk_hermes_to_pc[0] & 0x02) == 0; // should limit to Hermes Lite2 only
|
||||
hardware_ptt = buf[start] & 0x01; // C0 bit zero is PTT
|
||||
quisk_hardware_cwkey = (buf[start] & 0x04) >> 2; // C0 bit two is CW key state
|
||||
switch (hl2_txbuf_state) {
|
||||
@@ -3870,6 +3880,10 @@ static int read_rx_udp17(complex double * cSamples0) // Read samples from UDP
|
||||
fft_data * ptFFT;
|
||||
fd_set fds;
|
||||
static int block_number=0;
|
||||
static complex double dc_average = 0; // Average DC component in samples
|
||||
static complex double dc_sum = 0;
|
||||
static int dc_count = 0;
|
||||
static time_t time0 = 0;
|
||||
// Data from the receiver is little-endian
|
||||
|
||||
if ( ! rx_udp_gain_correct) { // correct for second stage CIC decimation JIM JIM
|
||||
@@ -3975,6 +3989,16 @@ static int read_rx_udp17(complex double * cSamples0) // Read samples from UDP
|
||||
if (xr & 0x100) { // channel 1
|
||||
if (quisk_invert_spectrum) // Invert spectrum
|
||||
sample = conj(sample);
|
||||
// correct the DC level
|
||||
dc_sum += sample;
|
||||
dc_count++;
|
||||
sample -= dc_average;
|
||||
if (dc_count >= 48000 && time(NULL) != time0) {
|
||||
time0 = time(NULL);
|
||||
dc_average = dc_sum / dc_count;
|
||||
dc_sum = dc_count = 0;
|
||||
//printf ("New DC average %.0lf\n", cabs(dc_average));
|
||||
}
|
||||
// Put samples into the fft input array.
|
||||
ptFFT = fft_data_array + fft_data_index;
|
||||
if ( ! (xi & 0x100)) { // zero marker for start of first block
|
||||
@@ -4242,6 +4266,13 @@ static PyObject * change_scan(PyObject * self, PyObject * args) // Called from G
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
static PyObject * softrock_corrections(PyObject * self, PyObject * args) // Called from GUI thread
|
||||
{
|
||||
if (!PyArg_ParseTuple (args, "i", &softrock_correct_active))
|
||||
return NULL;
|
||||
return Py_BuildValue("idd", softrock_correct_freq, softrock_correct_gain, softrock_correct_phase);
|
||||
}
|
||||
|
||||
static PyObject * change_rates(PyObject * self, PyObject * args) // Called from GUI thread
|
||||
{ // Change to new sample rates
|
||||
|
||||
@@ -5029,6 +5060,135 @@ static PyObject * get_bandscope(PyObject * self, PyObject * args) // Called by t
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void check_channel_delay(fft_data * ptFft)
|
||||
{
|
||||
int i, maxi, freq;
|
||||
static int count=0, freq0;
|
||||
static double gain=0, phase=0;
|
||||
double d, ampl, maxa;
|
||||
static double complex * samples1=NULL, * samples2;
|
||||
|
||||
if (samples1 == NULL) {
|
||||
samples1 = (double complex *)malloc(fft_size * sizeof(double complex));
|
||||
samples2 = (double complex *)malloc(fft_size * sizeof(double complex));
|
||||
}
|
||||
for (i = 0; i < fft_size; i++) {
|
||||
samples1[i] = creal(ptFft->samples[i]);
|
||||
samples2[i] = cimag(ptFft->samples[i]);
|
||||
}
|
||||
fftw_execute_dft(quisk_fft_plan, samples1, samples1);
|
||||
fftw_execute_dft(quisk_fft_plan, samples2, samples2);
|
||||
maxa = 0;
|
||||
maxi = 0;
|
||||
for (i = 0; i < fft_size / 2; i++) {
|
||||
ampl = cabs(samples1[i]);
|
||||
if (ampl > maxa) {
|
||||
maxa = ampl;
|
||||
maxi = i;
|
||||
}
|
||||
}
|
||||
freq = maxi * fft_sample_rate / fft_size;
|
||||
//freq = maxi * 44100 / fft_size;
|
||||
gain += cabs(samples1[maxi]) / cabs(samples2[maxi]);
|
||||
d = carg(samples1[maxi]) - carg(samples2[maxi]);
|
||||
if (d > M_PI)
|
||||
d -= M_PI * 2;
|
||||
else if(d < - M_PI)
|
||||
d += M_PI * 2;
|
||||
phase += d;
|
||||
count += 1;
|
||||
if (count == 1) {
|
||||
freq0 = freq;
|
||||
}
|
||||
else if (freq != freq0) {
|
||||
gain = phase = count = 0;
|
||||
return;
|
||||
}
|
||||
if (count > 10) {
|
||||
gain /= count;
|
||||
phase /= count;
|
||||
//printf("Channel delay freq %6d, gain %6.3lf, phase %8.5lf radians, %6.3lf degrees\n",
|
||||
// freq, gain, phase, phase * 57.29578);
|
||||
printf("%6d, %6.3lf, %6.3lf\n", freq, gain, phase * 57.29578);
|
||||
gain = phase = count = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void softrock_correct_fft(fft_data * ptFft, int fixit)
|
||||
{ // See i/Q balance in Rocky: https://www.dxatlas.com/Rocky/Advanced.asp
|
||||
double ampl, r1, r2, i1, i2, Zr, Zi, Pwr, Gain, Phase, OutR, OutI, S1R, S1I, S2R, S2I;
|
||||
static double tot_ga=0, tot_ph=0;
|
||||
static int count=0;
|
||||
double maxa = 0;
|
||||
int i, maxi = 0, freq;
|
||||
double complex Z, s1, s2, Hr, Hi, S1, S2;
|
||||
double tim;
|
||||
static double time0 = 0;
|
||||
|
||||
for (i = 0; i < fft_size; i++) {
|
||||
ampl = cabs(ptFft->samples[i]);
|
||||
if (ampl > maxa) {
|
||||
maxa = ampl;
|
||||
maxi = i;
|
||||
}
|
||||
}
|
||||
if (maxi < fft_size / 2)
|
||||
freq = maxi;
|
||||
else
|
||||
freq = maxi - fft_size;
|
||||
freq = freq * fft_sample_rate / fft_size;
|
||||
s1 = ptFft->samples[maxi];
|
||||
s2 = ptFft->samples[fft_size - maxi];
|
||||
Z = s1 * s2;
|
||||
r1 = creal(s1);
|
||||
r2 = creal(s2);
|
||||
i1 = cimag(s1);
|
||||
i2 = cimag(s2);
|
||||
Pwr = r1 * r1 + i1 * i1 + r2 * r2 + i2 * i2;
|
||||
Zr = creal(Z) / Pwr;
|
||||
Zi = cimag(Z) / Pwr;
|
||||
Gain = sqrt((1.0 + 2 * Zr) / (1.0 - 2 * Zr));
|
||||
Phase = asin(Zi * (Gain * Gain + 1.0) / Gain);
|
||||
tot_ga += Gain;
|
||||
tot_ph += Phase;
|
||||
count += 1;
|
||||
tim = QuiskTimeSec();
|
||||
if (tim - time0 >= 0.5) {
|
||||
time0 = tim;
|
||||
softrock_correct_freq = freq;
|
||||
softrock_correct_gain = tot_ga / count;
|
||||
softrock_correct_phase = tot_ph / count;
|
||||
//if (softrock_correct_active)
|
||||
// printf("Freq domain Gain %10.7lf, Phase %10.7lf, %10.7lf, freq %d\n",
|
||||
// softrock_correct_gain, softrock_correct_phase, softrock_correct_phase * 57.29578, freq);
|
||||
tot_ga = tot_ph = count = 0;
|
||||
}
|
||||
if (fixit) {
|
||||
Hr = softrock_correct_gain * cos(softrock_correct_phase);
|
||||
Hi = softrock_correct_gain * sin(softrock_correct_phase);
|
||||
for (i = 1; i < fft_size / 2; i++) {
|
||||
S1 = ptFft->samples[fft_size - i];
|
||||
S2 = ptFft->samples[i];
|
||||
S1R = creal(S1);
|
||||
S1I = cimag(S1);
|
||||
S2R = creal(S2);
|
||||
S2I = cimag(S2);
|
||||
OutR = S2R + S1R - (S2I + S1I) * Hi + (S2R - S1R) * Hr;
|
||||
OutI = S2I - S1I + (S2I + S1I) * Hr + (S2R - S1R) * Hi;
|
||||
ptFft->samples[i] = OutR + I * OutI;
|
||||
S1R = creal(S2);
|
||||
S1I = cimag(S2);
|
||||
S2R = creal(S1);
|
||||
S2I = cimag(S1);
|
||||
OutR = S2R + S1R - (S2I + S1I) * Hi + (S2R - S1R) * Hr;
|
||||
OutI = S2I - S1I + (S2I + S1I) * Hr + (S2R - S1R) * Hi;
|
||||
ptFft->samples[fft_size - i] = OutR + I * OutI;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static PyObject * get_graph(PyObject * self, PyObject * args) // Called by the GUI thread
|
||||
{
|
||||
int i, j, k, m, n, index, ffts, ii, mm, m0, deltam;
|
||||
@@ -5101,7 +5261,10 @@ static PyObject * get_graph(PyObject * self, PyObject * args) // Called by the G
|
||||
// Continue with FFT calculation
|
||||
for (i = 0; i < fft_size; i++) // multiply by window
|
||||
ptFft->samples[i] *= fft_window[i];
|
||||
//check_channel_delay(ptFft);
|
||||
fftw_execute_dft(quisk_fft_plan, ptFft->samples, ptFft->samples); // Calculate FFT
|
||||
if (softrock_correct_active == 2)
|
||||
softrock_correct_fft(ptFft, 0);
|
||||
// Create RMS s-meter value at known bandwidth
|
||||
// The pass band is (rx_tune_freq + filter_start_offset) to += bandwidth
|
||||
// d1 is the tune frequency
|
||||
@@ -5152,6 +5315,9 @@ static PyObject * get_graph(PyObject * self, PyObject * args) // Called by the G
|
||||
//QuiskPrintf(" %d %.4lf At %5d to %5d place %5d to %5d for block %d\n", fft_size, scan_valid, mm, m, ii, i, ptFft->block);
|
||||
}
|
||||
else {
|
||||
// Zero frequency is at index fft_size / 2.
|
||||
// There are fft_size/2 positive frequencies and fft_size/2-1 negative frequencies.
|
||||
// The frequency at index k and (fft_size - k) are equal except for sign.
|
||||
count_fft++;
|
||||
k = 0;
|
||||
for (i = fft_size / 2; i < fft_size; i++) // Negative frequencies
|
||||
@@ -5977,6 +6143,7 @@ static PyMethodDef QuiskMethods[] = {
|
||||
{"get_filter_rate", get_filter_rate, METH_VARARGS, "Return the sample rate used for the filters."},
|
||||
{"get_tx_filter", quisk_get_tx_filter, METH_VARARGS, "Return the frequency response of the transmit filter."},
|
||||
{"get_audio_graph", get_audio_graph, METH_VARARGS, "Return a tuple of the audio graph data."},
|
||||
{"softrock_corrections", softrock_corrections, METH_VARARGS, "Control and return SoftRock amplitude and phase corrections."},
|
||||
{"measure_frequency", measure_frequency, METH_VARARGS, "Set the method, return the measured frequency."},
|
||||
{"measure_audio", measure_audio, METH_VARARGS, "Set the method, return the measured audio voltage."},
|
||||
{"get_overrange", get_overrange, METH_VARARGS, "Return the count of overrange (clip) for the ADC."},
|
||||
|
||||
@@ -320,6 +320,7 @@ extern int quisk_start_cw_delay; // milliseconds to delay output on serial or M
|
||||
extern int quisk_start_ssb_delay; // milliseconds to discard output for all modes except CW
|
||||
extern struct sound_dev * quiskPlaybackDevices[]; // array of Playback sound devices
|
||||
extern int quisk_close_file_play;
|
||||
extern double digital_output_level;
|
||||
|
||||
extern PyObject * quisk_set_spot_level(PyObject * , PyObject *);
|
||||
extern PyObject * quisk_get_tx_filter(PyObject * , PyObject *);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# All QUISK software is Copyright (C) 2006-2021 by James C. Ahlstrom.
|
||||
# All QUISK software is Copyright (C) 2006-2024 by James C. Ahlstrom.
|
||||
# This free software is licensed for use under the GNU General Public
|
||||
# License (GPL), see http://www.opensource.org.
|
||||
# Note that there is NO WARRANTY AT ALL. USE AT YOUR OWN RISK!!
|
||||
@@ -334,6 +334,7 @@ class HamlibHandlerSerial:
|
||||
self.public_name = public_name # the public name for the serial port
|
||||
self.tune_step = 1000
|
||||
if sys.platform == 'win32' or public_name.startswith("/dev/"):
|
||||
self.port_is_mod_serial = True # self.port is from the serial module
|
||||
try:
|
||||
import serial
|
||||
except:
|
||||
@@ -346,6 +347,7 @@ class HamlibHandlerSerial:
|
||||
print ("The serial port %s could not be opened." % public_name)
|
||||
else:
|
||||
import tty
|
||||
self.port_is_mod_serial = False # self.port is a file descriptor
|
||||
if os.path.lexists(public_name):
|
||||
try:
|
||||
os.remove(public_name)
|
||||
@@ -369,7 +371,7 @@ class HamlibHandlerSerial:
|
||||
def open(self):
|
||||
return
|
||||
def close(self):
|
||||
if sys.platform == 'win32':
|
||||
if self.port_is_mod_serial:
|
||||
if self.port:
|
||||
self.port.close()
|
||||
self.port = None
|
||||
@@ -382,7 +384,7 @@ class HamlibHandlerSerial:
|
||||
def Read(self):
|
||||
if self.port is None:
|
||||
return
|
||||
if sys.platform == 'win32':
|
||||
if self.port_is_mod_serial:
|
||||
text = self.port.read(99)
|
||||
if not isinstance(text, Q3StringTypes):
|
||||
text = text.decode('utf-8')
|
||||
@@ -433,22 +435,14 @@ class HamlibHandlerSerial:
|
||||
return
|
||||
if isinstance(data, Q3StringTypes):
|
||||
data = data.encode('utf-8', errors='ignore')
|
||||
if sys.platform == 'win32':
|
||||
if self.port_is_mod_serial:
|
||||
self.port.write(data)
|
||||
else:
|
||||
r, w, x = select.select((), (self.port,), (), 0)
|
||||
if w:
|
||||
os.write(self.port, data)
|
||||
def set_frequency(self, freq):
|
||||
tune = freq - self.app.VFO
|
||||
d = self.app.sample_rate * 45 // 100
|
||||
if -d <= tune <= d: # Frequency is on-screen
|
||||
vfo = self.app.VFO
|
||||
else: # Change the VFO
|
||||
vfo = (freq // 5000) * 5000 - 5000
|
||||
tune = freq - vfo
|
||||
self.app.BandFromFreq(freq)
|
||||
self.app.ChangeHwFrequency(tune, vfo, 'FreqEntry')
|
||||
def set_frequency(self, freq): # This changes the Rx frequency
|
||||
self.app.ChangeRxTxFrequency(freq, None)
|
||||
if HAMLIB_DEBUG: print("New Freq rx,tx", self.app.txFreq + self.app.VFO, self.app.rxFreq + self.app.VFO)
|
||||
def ZZAC(self, cmd, data, length): # Set or read tune steps
|
||||
if length == 0:
|
||||
@@ -658,6 +652,16 @@ class HamlibHandlerSerial:
|
||||
self.app.pttButton.SetValue(0, True)
|
||||
else:
|
||||
self.Error(cmd, data)
|
||||
def ZZSM(self, cmd, data, length): # return the S-meter value in dB * 2; 0 to 260
|
||||
if length == 0: # 0 to 260 is -140 to -10 dB; S9 == -73 dB == 134; dB = ZZSM / 2 - 140
|
||||
i = round((self.app.hamlib_strength + 67) * 2)
|
||||
if i < 0:
|
||||
i = 0
|
||||
elif i > 260:
|
||||
i = 260
|
||||
self.Write('%s%03d;' % (cmd, i))
|
||||
else:
|
||||
self.Error(cmd, data)
|
||||
def ZZSP(self, cmd, data, length): # the split status
|
||||
if length == 0:
|
||||
if self.app.split_rxtx:
|
||||
@@ -826,6 +830,8 @@ class HamlibHandlerRig2: # Test with telnet localhost 4532
|
||||
"""Send text back to the client."""
|
||||
if isinstance(text, Q3StringTypes):
|
||||
text = text.encode('utf-8', errors='ignore')
|
||||
if HAMLIB_DEBUG:
|
||||
print ("Rig2 send", text)
|
||||
try:
|
||||
self.sock.sendall(text)
|
||||
except socket.error:
|
||||
@@ -932,6 +938,8 @@ class HamlibHandlerRig2: # Test with telnet localhost 4532
|
||||
else:
|
||||
return 1
|
||||
self.input = self.input.strip() # Here is our command line
|
||||
if HAMLIB_DEBUG:
|
||||
print ("Rig2 received", self.input)
|
||||
while self.input:
|
||||
# Parse the commands and call the appropriate handlers
|
||||
self.params = ''
|
||||
@@ -982,8 +990,12 @@ class HamlibHandlerRig2: # Test with telnet localhost 4532
|
||||
if rx:
|
||||
rx = rx[0]
|
||||
self.Reply('Frequency', rx.txFreq + rx.VFO, 0)
|
||||
if HAMLIB_DEBUG:
|
||||
print ("GetFreq rx", rx.txFreq, rx.VFO)
|
||||
else:
|
||||
self.Reply('Frequency', self.app.rxFreq + self.app.VFO, 0)
|
||||
if HAMLIB_DEBUG:
|
||||
print ("GetFreq app", self.app.rxFreq, self.app.txFreq, self.app.VFO)
|
||||
def SetFreq(self): # The Rx frequency
|
||||
freq = self.GetParamNumber()
|
||||
try:
|
||||
@@ -1151,7 +1163,7 @@ class HamlibHandlerRig2: # Test with telnet localhost 4532
|
||||
def GetLevel(self):
|
||||
name = self.GetParamName()
|
||||
if name == '?': # send back supported parameters
|
||||
self.Reply2('AGC AF', 0)
|
||||
self.Reply2('AGC AF STRENGTH', 0)
|
||||
elif name == 'AGC':
|
||||
if self.app.BtnAGC.GetValue():
|
||||
self.Reply2(4, 0)
|
||||
@@ -1160,6 +1172,9 @@ class HamlibHandlerRig2: # Test with telnet localhost 4532
|
||||
elif name == 'AF':
|
||||
x = self.app.audio_volume # audio_volume is 0 to 1.000
|
||||
self.Reply2("%.5f" % x, 0)
|
||||
elif name == 'STRENGTH':
|
||||
i = round(self.app.hamlib_strength)
|
||||
self.Reply2(i, 0)
|
||||
else:
|
||||
self.ErrParam()
|
||||
def SetLevel(self):
|
||||
@@ -1419,12 +1434,8 @@ class ConfigStatus(wx.ScrolledCanvas):
|
||||
self.MakeRow2("Sample interrupts", self.interrupts, cfile)
|
||||
self.MakeRow2("Microphone or DGT level dB", level, qfile)
|
||||
self.MakeRow2("FFT number of points", self.fft_size, err_msg)
|
||||
if conf.dxClHost: # connection to dx cluster
|
||||
nSpots = len(application.dxCluster.dxSpots)
|
||||
if nSpots > 0:
|
||||
msg = str(nSpots) + ' DX spot' + ('' if nSpots==1 else 's') + ' received from ' + application.dxCluster.getHost()
|
||||
else:
|
||||
msg = "No DX Cluster data from %s" % conf.dxClHost
|
||||
if application.dxCluster:
|
||||
msg = application.dxCluster.dxStatus()
|
||||
self.MakeRow2("FFT number of errors", self.fft_error, msg)
|
||||
else:
|
||||
self.MakeRow2("FFT number of errors", self.fft_error)
|
||||
@@ -1762,6 +1773,12 @@ class GraphDisplay(wx.Window):
|
||||
dc.SetTextForeground(conf.color_graph_msg_fg)
|
||||
dc.SetBackgroundMode(wx.SOLID)
|
||||
dc.DrawText(self.display_text, 0, 0)
|
||||
if application.tx_inhibit:
|
||||
dc.SetFont(self.font)
|
||||
dc.SetTextBackground(conf.color_graph_msg_bg)
|
||||
dc.SetTextForeground("red")
|
||||
dc.SetBackgroundMode(wx.SOLID)
|
||||
dc.DrawText(" *** Tx Inhibit ***", 0, self.chary * 15 // 10)
|
||||
def DrawFilter(self, dc):
|
||||
dc.SetPen(wx.TRANSPARENT_PEN)
|
||||
dc.SetLogicalFunction(wx.COPY)
|
||||
@@ -1873,6 +1890,12 @@ class GraphScreen(wx.Window):
|
||||
self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
|
||||
self.Bind(wx.EVT_MOTION, self.OnMotion)
|
||||
self.Bind(wx.EVT_MOUSEWHEEL, self.OnWheel)
|
||||
# handle bandplan info
|
||||
self.bandplanWindow = wx.PopupWindow (parent)
|
||||
self.bandplanInfo = wx.TextCtrl(self.bandplanWindow, style=wx.TE_READONLY)
|
||||
self.bandplanInfo.SetFont(wx.Font(conf.status_font_size, wx.FONTFAMILY_SWISS, wx.NORMAL,
|
||||
wx.FONTWEIGHT_NORMAL, False, conf.quisk_typeface))
|
||||
self.bandplanWindow.Hide();
|
||||
self.MakeDisplay()
|
||||
def MakeDisplay(self):
|
||||
self.display = GraphDisplay(self, self.originX, 0, self.graph_width, 5, self.chary)
|
||||
@@ -2096,7 +2119,7 @@ class GraphScreen(wx.Window):
|
||||
"""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
|
||||
@@ -2193,7 +2216,8 @@ class GraphScreen(wx.Window):
|
||||
self.ChangeHwFrequency(self.txFreq, self.VFO, 'MouseBtn1', event=event, rx_freq=freq)
|
||||
else:
|
||||
self.ChangeHwFrequency(freq, self.VFO, 'MouseBtn1', event=event)
|
||||
self.CaptureMouse()
|
||||
if not self.HasCapture():
|
||||
self.CaptureMouse()
|
||||
def OnLeftUp(self, event):
|
||||
if self.HasCapture():
|
||||
self.ReleaseMouse()
|
||||
@@ -2206,7 +2230,7 @@ class GraphScreen(wx.Window):
|
||||
mouse_x, mouse_y = self.GetMousePosition(event)
|
||||
if wx.GetKeyState(wx.WXK_SHIFT):
|
||||
mouse_x -= self.filter_center * self.data_width / sample_rate
|
||||
if conf.mouse_tune_method: # Mouse motion changes the VFO frequency
|
||||
if False: #conf.mouse_tune_method: # Mouse motion changes the VFO frequency
|
||||
x = (mouse_x - self.mouse_x) # Thanks to VK6JBL
|
||||
self.mouse_x = mouse_x
|
||||
freq = float(x) * sample_rate / self.data_width
|
||||
@@ -2224,6 +2248,44 @@ class GraphScreen(wx.Window):
|
||||
self.ChangeHwFrequency(self.txFreq, self.VFO, 'MouseMotion', event=event, rx_freq=freq2)
|
||||
else: # Mouse motion changes the transmit frequency
|
||||
self.ChangeHwFrequency(self.txFreq + freq, self.VFO, 'MouseMotion', event=event)
|
||||
else:
|
||||
mouse_x, mouse_y = self.GetMousePosition(event)
|
||||
if not self.in_splitter and self.originY <= mouse_y <= self.originY + self.tick and (
|
||||
self.originX <= mouse_x <= self.originX + self.graph_width):
|
||||
#sample_rate = int(self.sample_rate * self.zoom) # Measure the frequency
|
||||
#freq = float(mouse_x - self.x0) * sample_rate / self.data_width + self.zoom_deltaf + self.VFO
|
||||
#freq = int(freq)
|
||||
#color = None
|
||||
#for start_freq, start_color in application.BandPlan:
|
||||
# if start_freq >= freq:
|
||||
# break
|
||||
# color = start_color
|
||||
dc = wx.ClientDC(self) # Read the pixel at the mouse position
|
||||
pixel = dc.GetPixel(mouse_x, mouse_y)
|
||||
pixel = "#%02X%02X%02X" % (pixel[0], pixel[1], pixel[2])
|
||||
txt = application.BandPlanC2T.get(pixel, '')
|
||||
if pixel == "#000000":
|
||||
pass
|
||||
elif txt:
|
||||
self.bandplanInfo.Clear()
|
||||
self.bandplanInfo.write(txt)
|
||||
width, height = self.bandplanInfo.GetTextExtent(txt)
|
||||
width += self.bandplanInfo.GetCharWidth() * 2
|
||||
height += self.bandplanInfo.GetCharHeight() // 2
|
||||
self.bandplanInfo.SetSize(wx.Size(width, height))
|
||||
self.bandplanWindow.SetClientSize((width, height))
|
||||
rect = self.GetScreenRect()
|
||||
if mouse_x > self.originX + self.graph_width * 3 // 4:
|
||||
self.bandplanWindow.Move(mouse_x + rect.GetX() - width, mouse_y + rect.GetY() - height * 12 // 10)
|
||||
else:
|
||||
self.bandplanWindow.Move(mouse_x + rect.GetX(), mouse_y + rect.GetY() - height * 12 // 10)
|
||||
if not self.bandplanWindow.IsShown():
|
||||
self.bandplanWindow.Show()
|
||||
else:
|
||||
if self.bandplanWindow.IsShown():
|
||||
self.bandplanWindow.Hide()
|
||||
elif self.bandplanWindow.IsShown():
|
||||
self.bandplanWindow.Hide()
|
||||
def OnWheel(self, event):
|
||||
if conf.freq_spacing:
|
||||
wm = conf.freq_spacing
|
||||
@@ -2474,12 +2536,10 @@ class WaterfallDisplay(wx.Window):
|
||||
self.top_key = 8
|
||||
self.top_size = (self.top_key + 2) * (self.top_key - 1) // 2
|
||||
# Make the palette
|
||||
if conf.waterfall_palette == 'B':
|
||||
pal2 = conf.waterfallPaletteB
|
||||
elif conf.waterfall_palette == 'C':
|
||||
pal2 = conf.waterfallPaletteC
|
||||
else:
|
||||
if conf.waterfall_palette == 'A':
|
||||
pal2 = conf.waterfallPalette
|
||||
else:
|
||||
pal2 = getattr(conf, "waterfallPalette" + conf.waterfall_palette)
|
||||
red = bytearray(256)
|
||||
green = bytearray(256)
|
||||
blue = bytearray(256)
|
||||
@@ -2573,7 +2633,7 @@ class WaterfallScreen(wx.SplitterWindow):
|
||||
self.y_zero = conf.waterfall_y_zero
|
||||
self.zoom_control = 0
|
||||
wx.SplitterWindow.__init__(self, frame)
|
||||
self.SetSizeHints(width, -1, width)
|
||||
self.SetSizeHints(width, -1)
|
||||
self.SetSashGravity(0.50)
|
||||
self.SetMinimumPaneSize(1)
|
||||
self.SetSize((width, conf.waterfall_graph_size + 100)) # be able to set sash size
|
||||
@@ -2927,7 +2987,7 @@ class MultiReceiverScreen(wx.SplitterWindow):
|
||||
self.rx_zero = self.graph
|
||||
self.Initialize(self.rx_zero)
|
||||
self.waterfall.Hide()
|
||||
self.SetSizeHints(self.width, -1, self.width)
|
||||
self.SetSizeHints(self.width, -1)
|
||||
# Calculate control width
|
||||
rx_btn = QuiskPushbutton(self, None, "Rx 8....", style=wx.BU_EXACTFIT)
|
||||
self.rx_btn_width, self.rx_btn_height = rx_btn.GetSize().Get()
|
||||
@@ -3460,6 +3520,7 @@ class App(wx.App):
|
||||
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 = []
|
||||
@@ -3497,6 +3558,8 @@ class App(wx.App):
|
||||
self.midi_message = []
|
||||
self.idName2Button = {}
|
||||
self.midi_handler = None
|
||||
self.tx_inhibit = 0
|
||||
self.old_tx_inhibit = 0
|
||||
if conf.use_rx_udp == 10: # Hermes UDP protocol
|
||||
self.bandscope_clock = conf.rx_udp_clock
|
||||
else:
|
||||
@@ -3548,6 +3611,7 @@ class App(wx.App):
|
||||
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
|
||||
@@ -3557,12 +3621,13 @@ class App(wx.App):
|
||||
self.smeter_avg_seconds = 1.0 # seconds for S-meter average
|
||||
self.smeter_sunits = -87.0
|
||||
self.smeter_usage = "smeter" # specify use of s-meter display
|
||||
self.hamlib_strength = 0.0;
|
||||
self.timer = time.time() # A seconds clock
|
||||
self.heart_time0 = self.timer # timer to call HeartBeat at intervals
|
||||
self.save_time0 = self.timer
|
||||
self.smeter_db_time0 = self.timer
|
||||
self.smeter_sunits_time0 = self.timer
|
||||
self.fewsec_time0 = self.timer
|
||||
self.slowheart_time0 = self.timer
|
||||
self.multi_rx_index = 0
|
||||
self.multi_rx_timer = self.timer
|
||||
self.band_up_down = 0 # Are band Up/Down buttons in use?
|
||||
@@ -3718,6 +3783,7 @@ class App(wx.App):
|
||||
pass #traceback.print_exc()
|
||||
if "Version" not in self.bandAmplPhase:
|
||||
self.FixAmplPhase() # Convert to new format Oct 2020
|
||||
self.FixAmplPhase2() # New logic June 2024
|
||||
if Hardware.VarDecimGetChoices(): # Hardware can change the decimation.
|
||||
self.sample_rate = Hardware.VarDecimSet() # Get the sample rate.
|
||||
self.vardecim_set = self.sample_rate
|
||||
@@ -3756,16 +3822,16 @@ class App(wx.App):
|
||||
self.std_out_err.Show(False)
|
||||
else:
|
||||
self.std_out_err.Show(True)
|
||||
#w, h = frame.GetSize().Get()
|
||||
#ww, hh = frame.GetClientSizeTuple()
|
||||
#print ('Main frame: size', w, h, 'client', ww, hh)
|
||||
wClient, hClient = self.main_frame.GetClientSize()
|
||||
wFrame, hFrame = self.main_frame.GetSize()
|
||||
main_border_w = wFrame - wClient
|
||||
#print ('Main frame: size', wFrame, hFrame, 'client', wClient, hClient, 'border', main_border_w)
|
||||
# Find the data width from a list of preferred sizes; it is the width of returned graph data.
|
||||
# The graph_width is the width of data_width that is displayed.
|
||||
# The total width of the graph is graph_width + self.graph_borders
|
||||
if conf.window_width > 0:
|
||||
#wFrame, h = frame.GetClientSize().Get() # client window width
|
||||
wFrame = conf.window_width - 15 # Thanks to Nick Abramenko, RA3PKJ
|
||||
graph = GraphScreen(frame, self.width//2, self.width//2, None) # make a GraphScreen to calculate borders
|
||||
self.graph_width = wFrame - (graph.width - graph.graph_width) # less graph borders equals actual graph_width
|
||||
self.graph_width = wClient - (graph.width - graph.graph_width) # less graph borders equals actual graph_width
|
||||
graph.Destroy()
|
||||
del graph
|
||||
if self.graph_width % 2 == 1: # Both data_width and graph_width are even numbers
|
||||
@@ -3890,14 +3956,14 @@ class App(wx.App):
|
||||
frame.SetSizer(vertBox)
|
||||
# Add the screens
|
||||
vertBox.Add(self.config_screen, 1, wx.EXPAND)
|
||||
vertBox.Add(self.multi_rx_screen, 1)
|
||||
vertBox.Add(self.scope, 1)
|
||||
vertBox.Add(self.bandscope_screen, 1)
|
||||
vertBox.Add(self.filter_screen, 1)
|
||||
vertBox.Add(self.multi_rx_screen, 1, wx.EXPAND)
|
||||
vertBox.Add(self.scope, 1, wx.EXPAND)
|
||||
vertBox.Add(self.bandscope_screen, 1, wx.EXPAND)
|
||||
vertBox.Add(self.filter_screen, 1, wx.EXPAND)
|
||||
if self.rate_audio_fft:
|
||||
vertBox.Add(self.audio_fft_screen, 1)
|
||||
vertBox.Add(self.help_screen, 1)
|
||||
vertBox.Add(self.station_screen)
|
||||
vertBox.Add(self.audio_fft_screen, 1, wx.EXPAND)
|
||||
vertBox.Add(self.help_screen, 1, wx.EXPAND)
|
||||
vertBox.Add(self.station_screen, 0, wx.EXPAND)
|
||||
# Add the spacer
|
||||
vertBox.Add(Spacer(frame), 0, wx.EXPAND)
|
||||
# Add the sizer for the controls
|
||||
@@ -3910,13 +3976,16 @@ class App(wx.App):
|
||||
vertBox.AddSpacer(5) # Thanks to Christof, DJ4CM
|
||||
# End of vertical box.
|
||||
self.MakeButtons(frame, gbs)
|
||||
minw = width = self.graph.width
|
||||
maxw = maxh = -1
|
||||
minh = 100
|
||||
if conf.window_width > 0:
|
||||
minw = width = maxw = conf.window_width
|
||||
minw = maxw = conf.window_width
|
||||
else:
|
||||
minw = self.graph.width + main_border_w
|
||||
maxw = -1
|
||||
if conf.window_height > 0:
|
||||
minh = maxh = self.height = conf.window_height
|
||||
else:
|
||||
minh = 100
|
||||
maxh = -1
|
||||
self.main_frame.SetSizeHints(minw, minh, maxw, maxh)
|
||||
self.main_frame.SetClientSize(wx.Size(width, self.height))
|
||||
if hasattr(Hardware, 'pre_open'): # pre_open() is called before open()
|
||||
@@ -3958,7 +4027,6 @@ class App(wx.App):
|
||||
if conf.dxClHost:
|
||||
# create DX Cluster and register listener for change notification
|
||||
self.dxCluster = dxcluster.DxCluster()
|
||||
self.dxCluster.setListener(self.OnDxClChange)
|
||||
self.dxCluster.start()
|
||||
# Create shortcut keys for buttons
|
||||
if conf.button_layout == 'Large screen':
|
||||
@@ -4309,8 +4377,6 @@ class App(wx.App):
|
||||
conf.tx_ip, conf.tx_audio_port,
|
||||
conf.mic_sample_rate, conf.mic_channel_I, conf.mic_channel_Q,
|
||||
0.7, conf.mic_playback_rate)
|
||||
def OnDxClChange(self):
|
||||
self.station_screen.Refresh()
|
||||
def OnIdle(self, event):
|
||||
if self.screen:
|
||||
self.screen.OnIdle(event)
|
||||
@@ -4384,6 +4450,25 @@ class App(wx.App):
|
||||
except:
|
||||
traceback.print_exc()
|
||||
self.bandAmplPhase[band] = {}
|
||||
def FixAmplPhase2(self): # New definition of phase
|
||||
if self.bandAmplPhase["Version"]["rx"] == [1]:
|
||||
return
|
||||
degrad = 360.0 / 2 / math.pi
|
||||
for band in self.bandAmplPhase:
|
||||
if band == "Version":
|
||||
continue
|
||||
for rx_tx in self.bandAmplPhase[band]:
|
||||
if rx_tx in ('rx', 'tx'):
|
||||
data = self.bandAmplPhase[band][rx_tx]
|
||||
for item in data:
|
||||
vfo = item[0]
|
||||
lst_framph = item[1]
|
||||
for framph in lst_framph:
|
||||
freq, am, ph = framph
|
||||
p = math.atan(math.tan(ph / degrad) / (1.0 + am))
|
||||
#print ("%5s %3s %8d %8d %8.4f %8.3f %8.3f" % (band, rx_tx, vfo, freq, am, ph, p * degrad))
|
||||
framph[2] = p * degrad
|
||||
self.bandAmplPhase["Version"]["rx"] = [1]
|
||||
def ImmediateChange(self, name):
|
||||
if name == "pulse_audio_verbose_output":
|
||||
value = getattr(conf, name)
|
||||
@@ -4622,7 +4707,7 @@ class App(wx.App):
|
||||
b.char_shortcut = 'l'
|
||||
self.MakeAccel(b)
|
||||
self.splitButton = WrapMenu(b, self.split_menu)
|
||||
if conf.mouse_tune_method: # Mouse motion changes the VFO frequency
|
||||
if False: #conf.mouse_tune_method: # Mouse motion changes the VFO frequency
|
||||
self.splitButton.Enable(False)
|
||||
left_row3.append(self.splitButton)
|
||||
b = QuiskCheckbutton(frame, self.OnBtnFDX, 'FDX', color=conf.color_test)
|
||||
@@ -4832,7 +4917,8 @@ class App(wx.App):
|
||||
self.freqDisplay.Display(self.txFreq + self.VFO)
|
||||
# On/Off button
|
||||
if conf.button_layout == 'Large screen':
|
||||
b_onoff = QuiskCheckbutton(frame, self.OnBtnOnOff, "On", color='#77DD77')
|
||||
b_onoff = QuiskCheckbutton(frame, self.OnBtnOnOff, "On", color=conf.color_onoff)
|
||||
b_onoff.text_color = conf.color_onoff_text
|
||||
b_onoff.SetValue(True, do_cmd=False)
|
||||
h = b_freqdisp.height
|
||||
b_onoff.SetSizeHints(h, h, h, h)
|
||||
@@ -5035,6 +5121,7 @@ class App(wx.App):
|
||||
self.smeter_sunits_time0 = self.timer
|
||||
s = self.smeter_sunits / 6.0 # change to S units; 6db per S unit
|
||||
s += Hardware.correct_smeter # S-meter correction for the gain, band, etc.
|
||||
self.hamlib_strength = (s - 9.0) * 6.0 # convert to dB; 0 dB is S9
|
||||
if s < 0:
|
||||
s = 0
|
||||
if s >= 9.5:
|
||||
@@ -5787,16 +5874,31 @@ class App(wx.App):
|
||||
The hardware will reply with the updated frequencies which may be different
|
||||
from those requested; use and display the returned tune and vfo.
|
||||
"""
|
||||
#print ("ChangeHW", source, tune, vfo, vfo + tune)
|
||||
if not self.split_rxtx:
|
||||
self.rxFreq = tune # rxFreq must be correct before the call to Hardware.ChangeFrequency()
|
||||
elif rx_freq is not None:
|
||||
self.rxFreq = rx_freq
|
||||
rx_offset = self.rxFreq - tune
|
||||
if self.screen == self.bandscope_screen:
|
||||
freq = vfo + tune
|
||||
tune = freq % 10000
|
||||
vfo = freq - tune
|
||||
tune, vfo = Hardware.ChangeFrequency(vfo + tune, vfo, source, band, event)
|
||||
self.ChangeDisplayFrequency(tune - vfo, vfo, rx_freq is not None)
|
||||
tune, vfo = Hardware.ChangeFrequency(vfo + tune, vfo, source, band, event)
|
||||
self.ChangeDisplayFrequency(tune - vfo, vfo, rx_freq is not None)
|
||||
elif conf.fixed_tune_offset:
|
||||
# Tune with the VFO and keep a constant audio offset from the center. Tx tune is always conf.fixed_tune_offset.
|
||||
tune_freq = vfo + tune
|
||||
self.rxFreq = conf.fixed_tune_offset + rx_offset
|
||||
if source == "BtnUpDown":
|
||||
tune_freq = vfo + conf.fixed_tune_offset
|
||||
else:
|
||||
vfo = tune_freq - conf.fixed_tune_offset
|
||||
tune_freq, vfo = Hardware.ChangeFrequency(tune_freq, vfo, source, band, event)
|
||||
self.ChangeDisplayFrequency(tune_freq - vfo, vfo, True)
|
||||
else:
|
||||
tune, vfo = Hardware.ChangeFrequency(vfo + tune, vfo, source, band, event)
|
||||
self.ChangeDisplayFrequency(tune - vfo, vfo, rx_freq is not None)
|
||||
def ChangeDisplayFrequency(self, tune, vfo, new_rxfreq=False):
|
||||
'Change the frequency displayed by Quisk'
|
||||
change = 0
|
||||
@@ -5816,10 +5918,8 @@ class App(wx.App):
|
||||
self.graph.SetVFO(vfo)
|
||||
self.waterfall.SetVFO(vfo)
|
||||
self.station_screen.Refresh()
|
||||
if self.w_phase:
|
||||
self.w_phase.Redraw()
|
||||
if change:
|
||||
if conf.name_of_sound_capt or conf.name_of_mic_play:
|
||||
if (conf.name_of_sound_capt or conf.name_of_mic_play) and QS.get_params("softrock_correct_active") == 0:
|
||||
ampl, phase = self.GetAmplPhase('rx')
|
||||
QS.set_ampl_phase(ampl, phase, 0)
|
||||
ampl, phase = self.GetAmplPhase('tx')
|
||||
@@ -6295,7 +6395,7 @@ class App(wx.App):
|
||||
for client in self.hamlib_clients: # Service existing clients
|
||||
if not client.Process(): # False return indicates a closed connection; remove the handler for this client
|
||||
self.hamlib_clients.remove(client)
|
||||
# print 'Remove', client.address
|
||||
# print ('Remove', client.address)
|
||||
break
|
||||
def OnKeyHook(self, event):
|
||||
event.Skip()
|
||||
@@ -6351,6 +6451,8 @@ class App(wx.App):
|
||||
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
|
||||
@@ -6370,7 +6472,7 @@ class App(wx.App):
|
||||
Hardware.RepeaterOffset(0)
|
||||
QS.set_ctcss(0)
|
||||
QS.tx_hold_state(1)
|
||||
if QS.is_key_down(): # Tx indicator
|
||||
if QS.is_key_down() and not self.tx_inhibit: # Tx indicator
|
||||
if not self.tx_indicator:
|
||||
self.tx_indicator = True
|
||||
self.pttButton.Tx.TurnOn(True)
|
||||
@@ -6431,6 +6533,8 @@ class App(wx.App):
|
||||
self.hot_key_ptt_active = False
|
||||
self.hot_key_ptt_was_down = self.hot_key_ptt_is_down
|
||||
self.hot_key_ptt_pressed = False
|
||||
if self.tx_inhibit:
|
||||
ptt = False
|
||||
if ptt is True and not ptt_button_down:
|
||||
self.SetPTT(True)
|
||||
elif ptt is False and ptt_button_down:
|
||||
@@ -6501,6 +6605,16 @@ class App(wx.App):
|
||||
if self.timer - self.heart_time0 > 0.10: # call hardware to perform background tasks:
|
||||
self.heart_time0 = self.timer
|
||||
Hardware.HeartBeat()
|
||||
if conf.hermes_lite2_enable:
|
||||
self.tx_inhibit = QS.get_params('quisk_tx_inhibit')
|
||||
else:
|
||||
self.tx_inhibit = 0
|
||||
if self.tx_inhibit != self.old_tx_inhibit:
|
||||
self.old_tx_inhibit = self.tx_inhibit
|
||||
self.graph.display.Refresh()
|
||||
self.waterfall.pane1.display.Refresh()
|
||||
if self.tx_inhibit and self.spotButton.GetValue():
|
||||
self.spotButton.SetValue(0, True)
|
||||
msg = QS.GetQuiskPrintf()
|
||||
if msg:
|
||||
print(msg, end='')
|
||||
@@ -6519,9 +6633,13 @@ class App(wx.App):
|
||||
self.ChangeDisplayFrequency(tune - vfo, vfo)
|
||||
self.FldigiPoll()
|
||||
self.HamlibPoll()
|
||||
#if self.timer - self.fewsec_time0 > 3.0:
|
||||
# self.fewsec_time0 = self.timer
|
||||
# print ('fewswc')
|
||||
if self.dxCluster:
|
||||
if self.dxCluster.Poll():
|
||||
self.station_screen.Refresh()
|
||||
if self.timer - self.slowheart_time0 > 0.5:
|
||||
self.slowheart_time0 = self.timer
|
||||
if self.w_phase:
|
||||
self.w_phase.SlowHeartBeat()
|
||||
if self.timer - self.save_time0 > 20.0:
|
||||
self.save_time0 = self.timer
|
||||
if self.CheckState():
|
||||
|
||||
+131
-4
@@ -473,6 +473,13 @@ hermes_iob_rxin = 'J10 available'
|
||||
#hermes_iob_rxin = 'HL2 Rx to J9'
|
||||
#hermes_iob_rxin = 'Use J9 and J10'
|
||||
|
||||
## hermes_lite2_enable Hermes Lite2 protocol, boolean
|
||||
# This turns on some of the protocol extensions for the Hermes Lite2 that are not part
|
||||
# of the official Hermes Protocol 1. Currently this only enables Tx Inhibit (CN8).
|
||||
# Changes are immediate (no need to restart).
|
||||
hermes_lite2_enable = True
|
||||
#hermes_lite2_enable = False
|
||||
|
||||
|
||||
# These are known power meter calibration tables. This table is not present in the JSON settings file.
|
||||
power_meter_std_calibrations = {}
|
||||
@@ -1077,7 +1084,15 @@ digital_rx1_name = ""
|
||||
## digital_output_level Digital output level, number
|
||||
# This is the volume control 0.0 to 1.0 for digital playback to fldigi, etc.
|
||||
# Changes are immediate (no need to restart).
|
||||
digital_output_level = 0.7
|
||||
digital_output_level = 0.700
|
||||
|
||||
## file_play_level File play level, number
|
||||
# Use this to reduce the volume when playing files. For example, if the volume of the CQ
|
||||
# message is too loud, reduce the level relative to radio sound.
|
||||
# Changes are immediate (no need to restart).
|
||||
file_play_level = 1.000
|
||||
#file_play_level = 0.500
|
||||
#file_play_level = 0.100
|
||||
|
||||
# Sound card names:
|
||||
#
|
||||
@@ -1272,6 +1287,18 @@ dc_remove_bw = 100
|
||||
#dc_remove_bw = 200
|
||||
#dc_remove_bw = 400
|
||||
|
||||
## fixed_tune_offset Fixed tune offset, integer
|
||||
# If this is zero, Quisk tunes as usual. The hardware frequency (the VFO or center frequency)
|
||||
# is fixed and Quisk tunes
|
||||
# within the spectrum returned by the hardware. Otherwise enter a fixed offset between the
|
||||
# center frequency and the tuning frequency. Then tuning is done by the hardware.
|
||||
# This is useful with Softrock hardware as
|
||||
# it simplifies the corrections for amplitude and phase imbalance.
|
||||
# Changes are immediate (no need to restart).
|
||||
fixed_tune_offset = 0
|
||||
#fixed_tune_offset = 5000
|
||||
#fixed_tune_offset = 10000
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1901,6 +1928,8 @@ btn_text_switch = u"\u21C4" # Character to switch left-right
|
||||
color_scheme = 'A'
|
||||
#color_scheme = 'B'
|
||||
#color_scheme = 'C'
|
||||
#color_scheme = 'DK1MI_GR'
|
||||
#color_scheme = 'DK1MI_AM'
|
||||
|
||||
## waterfall_palette Waterfall colors, text choice
|
||||
# This controls the colors used in the waterfall. The default color scheme is A, and you can change this scheme
|
||||
@@ -1908,6 +1937,7 @@ color_scheme = 'A'
|
||||
waterfall_palette = 'A'
|
||||
#waterfall_palette = 'B'
|
||||
#waterfall_palette = 'C'
|
||||
#waterfall_palette = 'DK1MI_AM'
|
||||
|
||||
|
||||
|
||||
@@ -1942,6 +1972,8 @@ color_txline = 'red' # vertical line color for tx in graph
|
||||
color_rxline = 'green' # vertical line color for rx in graph
|
||||
color_graph_msg_fg = 'black' # text messages on the graph screen
|
||||
color_graph_msg_bg = 'lemonchiffon2' # background of text messages on the graph screen
|
||||
color_onoff = '#77DD77' # on/off power button
|
||||
color_onoff_text = 'black' # on/off power button text
|
||||
|
||||
# This color scheme B, a dark color scheme designed by Steve Murphy, KB8RWQ.
|
||||
# Additional colors added by N2ADR.
|
||||
@@ -1971,6 +2003,8 @@ color_scheme_B = {
|
||||
'color_rxline' : 'green',
|
||||
'color_graph_msg_fg' : 'white',
|
||||
'color_graph_msg_bg' : '#111111',
|
||||
'color_onoff' : '#77DD77',
|
||||
'color_onoff_text' : 'black',
|
||||
}
|
||||
|
||||
# This is color scheme C:
|
||||
@@ -2008,12 +2042,73 @@ color_scheme_C = {
|
||||
'color_rxline' : '#3CC918',
|
||||
'color_graph_msg_fg' : '#000000',
|
||||
'color_graph_msg_bg' : 'lemonchiffon2',
|
||||
'color_onoff' : '#77DD77',
|
||||
'color_onoff_text' : 'black',
|
||||
}
|
||||
#############################################################################################
|
||||
# This is a green dark color scheme designed by Michael
|
||||
color_scheme_DK1MI_GR = {
|
||||
'color_bg' : '#0F0F0F', # Lower screen background
|
||||
'color_bg_txt' : '#00CC00', # Lower screen text color
|
||||
'color_graph' : '#0F0F0F', # Graph background
|
||||
'color_config2' : '#008000', # color in tab row of config screen
|
||||
'color_gl' : '#2F4F4F', # Lines on the graph
|
||||
'color_graphticks' : '#CCCCCC', # Graph ticks
|
||||
'color_graphline' : '#00FF00', # graph data line color
|
||||
'color_graphlabels' : '#00FF00', # graph label color
|
||||
'color_btn' : '#141414', # button color
|
||||
'color_check_btn' : '#005500', # color of a check button when it is checked
|
||||
'color_cycle_btn' : '#005500', # color of a cycle button when it is checked
|
||||
'color_adjust_btn' : '#005500', # color of an adjustable button when it is checked
|
||||
'color_test' : '#005500', # color of a button used for test (turn off for tx)
|
||||
'color_freq' : '#208B57', # background color of frequency and s-meter
|
||||
'color_freq_txt' : '#00FF00', # text color of frequency display
|
||||
'color_entry' : '#2E2E2E', # frequency entry box
|
||||
'color_entry_txt' : '#00FF00', # text color of entry box
|
||||
'color_enable' : '#00CC00', # text color for an enabled button
|
||||
'color_disable' : '#FF0000', # text color for a disabled button
|
||||
'color_popchoice' : '#555555', # text color for button that pops up a row of buttons
|
||||
'color_bandwidth' : '#003300', # color for bandwidth display; thanks to WB4JFI
|
||||
'color_txline' : '#00CC00', # vertical line color for tx in graph
|
||||
'color_rxline' : '#00FF00', # vertical line color for rx in graph
|
||||
'color_graph_msg_fg' : '#008800', # text messages on the graph screen
|
||||
'color_graph_msg_bg' : '#1E1E1E', # background of text messages on the graph screen
|
||||
'color_onoff' : '#005500', # On/Off button
|
||||
'color_onoff_text' : '#FF0000', # On/Off text
|
||||
}
|
||||
#############################################################################################
|
||||
# This is an amber dark color scheme designed by Michael
|
||||
color_scheme_DK1MI_AM = {
|
||||
'color_bg' : '#0F0F0F', # Lower screen background
|
||||
'color_bg_txt' : '#FFBF00', # Lower screen text color
|
||||
'color_graph' : '#0F0F0F', # Graph background
|
||||
'color_config2' : '#FF8000', # Color in tab row of config screen
|
||||
'color_gl' : '#2F4F4F', # Lines on the graph
|
||||
'color_graphticks' : '#CCCCCC', # Graph ticks
|
||||
'color_graphline' : '#FFBF00', # Graph data line color
|
||||
'color_graphlabels' : '#FFBF00', # Graph label color
|
||||
'color_btn' : '#141414', # Button color
|
||||
'color_check_btn' : '#865E2E', # Color of a check button when it is checked
|
||||
'color_cycle_btn' : '#865E2E', # Color of a cycle button when it is checked
|
||||
'color_adjust_btn' : '#865E2E', # Color of an adjustable button when it is checked
|
||||
'color_test' : '#865E2E', # Color of a button used for test (turn off for tx)
|
||||
'color_freq' : '#FF9933', # Background color of frequency and s-meter
|
||||
'color_freq_txt' : '#000000', # Text color of frequency display
|
||||
'color_entry' : '#2E2E2E', # Frequency entry box
|
||||
'color_entry_txt' : '#FFBF00', # Text color of entry box
|
||||
'color_enable' : '#FFBF00', # Text color for an enabled button
|
||||
'color_disable' : '#FF0000', # Text color for a disabled button
|
||||
'color_popchoice' : '#555555', # Text color for button that pops up a row of buttons
|
||||
'color_bandwidth' : '#4B2E0F', # Color for bandwidth display
|
||||
'color_txline' : '#FFBF00', # Vertical line color for tx in graph
|
||||
'color_rxline' : '#FF8000', # Vertical line color for rx in graph
|
||||
'color_graph_msg_fg' : '#FF8000', # Text messages on the graph screen
|
||||
'color_graph_msg_bg' : '#1E1E1E', # Background of text messages on the graph screen
|
||||
'color_onoff' : '#865E2E', # On/Off button
|
||||
'color_onoff_text' : '#FF0000', # On/Off text
|
||||
}
|
||||
|
||||
|
||||
# These are the palettes for the waterfall. The one used is named waterfallPallette,
|
||||
# so to use a different one, overwrite this name in your configuration file.
|
||||
# These are the palettes for the waterfall.
|
||||
waterfallPalette = (
|
||||
( 0, 0, 0, 0),
|
||||
( 36, 85, 0, 255),
|
||||
@@ -2071,6 +2166,18 @@ waterfallPaletteC = ( # from David Fainitski
|
||||
(255, 245, 99, 3)
|
||||
)
|
||||
|
||||
waterfallPaletteDK1MI_AM = ( # from Michael
|
||||
(0, 0, 0, 0),
|
||||
(32, 25, 20, 0),
|
||||
(64, 58, 40, 6),
|
||||
(96, 78, 50, 16),
|
||||
(128, 120, 85, 29),
|
||||
(160, 144, 100, 51),
|
||||
(192, 195, 140, 43),
|
||||
(224, 198, 150, 35),
|
||||
(255, 255, 191, 0)
|
||||
)
|
||||
|
||||
# This is the data used to draw colored lines on the frequency X axis to
|
||||
# indicate CW and Phone sub-bands. You can make it anything you want.
|
||||
# These are the colors used for sub-bands:
|
||||
@@ -2096,6 +2203,26 @@ RxOnly = '#AAAAAA'
|
||||
# Colors start at the indicated frequency and continue until the
|
||||
# next frequency. The special color "None" turns off color.
|
||||
#
|
||||
BandPlanColors = [ # Display name and corresponding color
|
||||
['CW, General', CW],
|
||||
['CW, Extra', eCW],
|
||||
['Phone, General', Phone],
|
||||
['Phone, Extra', ePhone],
|
||||
['AM', AM],
|
||||
['Data', Data],
|
||||
['DxData', DxData],
|
||||
['RTTY', RTTY],
|
||||
['SSTV', SSTV],
|
||||
['Packet', Packet],
|
||||
['Beacons', Beacons],
|
||||
['Satellite', Satellite],
|
||||
['Repeater out', Repeater],
|
||||
['Repeater in', RepInput],
|
||||
['Simplex', Simplex],
|
||||
['Rx only', RxOnly],
|
||||
['Special', Special],
|
||||
['Other', Other]
|
||||
]
|
||||
|
||||
|
||||
|
||||
|
||||
+2
-1
@@ -29,9 +29,10 @@ class Hardware(BaseHardware):
|
||||
# self.hamlib_rigctld_port = 4532 # Standard rigctld control port
|
||||
# self.hamlib_poll_seconds = 0.2 # Time interval to poll for changes
|
||||
def open(self):
|
||||
# Thanks to Peter, DC6AR, Rig ID changed from 229 to 2045.
|
||||
ret = BaseHardware.open(self)
|
||||
if not self.hamlib_connected: # rigctld is not started. Try to start it.
|
||||
os.system("rigctld -m 229 -r /dev/ttyUSB0 -s 4800 & ") # Check the baud rate menu setting
|
||||
os.system("rigctld -m 2045 -r /dev/ttyUSB0 -s 4800 & ") # Check the baud rate menu setting
|
||||
# If this fails, start rigctld by hand.
|
||||
return ret
|
||||
|
||||
|
||||
@@ -120,6 +120,8 @@ class Hardware:
|
||||
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
|
||||
|
||||
@@ -7,7 +7,7 @@ import os
|
||||
# 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.30'
|
||||
Version = '4.2.41'
|
||||
|
||||
fp = open("__init__.py", "w") # write title string
|
||||
fp.write("#Quisk version %s\n" % Version)
|
||||
@@ -39,8 +39,10 @@ if sys.platform == "darwin": # Build for Macintosh
|
||||
libraries = ['portaudio', 'fftw3', 'm']
|
||||
if os.path.isdir('/opt/local/include'): # MacPorts
|
||||
base_dir = '/opt/local'
|
||||
elif os.path.isdir('/usr/local/include'): # HomeBrew
|
||||
elif os.path.isdir('/usr/local/include'): # HomeBrew on macOS Intel
|
||||
base_dir = '/usr/local'
|
||||
elif os.path.isdir('/opt/homebrew/include'): # HomeBrew on Apple Silicon
|
||||
base_dir = '/opt/homebrew'
|
||||
else: # Regular build?
|
||||
base_dir = '/usr'
|
||||
if os.path.isfile(base_dir + "/include/pulse/pulseaudio.h"):
|
||||
@@ -83,7 +85,7 @@ N1MM+ and software that uses Hamlib.
|
||||
url = 'http://james.ahlstrom.name/quisk/',
|
||||
packages = ['quisk', 'quisk.n2adr', 'quisk.softrock', 'quisk.freedvpkg',
|
||||
'quisk.hermes', 'quisk.hiqsdr', 'quisk.afedrinet', 'quisk.soapypkg',
|
||||
'quisk.sdrmicronpkg', 'quisk.perseuspkg', 'quisk.ac2yd'],
|
||||
'quisk.sdrmicronpkg', 'quisk.perseuspkg', 'quisk.ac2yd', 'quisk.multuspkg'],
|
||||
package_dir = {'quisk' : '.'},
|
||||
package_data = {'' : ['*.txt', '*.html', '*.so', '*.dll']},
|
||||
entry_points = {'gui_scripts' : ['quisk = quisk.quisk:main', 'quisk_vna = quisk.quisk_vna:main']},
|
||||
|
||||
@@ -178,6 +178,8 @@ class Hardware(BaseHardware):
|
||||
vfo = self.vfo + int(offset * 1000) # Convert kHz to Hz
|
||||
self.ChangeFrequency(vfo, vfo, 'repeater')
|
||||
return False
|
||||
def ImmediateChange(self, name):
|
||||
return
|
||||
def OnSpot(self, level):
|
||||
pass
|
||||
def HeartBeat(self): # Called at about 10 Hz by the main
|
||||
|
||||
@@ -85,8 +85,10 @@ char * sound_format_names[4] = {"Int32", "Int16", "Float32", "Int24"} ;
|
||||
static struct wav_file file_rec_audio, file_rec_samples, file_rec_mic;
|
||||
static int close_file_rec;
|
||||
|
||||
static double digital_output_level = 0.7;
|
||||
double digital_output_level = 0.7;
|
||||
static double file_play_level = 1.0;
|
||||
static int dc_remove_bw=100; // bandwidth of DC removal filter
|
||||
static int multus_cw_samples = 0; // always send CW Tx samples to the Multus radio, even in Rx
|
||||
|
||||
static ty_sample_start pt_sample_start;
|
||||
static ty_sample_stop pt_sample_stop;
|
||||
@@ -175,9 +177,10 @@ static void correct_sample (struct sound_dev * dev, complex double * cSamples, i
|
||||
for (i = 0; i < nSamples; i++) {
|
||||
re = creal(cSamples[i]);
|
||||
im = cimag(cSamples[i]);
|
||||
re = re * dev->AmPhAAAA;
|
||||
im = re * dev->AmPhCCCC + im * dev->AmPhDDDD;
|
||||
cSamples[i] = re + I * im;
|
||||
cSamples[i] = re * dev->AmPhAAAA + I * (re * dev->AmPhCCCC + im * dev->AmPhDDDD);
|
||||
//re = re * dev->AmPhAAAA;
|
||||
//im = re * dev->AmPhCCCC + im * dev->AmPhDDDD;
|
||||
//cSamples[i] = re + I * im;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -730,8 +733,11 @@ void * quisk_make_txIQ(struct sound_dev * dev, int rewind)
|
||||
}
|
||||
// amplitude and phase corrections
|
||||
if (dev->doAmplPhase) {
|
||||
dSamp0 = dSamp0 * dev->AmPhAAAA;
|
||||
dSamp1 = dSamp0 * dev->AmPhCCCC + dSamp1 * dev->AmPhDDDD;
|
||||
//dSamp0 = dSamp0 * dev->AmPhAAAA;
|
||||
//dSamp1 = dSamp0 * dev->AmPhCCCC + dSamp1 * dev->AmPhDDDD;
|
||||
d = dSamp0;
|
||||
dSamp0 = d * dev->AmPhAAAA;
|
||||
dSamp1 = d * dev->AmPhCCCC + dSamp1 * dev->AmPhDDDD;
|
||||
}
|
||||
switch (dev->sound_format) {
|
||||
case Int16:
|
||||
@@ -836,6 +842,34 @@ int quisk_play_sidetone(struct sound_dev * dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void testing(double complex * cSamples, int nSamples)
|
||||
{
|
||||
int i;
|
||||
static double AvgR=0, AvgQ=0, AvgRQ=0;
|
||||
double d, p, Gain, Phase;
|
||||
time_t tim;
|
||||
static time_t time0;
|
||||
|
||||
for (i = 0; i < nSamples; i++) {
|
||||
d = creal(cSamples[i]);
|
||||
AvgR += d * d;
|
||||
p = cimag(cSamples[i]);
|
||||
AvgQ += p * p;
|
||||
AvgRQ += d * p;
|
||||
}
|
||||
tim = time(NULL);
|
||||
if (tim - time0 >= 2) {
|
||||
time0 = tim;
|
||||
Gain = sqrt(AvgR / AvgQ);
|
||||
Phase = AvgRQ / AvgQ / Gain;
|
||||
Phase = asin(Phase);
|
||||
printf("Time domain Gain %10.7lf, Phase %10.7lf, %10.7lf degrees\n", Gain, Phase, Phase * 57.29578);
|
||||
AvgR = AvgQ = AvgRQ = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int quisk_read_sound(void) // Called from sound thread
|
||||
{ // called in an infinite loop by the main program
|
||||
int i, nSamples, mic_count, mic_interp, retval, is_cw, mic_sample_rate;
|
||||
@@ -913,9 +947,10 @@ int quisk_read_sound(void) // Called from sound thread
|
||||
//QuiskPrintTime("quisk_read_sound end", 0);
|
||||
if (Capture.channel_Delay >= 0) // delay the I or Q channel by one sample
|
||||
delay_sample(&Capture, (double *)cSamples, nSamples);
|
||||
DCremove(cSamples, nSamples, quisk_sound_state.sample_rate, key_state);
|
||||
//testing(cSamples, nSamples);
|
||||
if (Capture.doAmplPhase) // amplitude and phase corrections
|
||||
correct_sample(&Capture, cSamples, nSamples);
|
||||
DCremove(cSamples, nSamples, quisk_sound_state.sample_rate, key_state);
|
||||
if (nSamples <= 0)
|
||||
QuiskSleepMicrosec(2000);
|
||||
#if DEBUG_IO > 1
|
||||
@@ -969,7 +1004,7 @@ int quisk_read_sound(void) // Called from sound thread
|
||||
if (quisk_record_state == TMP_PLAY_SPKR_MIC)
|
||||
quisk_tmp_playback(cSamples, nSamples, 1.0); // replace radio sound
|
||||
else if (quisk_record_state == FILE_PLAY_SPKR_MIC)
|
||||
quisk_file_playback(cSamples, nSamples, 1.0); // replace radio sound
|
||||
quisk_file_playback(cSamples, nSamples, file_play_level); // replace radio sound
|
||||
// Play the demodulated audio
|
||||
#if DEBUG_MIC != 2
|
||||
if ( ! quisk_play_sidetone(&quisk_Playback)) // play sidetone
|
||||
@@ -1075,7 +1110,7 @@ int quisk_read_sound(void) // Called from sound thread
|
||||
if (is_cw) { // Transmit CW; use capture device for timing, not microphone
|
||||
cwCount += (double)retval * quisk_MicPlayback.sample_rate / quisk_sound_state.sample_rate;
|
||||
mic_count = 0;
|
||||
if (QUISK_CWKEY_DOWN || quiskSpotLevel >= 0) {
|
||||
if (QUISK_CWKEY_DOWN || quiskSpotLevel >= 0 || multus_cw_samples) {
|
||||
while (cwCount >= 1.0) {
|
||||
if (cwEnvelope < 1.0) {
|
||||
cwEnvelope += 1. / (quisk_MicPlayback.sample_rate * 5e-3); // 5 milliseconds
|
||||
@@ -1401,6 +1436,8 @@ void quisk_open_sound(void) // Called from GUI thread
|
||||
RawSamplePlayback.channel_I = 0;
|
||||
RawSamplePlayback.channel_Q = 1;
|
||||
|
||||
file_play_level = QuiskGetConfigDouble("file_play_level", 1.0);
|
||||
|
||||
set_num_channels (&Capture);
|
||||
set_num_channels (&quisk_Playback);
|
||||
set_num_channels (&MicCapture);
|
||||
@@ -1565,10 +1602,9 @@ PyObject * quisk_micplay_channels(PyObject * self, PyObject * args) // Called fr
|
||||
PyObject * quisk_set_sparams(PyObject * self, PyObject * args, PyObject * keywds)
|
||||
{ /* Call with keyword arguments ONLY; change local parameters */
|
||||
static char * kwlist[] = {"dc_remove_bw", "digital_output_level", "remote_control_slave", "remote_control_head",
|
||||
NULL} ;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords (args, keywds, "|idii", kwlist, &dc_remove_bw, &digital_output_level,
|
||||
&remote_control_slave, &remote_control_head))
|
||||
"file_play_level", "multus_cw_samples", NULL} ;
|
||||
if (!PyArg_ParseTupleAndKeywords (args, keywds, "|idiidi", kwlist, &dc_remove_bw, &digital_output_level,
|
||||
&remote_control_slave, &remote_control_head, &file_play_level, &multus_cw_samples))
|
||||
return NULL;
|
||||
Py_INCREF (Py_None);
|
||||
return Py_None;
|
||||
|
||||
+30
-10
@@ -495,8 +495,37 @@ static snd_pcm_format_t check_formats(struct sound_dev * dev, snd_pcm_hw_params_
|
||||
{
|
||||
snd_pcm_format_t format = SND_PCM_FORMAT_UNKNOWN;
|
||||
dev->sample_bytes = 0;
|
||||
|
||||
#if 0
|
||||
char * card_name;
|
||||
int card;
|
||||
snd_pcm_info_t * pcm_info;
|
||||
printf("driver %s\n", snd_ctl_card_info_get_driver(info));
|
||||
int loopback = 0;
|
||||
if (snd_pcm_info_malloc(&pcm_info) == 0) {
|
||||
if (snd_pcm_info (dev->handle, pcm_info) == 0) {
|
||||
card = snd_pcm_info_get_card (pcm_info);
|
||||
if (card >= 0) {
|
||||
if (snd_card_get_name(card, &card_name) == 0) {
|
||||
if (strcmp(card_name, "Loopback") == 0)
|
||||
loopback = 1;
|
||||
printf("name %s\n", card_name);
|
||||
free(card_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
snd_pcm_info_free(pcm_info);
|
||||
}
|
||||
#endif
|
||||
strMcpy (dev->msg1, "Available formats: ", QUISK_SC_SIZE);
|
||||
if (snd_pcm_hw_params_test_format (dev->handle, hware, SND_PCM_FORMAT_S16) == 0) {
|
||||
if (!dev->sample_bytes) {
|
||||
strncat(dev->msg1, "*", QUISK_SC_SIZE);
|
||||
dev->sample_bytes = 2;
|
||||
dev->sound_format = Int16;
|
||||
format = SND_PCM_FORMAT_S16;
|
||||
}
|
||||
strncat(dev->msg1, "S16 ", QUISK_SC_SIZE);
|
||||
}
|
||||
if (snd_pcm_hw_params_test_format (dev->handle, hware, SND_PCM_FORMAT_S32) == 0) {
|
||||
if (!dev->sample_bytes) {
|
||||
strncat(dev->msg1, "*", QUISK_SC_SIZE);
|
||||
@@ -515,15 +544,6 @@ static snd_pcm_format_t check_formats(struct sound_dev * dev, snd_pcm_hw_params_
|
||||
if (snd_pcm_hw_params_test_format (dev->handle, hware, SND_PCM_FORMAT_U24) == 0) {
|
||||
strncat(dev->msg1, "U24 ", QUISK_SC_SIZE);
|
||||
}
|
||||
if (snd_pcm_hw_params_test_format (dev->handle, hware, SND_PCM_FORMAT_S16) == 0) {
|
||||
if (!dev->sample_bytes) {
|
||||
strncat(dev->msg1, "*", QUISK_SC_SIZE);
|
||||
dev->sample_bytes = 2;
|
||||
dev->sound_format = Int16;
|
||||
format = SND_PCM_FORMAT_S16;
|
||||
}
|
||||
strncat(dev->msg1, "S16 ", QUISK_SC_SIZE);
|
||||
}
|
||||
if (snd_pcm_hw_params_test_format (dev->handle, hware, SND_PCM_FORMAT_S24_3LE) == 0) {
|
||||
if (!dev->sample_bytes) {
|
||||
strncat(dev->msg1, "*", QUISK_SC_SIZE);
|
||||
|
||||
Reference in New Issue
Block a user