Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Horus GUI to PyQt6 #46

Merged
merged 32 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f7138e0
Migrate to PyQt6
ke5gdb Jan 16, 2025
c741896
Add PyQt6 branch to pipeline
ke5gdb Jan 16, 2025
978503e
Update from Python 3.11 to 3.13
ke5gdb Jan 16, 2025
10637af
Update actions
ke5gdb Jan 16, 2025
8735ea0
Revert to Python 3.11 on Windows due to numpy build failure
ke5gdb Jan 16, 2025
334ca67
Updated requirements.txt
ke5gdb Jan 16, 2025
4512838
Tweaks for class compliance
ke5gdb Jan 16, 2025
a261bfc
Remove pyqtdarktheme and let PyQt6 use the system default
ke5gdb Jan 17, 2025
fc16eea
Converted from Dock() to QGroupBox()
ke5gdb Jan 17, 2025
efd7961
Add telemetry groupbox
ke5gdb Jan 23, 2025
796e917
Added range inhibit checkbox to prevent rotator from chasing position…
ke5gdb Jan 25, 2025
1a93e2e
Add rotator range inhibit to persistent config
ke5gdb Jan 25, 2025
ff726ee
GUI threading improvements
ke5gdb Jan 25, 2025
f67fb49
Graduation
ke5gdb Jan 25, 2025
826c669
Fix rotatorRangeInhibit persistent config parser
ke5gdb Jan 25, 2025
9b99121
Change right column row stretch to log box
ke5gdb Jan 25, 2025
7f87805
Horizontal stretching improvements
ke5gdb Jan 25, 2025
e4d3c34
Limit to 1000 entries in log box
ke5gdb Jan 25, 2025
fa7fa86
Added proper signaling for new packet handler
ke5gdb Jan 25, 2025
5e2a50c
Revert all builds to Python 3.11
ke5gdb Jan 25, 2025
549aa3b
Fixed width on settings column, smoothing on FFT
ke5gdb Jan 25, 2025
d086973
Add ldconfig to README
ke5gdb Jan 26, 2025
9cb9542
Spectrum plot adjustments
ke5gdb Jan 26, 2025
f613976
Testing QSplitter to allow hiding of config column
ke5gdb Jan 26, 2025
0f2cac7
Added FFT smoothing as an option
ke5gdb Jan 26, 2025
8feb937
Added default telem fields to GUI (batt, satellites, temperature)
ke5gdb Jan 26, 2025
fab4633
Fix typo in battery_voltage
ke5gdb Jan 26, 2025
c1c76e9
Improved Telemetry display
ke5gdb Jan 26, 2025
f261d80
Reset telemetry fields
ke5gdb Jan 30, 2025
454892b
GitHub Actions change
ke5gdb Jan 30, 2025
32137cf
Version 0.4.0
ke5gdb Jan 30, 2025
c415802
Added 0.3.19 to the ok-config list
ke5gdb Jan 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ $ cd horusdemodlib && mkdir build && cd build
$ cmake ..
$ make
$ sudo make install
$ sudo ldconfig
```

### Grab this Repo
Expand Down
2 changes: 1 addition & 1 deletion horusgui/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.3.19"
__version__ = "0.4.0"
19 changes: 16 additions & 3 deletions horusgui/audio.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Audio Interfacing
import logging
import pyaudio
import time


# Global PyAudio object
Expand Down Expand Up @@ -125,8 +126,14 @@ def __init__(self, audio_device, fs, block_size=8192, fft_input=None, modem=None
self.modem = modem
self.stats_callback = stats_callback

# Start audio stream
self.audio_thread_running = True

self.audio = pyaudio.PyAudio()

def start_stream(self, info_callback=None):
if info_callback:
self.stats_callback = info_callback

self.stream = self.audio.open(
format=pyaudio.paInt16,
channels=1,
Expand All @@ -138,6 +145,11 @@ def __init__(self, audio_device, fs, block_size=8192, fft_input=None, modem=None
stream_callback=self.handle_samples,
)

while self.audio_thread_running:
time.sleep(0.5)

logging.debug("Stopped audio stream thread")

def handle_samples(self, data, frame_count, time_info="", status_flags=""):
""" Handle incoming samples from pyaudio """

Expand All @@ -151,10 +163,11 @@ def handle_samples(self, data, frame_count, time_info="", status_flags=""):
# Send any stats data back to the stats callback
if _stats:
if self.stats_callback:
self.stats_callback(_stats)
self.stats_callback.emit(_stats)

return (None, pyaudio.paContinue)

def stop(self):
""" Halt stream """
self.stream.close()
self.audio_thread_running = False
self.stream.close()
9 changes: 8 additions & 1 deletion horusgui/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@
"rotator_type": "rotctld",
"rotator_host": "localhost",
"rotator_port": 4533,
"rotator_rangeinhibit": True,
"logging_enabled": False,
"log_format": "CSV",
"log_directory": "",
"fft_smoothing": False,
"payload_list": json.dumps(horusdemodlib.payloads.HORUS_PAYLOAD_LIST),
"custom_field_list": json.dumps({})
}
Expand Down Expand Up @@ -76,7 +78,7 @@ def read_config(widgets):
global qt_settings, default_config

# This is getting a bit ridiculous, need to re-think this approach.
OK_VERSIONS = [__version__, '0.3.18', '0.3.17', '0.3.16', '0.3.15', '0.3.14', '0.3.13', '0.3.12', '0.3.11', '0.3.10', '0.3.9', '0.3.8', '0.3.7', '0.3.6', '0.3.5', '0.3.4', '0.3.1', '0.2.1']
OK_VERSIONS = [__version__,'0.3.19', '0.3.18', '0.3.17', '0.3.16', '0.3.15', '0.3.14', '0.3.13', '0.3.12', '0.3.11', '0.3.10', '0.3.9', '0.3.8', '0.3.7', '0.3.6', '0.3.5', '0.3.4', '0.3.1', '0.2.1']

# Try and read in the version parameter from QSettings
if qt_settings.value("version") not in OK_VERSIONS:
Expand Down Expand Up @@ -124,12 +126,15 @@ def read_config(widgets):
widgets["rotatorTypeSelector"].setCurrentText(default_config["rotator_type"])
widgets["rotatorHostEntry"].setText(str(default_config["rotator_host"]))
widgets["rotatorPortEntry"].setText(str(default_config["rotator_port"]))
widgets["rotatorRangeInhibit"].setChecked(ValueToBool(default_config["rotator_rangeinhibit"]))

# Logging Settings
widgets["loggingPathEntry"].setText(str(default_config["log_directory"]))
widgets["loggingFormatSelector"].setCurrentText(default_config["log_format"])
widgets["enableLoggingSelector"].setChecked(ValueToBool(default_config["logging_enabled"]))

widgets["fftSmoothingSelector"].setChecked(ValueToBool(default_config["fft_smoothing"]))

if default_config['baud_rate'] != -1:
widgets["horusModemRateSelector"].setCurrentText(str(default_config['baud_rate']))

Expand Down Expand Up @@ -173,9 +178,11 @@ def save_config(widgets):
default_config["rotator_type"] = widgets["rotatorTypeSelector"].currentText()
default_config["rotator_host"] = widgets["rotatorHostEntry"].text()
default_config["rotator_port"] = int(widgets["rotatorPortEntry"].text())
default_config["rotator_rangeinhibit"] = widgets["rotatorRangeInhibit"].isChecked()
default_config["logging_enabled"] = widgets["enableLoggingSelector"].isChecked()
default_config["log_directory"] = widgets["loggingPathEntry"].text()
default_config["log_format"] = widgets["loggingFormatSelector"].currentText()
default_config["fft_smoothing"] = widgets["fftSmoothingSelector"].isChecked()

default_config["payload_list"] = json.dumps(horusdemodlib.payloads.HORUS_PAYLOAD_LIST)
default_config["custom_field_list"] = json.dumps(horusdemodlib.payloads.HORUS_CUSTOM_FIELDS)
Expand Down
14 changes: 9 additions & 5 deletions horusgui/fft.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import time
import numpy as np
from queue import Queue
from threading import Thread
#from threading import Thread


class FFTProcess(object):
Expand Down Expand Up @@ -37,8 +37,8 @@ def __init__(

self.processing_thread_running = True

self.t = Thread(target=self.processing_thread)
self.t.start()
#self.t = Thread(target=self.processing_thread)
#self.t.start()

def init_window(self):
""" Initialise Window functions and FFT scales. """
Expand Down Expand Up @@ -74,7 +74,7 @@ def perform_fft(self):

if self.callback != None:
if self.update_counter % self.update_decimation == 0:
self.callback({"fft": _fft[self.mask], "scale": self.fft_scale[self.mask], 'dbfs': _dbfs})
self.callback.emit({"fft": _fft[self.mask], "scale": self.fft_scale[self.mask], 'dbfs': _dbfs})

self.update_counter += 1

Expand All @@ -86,7 +86,9 @@ def process_block(self, samples):
while len(self.sample_buffer) > self.nfft * self.sample_width:
self.perform_fft()

def processing_thread(self):
def processing_thread(self, info_callback=None):
if info_callback:
self.callback = info_callback

while self.processing_thread_running:
if self.input_queue.qsize() > 0:
Expand All @@ -95,6 +97,8 @@ def processing_thread(self):
else:
time.sleep(0.01)

logging.debug("Stopped FFT processing thread")

def add_samples(self, samples):
""" Add a block of samples to the input queue """
try:
Expand Down
Loading