kopia lustrzana https://github.com/projecthorus/horus-gui
Handle zero samples better, send baud rate and modulation details, inhibit habitat position upload
rodzic
a4f1aa2595
commit
05db1a3b2f
|
@ -1 +1 @@
|
|||
__version__ = "0.3.8"
|
||||
__version__ = "0.3.9"
|
||||
|
|
|
@ -73,7 +73,7 @@ def read_config(widgets):
|
|||
""" Read in configuration settings from Qt """
|
||||
global qt_settings, default_config
|
||||
|
||||
OK_VERSIONS = [__version__, '0.3.7', '0.3.6', '0.3.5', '0.3.4', '0.3.1', '0.2.1']
|
||||
OK_VERSIONS = [__version__, '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:
|
||||
|
|
|
@ -58,13 +58,19 @@ class FFTProcess(object):
|
|||
# Advance sample buffer
|
||||
self.sample_buffer = self.sample_buffer[self.stride * self.sample_width :]
|
||||
|
||||
# Calculate FFT
|
||||
_fft = 20 * np.log10(
|
||||
np.abs(np.fft.fftshift(np.fft.fft(raw_data * self.window)))
|
||||
) - 20 * np.log10(self.nfft)
|
||||
|
||||
# Calculate Maximum value
|
||||
_dbfs = 20*np.log10(raw_data.max())
|
||||
_raw_max = raw_data.max()
|
||||
if(_raw_max>0):
|
||||
# Calculate FFT
|
||||
_fft = 20 * np.log10(
|
||||
np.abs(np.fft.fftshift(np.fft.fft(raw_data * self.window)))
|
||||
) - 20 * np.log10(self.nfft)
|
||||
|
||||
# Calculate dBFS value.
|
||||
_dbfs = 20*np.log10(_raw_max)
|
||||
else:
|
||||
_fft = np.zeros(self.nfft)*np.nan
|
||||
_dbfs = -99.0
|
||||
|
||||
if self.callback != None:
|
||||
if self.update_counter % self.update_decimation == 0:
|
||||
|
|
|
@ -726,15 +726,18 @@ def handle_fft_update(data):
|
|||
)
|
||||
|
||||
# Ignore NaN values.
|
||||
if np.isnan(_dbfs):
|
||||
if np.isnan(_dbfs) or np.isinf(_dbfs):
|
||||
return
|
||||
|
||||
|
||||
# Use same IIR to smooth out dBFS readings a little.
|
||||
_new_dbfs = float((widgets["audioDbfsValue_float"] * (1 - _tc)) + (_dbfs * _tc))
|
||||
|
||||
# Set dBFS value
|
||||
if (_new_dbfs>-5.0):
|
||||
_dbfs_ok = "TOO HIGH"
|
||||
elif (_new_dbfs < -90.0):
|
||||
_dbfs_ok = "NO AUDIO?"
|
||||
elif (_new_dbfs < -50.0):
|
||||
_dbfs_ok = "LOW"
|
||||
else:
|
||||
|
@ -748,11 +751,18 @@ def handle_status_update(status):
|
|||
global widgets, habitat
|
||||
|
||||
# Update Frequency estimator markers
|
||||
_fest_average = 0.0
|
||||
_fest_count = 0
|
||||
for _i in range(len(status.extended_stats.f_est)):
|
||||
_fest_pos = float(status.extended_stats.f_est[_i])
|
||||
if _fest_pos != 0.0:
|
||||
_fest_average += _fest_pos
|
||||
_fest_count += 1
|
||||
widgets["estimatorLines"][_i].setPos(_fest_pos)
|
||||
|
||||
_fest_average = _fest_average/_fest_count
|
||||
widgets["fest_float"] = _fest_average
|
||||
|
||||
# Update SNR Plot
|
||||
_time = time.time()
|
||||
# Roll Time/SNR
|
||||
|
@ -831,18 +841,30 @@ def handle_new_packet(frame):
|
|||
_snr = get_latest_snr()
|
||||
#logging.info(f"Packet SNR: {_snr:.2f}")
|
||||
|
||||
|
||||
# Grab other metadata out of the GUI
|
||||
try:
|
||||
_radio_dial = float(widgets["dialFreqEntry"].text())*1e6
|
||||
if widgets["fest_float"]:
|
||||
# Add on the centre frequency estimation onto the dial frequency.
|
||||
_radio_dial += widgets["fest_float"]
|
||||
|
||||
habitat_uploader.last_freq_hz = _radio_dial
|
||||
except:
|
||||
_radio_dial = None
|
||||
|
||||
_baud_rate = int(widgets["horusModemRateSelector"].currentText())
|
||||
_modulation_detail = HORUS_MODEM_LIST[widgets["horusModemSelector"].currentText()]['modulation_detail']
|
||||
|
||||
if type(frame.data) == str:
|
||||
# RTTY packet handling.
|
||||
# Attempt to extract fields from it:
|
||||
try:
|
||||
_decoded = parse_ukhas_string(frame.data)
|
||||
_decoded['snr'] = _snr
|
||||
_decoded['baud_rate'] = _baud_rate
|
||||
if _modulation_detail:
|
||||
_decoded['modulation_detail'] = _modulation_detail
|
||||
if _radio_dial:
|
||||
_decoded['f_centre'] = _radio_dial
|
||||
# If we get here, the string is valid!
|
||||
|
@ -869,6 +891,9 @@ def handle_new_packet(frame):
|
|||
try:
|
||||
_decoded = decode_packet(frame.data)
|
||||
_decoded['snr'] = _snr
|
||||
_decoded['baud_rate'] = _baud_rate
|
||||
if _modulation_detail:
|
||||
_decoded['modulation_detail'] = _modulation_detail
|
||||
if _radio_dial:
|
||||
_decoded['f_centre'] = _radio_dial
|
||||
|
||||
|
|
|
@ -171,29 +171,32 @@ class HabitatUploader(object):
|
|||
# Wait for a short time before checking the queue again.
|
||||
time.sleep(0.5)
|
||||
|
||||
if not self.position_uploaded:
|
||||
# Validate the lat/lon entries.
|
||||
try:
|
||||
_lat = float(self.listener_lat)
|
||||
_lon = float(self.listener_lon)
|
||||
#
|
||||
# Habitat listener position update disabled 2022-09, due to Habitat going away...
|
||||
#
|
||||
# if not self.position_uploaded:
|
||||
# # Validate the lat/lon entries.
|
||||
# try:
|
||||
# _lat = float(self.listener_lat)
|
||||
# _lon = float(self.listener_lon)
|
||||
|
||||
if (_lat != 0.0) or (_lon != 0.0):
|
||||
_success = self.uploadListenerPosition(
|
||||
self.user_callsign,
|
||||
_lat,
|
||||
_lon,
|
||||
self.listener_radio,
|
||||
self.listener_antenna,
|
||||
)
|
||||
else:
|
||||
logging.warning("Listener position set to 0.0/0.0 - not uploading.")
|
||||
# if (_lat != 0.0) or (_lon != 0.0):
|
||||
# _success = self.uploadListenerPosition(
|
||||
# self.user_callsign,
|
||||
# _lat,
|
||||
# _lon,
|
||||
# self.listener_radio,
|
||||
# self.listener_antenna,
|
||||
# )
|
||||
# else:
|
||||
# logging.warning("Listener position set to 0.0/0.0 - not uploading.")
|
||||
|
||||
except Exception as e:
|
||||
logging.error("Error uploading listener position: %s" % str(e))
|
||||
# except Exception as e:
|
||||
# logging.error("Error uploading listener position: %s" % str(e))
|
||||
|
||||
# Set this flag regardless if the upload worked.
|
||||
# The user can trigger a re-upload.
|
||||
self.position_uploaded = True
|
||||
# # Set this flag regardless if the upload worked.
|
||||
# # The user can trigger a re-upload.
|
||||
# self.position_uploaded = True
|
||||
|
||||
|
||||
logging.info("Stopped Habitat Uploader Thread.")
|
||||
|
|
|
@ -11,6 +11,7 @@ HORUS_MODEM_LIST = {
|
|||
"default_baud_rate": 100,
|
||||
"default_tone_spacing": 270,
|
||||
"use_mask_estimator": True,
|
||||
"modulation_detail": None
|
||||
},
|
||||
"RTTY (7N1)": {
|
||||
"id": Mode.RTTY_7N1,
|
||||
|
@ -18,6 +19,7 @@ HORUS_MODEM_LIST = {
|
|||
"default_baud_rate": 100,
|
||||
"default_tone_spacing": 425,
|
||||
"use_mask_estimator": False,
|
||||
"modulation_detail": "7N1"
|
||||
},
|
||||
"RTTY (7N2)": {
|
||||
"id": Mode.RTTY_7N2,
|
||||
|
@ -25,6 +27,7 @@ HORUS_MODEM_LIST = {
|
|||
"default_baud_rate": 100,
|
||||
"default_tone_spacing": 425,
|
||||
"use_mask_estimator": False,
|
||||
"modulation_detail": "7N2"
|
||||
},
|
||||
"RTTY (8N2)": {
|
||||
"id": Mode.RTTY_8N2,
|
||||
|
@ -32,6 +35,7 @@ HORUS_MODEM_LIST = {
|
|||
"default_baud_rate": 100,
|
||||
"default_tone_spacing": 425,
|
||||
"use_mask_estimator": False,
|
||||
"modulation_detail": "8N1"
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "horusgui"
|
||||
version = "0.3.8"
|
||||
version = "0.3.9"
|
||||
description = ""
|
||||
authors = ["Mark Jessop <vk5qi@rfhead.net>"]
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue