Skip to content

Commit 8b6e2f2

Browse files
authored
Merge pull request #986 from projecthorus/testing
v1.8.1 Release - RS41 Multi-GNSS Support, ka9q-radio updates
2 parents 35d9515 + 73cc869 commit 8b6e2f2

File tree

15 files changed

+363
-166
lines changed

15 files changed

+363
-166
lines changed

.github/workflows/container.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ jobs:
4141

4242
- name: Setup QEMU
4343
uses: docker/setup-qemu-action@v3
44+
with:
45+
image: tonistiigi/binfmt:qemu-v8.1.5
4446

4547
- name: Setup Buildx
4648
uses: docker/setup-buildx-action@v3

Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ RUN apt-get update && \
2626
libbsd-dev \
2727
libfftw3-dev \
2828
libiniparser-dev \
29+
libogg-dev \
2930
libopus-dev && \
3031
rm -rf /var/lib/apt/lists/*
3132

@@ -61,11 +62,11 @@ RUN git clone https://github.com/miweber67/spyserver_client.git /root/spyserver_
6162
# Compile ka9q-radio from source
6263
RUN git clone https://github.com/ka9q/ka9q-radio.git /root/ka9q-radio && \
6364
cd /root/ka9q-radio && \
64-
git checkout ff7fe26a12909317b26bdb24a0576db87c15baf2 && \
65+
git checkout d0febaa033e1d53b9b53078cfe17457ac3676d20 && \
6566
make \
6667
-f Makefile.linux \
67-
"COPTS=-std=gnu11 -pthread -Wall -funsafe-math-optimizations -fno-math-errno -fcx-limited-range -D_GNU_SOURCE=1" \
68-
tune powers pcmcat
68+
ARCHOPTS= \
69+
tune powers pcmrecord
6970

7071
# Copy in radiosonde_auto_rx.
7172
COPY . /root/radiosonde_auto_rx
@@ -118,7 +119,7 @@ RUN ln -s ss_client /opt/auto_rx/ss_iq && \
118119
# Copy ka9q-radio utilities
119120
COPY --from=build /root/ka9q-radio/tune /usr/local/bin/
120121
COPY --from=build /root/ka9q-radio/powers /usr/local/bin/
121-
COPY --from=build /root/ka9q-radio/pcmcat /usr/local/bin/
122+
COPY --from=build /root/ka9q-radio/pcmrecord /usr/local/bin/
122123

123124
# Allow mDNS resolution for ka9q-radio utilities
124125
RUN sed -i -e 's/files dns/files mdns4_minimal [NOTFOUND=return] dns/g' /etc/nsswitch.conf

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ Improvements from the upstream RS codebase will be merged into this codebase whe
4040
Please consider joining the Google Group to receive updates on new software features:
4141
https://groups.google.com/forum/#!forum/radiosonde_auto_rx
4242

43+
We also have a channel in the SondeHub Discord server: https://sondehub.org/go/discord
44+
4345
## Presentations
4446
* Linux.conf.au 2019 - https://www.youtube.com/watch?v=YBy-bXEWZeM
4547
* UKHAS Conference 2019 - [Presented via Skype](https://youtu.be/azDJmMywBgw?t=643) which had some audio issues at the start. Slides [here](https://rfhead.net/sondes/auto_rx_presentation_UKHAS2019.pdf).

auto_rx/autorx/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# MINOR - New sonde type support, other fairly big changes that may result in telemetry or config file incompatability issus.
1313
# PATCH - Small changes, or minor feature additions.
1414

15-
__version__ = "1.8.0"
15+
__version__ = "1.8.1"
1616

1717
# Global Variables
1818

auto_rx/autorx/decode.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -829,9 +829,10 @@ def generate_decoder_command_experimental(self):
829829
_baud_rate = 4800
830830
_sample_rate = 48000 # 10x Oversampling
831831

832-
# Limit FSK estimator window to roughly +/- 10 kHz
833-
_lower = -10000
834-
_upper = 10000
832+
# Limit FSK estimator window to roughly +/- 5 kHz
833+
_lower = -5000
834+
_upper = 5000
835+
835836

836837
demod_cmd = get_sdr_iq_cmd(
837838
sdr_type = self.sdr_type,
@@ -844,14 +845,17 @@ def generate_decoder_command_experimental(self):
844845
ppm = self.ppm,
845846
gain = self.gain,
846847
bias = self.bias,
847-
dc_block = True
848+
dc_block = True,
849+
channel_filter = 5000 # +/- 5 kHz channel filter.
848850
)
849851

850852
# Add in tee command to save IQ to disk if debugging is enabled.
851853
if self.save_decode_iq:
852854
demod_cmd += f" tee {self.save_decode_iq_path} |"
853855

854-
demod_cmd += "./fsk_demod --cs16 -b %d -u %d -s --stats=%d 2 %d %d - -" % (
856+
# Use a 4800 Hz mask estimator to better avoid adjacent sonde issues.
857+
# Also seems to give a small performance bump.
858+
demod_cmd += "./fsk_demod --cs16 -b %d -u %d -s --mask 4800 --stats=%d 2 %d %d - -" % (
855859
_lower,
856860
_upper,
857861
_stats_rate,
@@ -949,15 +953,9 @@ def generate_decoder_command_experimental(self):
949953
_baud_rate = 2500
950954
_sample_rate = 50000 # 10x Oversampling
951955

952-
# Limit FSK estimator window to roughly +/- 10 kHz
953-
_lower = -10000
954-
_upper = 10000
955-
956-
if (abs(403200000 - self.sonde_freq) < 20000) and (self.sdr_type == "RTLSDR"):
957-
# Narrow up the frequency estimator window if we are close to
958-
# the 403.2 MHz RTLSDR Spur.
959-
_lower = -8000
960-
_upper = 8000
956+
# Limit FSK estimator window to roughly +/- 5 kHz
957+
_lower = -5000
958+
_upper = 5000
961959

962960
demod_cmd = get_sdr_iq_cmd(
963961
sdr_type = self.sdr_type,
@@ -970,14 +968,16 @@ def generate_decoder_command_experimental(self):
970968
ppm = self.ppm,
971969
gain = self.gain,
972970
bias = self.bias,
973-
dc_block = True
971+
dc_block = True,
972+
channel_filter = 5000
974973
)
975974

976975
# Add in tee command to save IQ to disk if debugging is enabled.
977976
if self.save_decode_iq:
978977
demod_cmd += f" tee {self.save_decode_iq_path} |"
979978

980979
# NOTE - Using inverted soft decision outputs, so DFM type detection works correctly.
980+
# No mask estimator - DFMs seem to decode better without it!
981981
demod_cmd += "./fsk_demod --cs16 -b %d -u %d -s -i --stats=%d 2 %d %d - -" % (
982982
_lower,
983983
_upper,

auto_rx/autorx/ka9q.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,29 @@ def ka9q_setup_channel(
1717
sdr_hostname,
1818
frequency,
1919
sample_rate,
20-
scan
20+
scan,
21+
channel_filter = None
2122
):
2223
if scan:
2324
ssrc="04"
2425
else:
2526
ssrc="01"
2627

2728
# tune --samprate 48000 --frequency 404m09 --mode iq --ssrc 404090000 --radio sonde.local
29+
30+
if channel_filter:
31+
_low = int(channel_filter * -1.0)
32+
_high = int(channel_filter)
33+
else:
34+
_low = int(int(sample_rate) / (-2.4))
35+
_high = int(int(sample_rate) / 2.4)
36+
2837
_cmd = (
2938
f"{timeout_cmd()} 5 " # Add a timeout, because connections to non-existing servers block for ages
3039
f"tune "
3140
f"--samprate {int(sample_rate)} "
3241
f"--mode iq "
33-
f"--low {int(int(sample_rate) / (-2.4))} --high {int(int(sample_rate) / 2.4)} "
42+
f"--low {_low} --high {_high} "
3443
f"--frequency {int(frequency)} "
3544
f"--ssrc {round(frequency / 1000)}{ssrc} "
3645
f"--radio {sdr_hostname}"
@@ -120,28 +129,30 @@ def ka9q_get_iq_cmd(
120129
sdr_hostname,
121130
frequency,
122131
sample_rate,
123-
scan
132+
scan,
133+
channel_filter = None
124134
):
125135
if scan:
126136
ssrc="04"
127137
else:
128138
ssrc="01"
129139

130140
# We need to setup a channel before we can use it!
131-
_setup_success = ka9q_setup_channel(sdr_hostname, frequency, sample_rate, scan)
141+
_setup_success = ka9q_setup_channel(sdr_hostname, frequency, sample_rate, scan, channel_filter)
132142

133143
if not _setup_success:
134144
logging.critical(f"KA9Q ({sdr_hostname}) - Could not setup rx channel! Decoder will likely timeout.")
135145

136146
# Get the 'PCM' version of the server name, where as assume -pcm is added to the first part of the hostname.
137147
_pcm_host = sdr_hostname.split('.')[0] + "-pcm." + ".".join(sdr_hostname.split(".")[1:])
138148

139-
# Example: pcmcat -s 404090000 sonde-pcm.local
149+
# Example: pcmrecord --ssrc 404090001 --catmode --raw sonde-pcm.local
140150
# -2 option was removed sometime in early 2024.
141151
_cmd = (
142-
f"pcmcat "
143-
f"-s {round(frequency / 1000)}{ssrc} "
144-
f"-b 1 "
152+
f"pcmrecord "
153+
f"--ssrc {round(frequency / 1000)}{ssrc} "
154+
f"--catmode "
155+
f"--raw "
145156
f"{_pcm_host} |"
146157
)
147158

auto_rx/autorx/scan.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -288,13 +288,7 @@ def detect_sonde(
288288
_if_bw = 64
289289
else:
290290
_iq_bw = 48000
291-
_if_bw = 20
292-
293-
# Try and avoid the RTLSDR 403.2 MHz spur.
294-
# Note that this is only goign to work if we are detecting on 403.210 or 403.190 MHz.
295-
if (abs(403200000 - frequency) < 20000) and (sdr_type == "RTLSDR"):
296-
logging.debug("Scanner - Narrowing detection IF BW to avoid RTLSDR spur.")
297-
_if_bw = 15
291+
_if_bw = 15
298292

299293
else:
300294
# 1680 MHz sondes

auto_rx/autorx/sdr_wrappers.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_sdr(
2424
ss_iq_path = "./ss_iq",
2525
ss_power_path = "./ss_power",
2626
check_freq = 401500000,
27-
timeout = 5
27+
timeout = 20
2828
):
2929
"""
3030
Test the prescence / functionality of a SDR.
@@ -60,8 +60,8 @@ def test_sdr(
6060
# if not os.path.isfile('tune'):
6161
# logging.critical("Could not find KA9Q-Radio 'tune' binary! This may need to be compiled and installed.")
6262
# return False
63-
# if not os.path.isfile('pcmcat'):
64-
# logging.critical("Could not find KA9Q-Radio 'pcmcat' binary! This may need to be compiled and installed.")
63+
# if not os.path.isfile('pcmrecord'):
64+
# logging.critical("Could not find KA9Q-Radio 'pcmrecord' binary! This may need to be compiled and installed.")
6565
# return False
6666
# TBD - whatever we need for spectrum use.
6767
# if not os.path.isfile('TBD'):
@@ -281,7 +281,8 @@ def get_sdr_iq_cmd(
281281
sdr_hostname = "",
282282
sdr_port = 5555,
283283
ss_iq_path = "./ss_iq",
284-
scan = False
284+
scan = False,
285+
channel_filter = None
285286
):
286287
"""
287288
Get a command-line argument to get IQ (signed 16-bit) from a SDR
@@ -303,7 +304,8 @@ def get_sdr_iq_cmd(
303304
Arguments for KA9Q SDR Server / SpyServer:
304305
sdr_hostname (str): Hostname of KA9Q Server
305306
sdr_port (int): Port number of KA9Q Server
306-
scan (bool): Create unique SSRC for scan attempts
307+
scan (bool): Create unique SSRC for scan attempts (KA9Q Only)
308+
channel_filter (int/float): Set a high/lowpass frequency for a KA9Q channel.
307309
308310
Arguments for SpyServer Client:
309311
ss_iq_path (str): Path to spyserver IQ client utility.
@@ -361,9 +363,9 @@ def get_sdr_iq_cmd(
361363
return _cmd
362364

363365
if sdr_type == "KA9Q":
364-
_cmd = ka9q_get_iq_cmd(sdr_hostname, frequency, sample_rate, scan)
366+
_cmd = ka9q_get_iq_cmd(sdr_hostname, frequency, sample_rate, scan, channel_filter)
365367

366-
if dc_block:
368+
if dc_block and ("KA9Q" not in sdr_type):
367369
_cmd += _dc_remove
368370

369371
return _cmd
@@ -779,7 +781,6 @@ def get_power_spectrum(
779781
_ssrc = f"{round(_center_freq / 1000)}03"
780782

781783
_powers_cmd = (
782-
f"LANG=C " # temporary workaround for https://github.com/ka9q/ka9q-radio/pull/65#issuecomment-2480243690
783784
f"{_timeout_cmd} {ka9q_powers_path} "
784785
f"{sdr_hostname} "
785786
f"-f {_center_freq} "

0 commit comments

Comments
 (0)