Merge pull request #17 from ke5gdb/master

Add KA9Q Radio support to Wenet
rfm98w_packettx^2
Mark Jessop 2024-10-07 14:35:21 +10:30 zatwierdzone przez GitHub
commit cd4ef09c4b
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
3 zmienionych plików z 102 dodań i 43 usunięć

Wyświetl plik

@ -6,18 +6,11 @@ FROM debian:buster-slim AS build
# Install build dependencies.
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
libusb-1.0-0-dev \
pkg-config \
libatlas-base-dev \
python3 \
python3-dev \
python3-pip \
python3-setuptools \
python3-numpy \
python3-wheel && \
build-essential cmake git libusb-1.0-0-dev pkg-config libatlas-base-dev \
python3 python3-dev python3-pip python3-setuptools python3-numpy python3-wheel \
libairspy-dev libairspyhf-dev libavahi-client-dev libbsd-dev libfftw3-dev \
libhackrf-dev libiniparser-dev libncurses5-dev libopus-dev librtlsdr-dev \
libusb-1.0-0-dev libusb-dev portaudio19-dev libasound2-dev uuid-dev rsync && \
rm -rf /var/lib/apt/lists/*
# Compile and install rtl-sdr.
@ -36,6 +29,17 @@ RUN git clone https://github.com/fsphil/ssdv.git /root/ssdv && \
DESTDIR=/root/target make install && \
rm -rf /root/ssdv
# Compile and install pcmcat and tune from KA9Q-Radio
RUN git clone https://github.com/ka9q/ka9q-radio.git /root/ka9q-radio && \
#RUN git clone https://github.com/fventuri/ka9q-radio.git /root/ka9q-radio && \
cd /root/ka9q-radio && \
git checkout aa7791f && \
# git checkout sdrplay && \
make -f Makefile.linux pcmcat tune && \
mkdir -p /root/target/usr/local/bin/ && \
cp pcmcat /root/target/usr/local/bin/ && \
rm -rf /root/ka9q-radio
# Install Python packages.
# Removed numpy from this list, using system packages.
# --no-binary numpy
@ -48,6 +52,7 @@ RUN --mount=type=cache,target=/root/.cache/pip pip3 install \
requests \
sondehub
# Copy in wenet.
COPY . /root/wenet
@ -69,9 +74,15 @@ RUN apt-get update && \
libusb-1.0-0 \
python3 \
python3-numpy \
libbsd0 \
avahi-utils \
libnss-mdns \
tini && \
rm -rf /var/lib/apt/lists/*
# Allow mDNS resolution
RUN sed -i -e 's/files dns/files mdns4_minimal [NOTFOUND=return] dns/g' /etc/nsswitch.conf
# Copy compiled dependencies from the build container.
COPY --from=build /root/target /
RUN ldconfig

Wyświetl plik

@ -24,6 +24,7 @@ fi
: "${BAUD_RATE:=115177}"
: "${OVERSAMPLING:=8}"
: "${UDP_PORT:=0}"
: "${WEB_PORT:=5003}"
: "${IMAGE_PORT:=7890}"
# Start up the SSDV Uploader script and push it into the background.
@ -32,9 +33,9 @@ SSDV_UPLOAD_PID=$!
# Start the Web Interface Server
if [ "$UDP_PORT" = "0" ]; then
python3 wenetserver.py "$MYCALL" &
python3 wenetserver.py "$MYCALL" --image_port "$IMAGE_PORT" -l "$WEB_PORT" &
else
python3 wenetserver.py "$MYCALL" -u "$UDP_PORT" --image_port "$IMAGE_PORT" &
python3 wenetserver.py "$MYCALL" -u "$UDP_PORT" --image_port "$IMAGE_PORT" -l "$WEB_PORT" &
fi
WEB_VIEWER_PID=$!
@ -45,22 +46,34 @@ SDR_RATE=$(("$BAUD_RATE" * "$OVERSAMPLING"))
# The fsk_demod acquisition window is from Rs/2 to Fs/2 - Rs.
# Given Fs is Rs * Os (Os = oversampling), we can calculate the required tuning offset with the equation:
# Offset = Fcenter - Rs*(Os/4 - 0.25)
RX_SSB_FREQ=$(echo "$RXFREQ - $BAUD_RATE * ($OVERSAMPLING/4 - 0.25)" | bc)
# /1 to return integer
RX_SSB_FREQ=$(echo "($RXFREQ - $BAUD_RATE * ($OVERSAMPLING/4 - 0.25))/1" | bc)
echo "Using SDR Sample Rate: $SDR_RATE Hz"
echo "Using SDR Centre Frequency: $RX_SSB_FREQ Hz"
if [ "$BIAS" = "1" ]; then
if [ "$SDR_TYPE" = "RTLSDR" ] ; then
if [ "$BIAS" = "1" ]; then
echo "Enabling Bias Tee"
rtl_biast -d "$DEVICE" -b 1
fi
fi
# Start up the receive chain.
echo "Using Complex Samples."
rtl_sdr -d "$DEVICE" -s "$SDR_RATE" -f "$RX_SSB_FREQ" -g "$GAIN" - | \
./fsk_demod --cu8 -s --stats=100 2 "$SDR_RATE" "$BAUD_RATE" - - 2> >(python3 fskstatsudp.py --rate 1 --freq $RX_SSB_FREQ --samplerate $SDR_RATE --image_port "$IMAGE_PORT") | \
./drs232_ldpc - - -vv 2> /dev/null | \
python3 rx_ssdv.py --partialupdate 16 --headless --image_port "$IMAGE_PORT"
# Start up the receive chain.
echo "Using Complex Samples."
rtl_sdr -d "$DEVICE" -s "$SDR_RATE" -f "$RX_SSB_FREQ" -g "$GAIN" - | \
./fsk_demod --cu8 -s --stats=100 2 "$SDR_RATE" "$BAUD_RATE" - - 2> >(python3 fskstatsudp.py --rate 1 --freq $RX_SSB_FREQ --samplerate $SDR_RATE) | \
./drs232_ldpc - - -vv 2> /dev/null | \
python3 rx_ssdv.py --partialupdate 16 --headless
elif [ "$SDR_TYPE" = "KA9Q" ] ; then
# Start receiver
echo "Starting pcmcat and demodulator"
pcmcat "$DEVICE" | \
./fsk_demod --cs16 -s --stats=100 2 "$SDR_RATE" "$BAUD_RATE" - - 2> >(python3 fskstatsudp.py --rate 1 --freq $RX_SSB_FREQ --samplerate $SDR_RATE --image_port $IMAGE_PORT) | \
./drs232_ldpc - - -vv 2> /dev/null | \
python3 rx_ssdv.py --partialupdate 16 --headless --image_port $IMAGE_PORT
else
echo "No valid SDR type specified! Please enter RTLSDR or KA9Q!"
fi
# Kill off the SSDV Uploader and the GUIs
kill $SSDV_UPLOAD_PID

45
start_docker.sh 100644 → 100755
Wyświetl plik

@ -15,10 +15,13 @@ MYCALL=CHANGEME
# The normal receive frequency used by Project Horus is 443.5 MHz
RXFREQ=443500000
# SDR Type. Set this to RTLSDR for RTL-SDR use or KA9Q for KA9Q-Radio use
SDR_TYPE=RTLSDR
# RTLSDR Device ID. Leave this at 0 if you don't want to use a particular device
DEVICE=0
# Receiver Gain. Set this to 0 to use automatic gain control, otherwise if running a
# Receiver Gain (RTL-SDR only). Set this to 0 to use automatic gain control, otherwise if running a
# preamplifier, you may want to experiment with lower gain settings to optimize
# your receiver setup.
# You can find what gain range is valid for your RTLSDR by running: rtl_test
@ -26,7 +29,7 @@ DEVICE=0
# 32.8 - your performance may vary!
GAIN=0
# Bias Tee Enable (1) or Disable (0)
# Bias Tee Enable (1) or Disable (0) (RTL-SDR only)
# Enable this is you are intending on powering a preamplifer via coax from your RTLSDR
BIAS=0
@ -48,19 +51,24 @@ OVERSAMPLING=8
# with Chasemapper
UDP_PORT=0
# UDP Port used for Wenet inter-process communication.
# If you are intenting on running more than one Wenet instance on the same computer
# (e.g. multiple docker containers), use a different port for each instance.
IMAGE_PORT=7890
# HTTP server port for Web GUI.
# If you are intenting on running more than one Wenet instance on the same computer
# (e.g. multiple docker containers), use a different port for each instance.
WEB_PORT=5003
# Stop and remove any existing wenet instances
echo "Stopping/Removing any existing Wenet instances..."
docker stop wenet || true && docker rm wenet || true
# Start the container!
echo "Starting new Wenet instance..."
docker run -d \
if [ "SDR_TYPE" = "RTLSDR" ] ; then
docker run -d \
--name wenet \
-e MYCALL=$MYCALL \
-e RXFREQ=$RXFREQ \
@ -71,9 +79,36 @@ docker run -d \
-e DEVICE=$DEVICE \
-e UDP_PORT=$UDP_PORT \
-e IMAGE_PORT=$IMAGE_PORT \
-e WEB_PORT=$WEB_PORT \
-e SDR_TYPE=$SDR_TYPE \
-v ~/wenet/rx_images/:/opt/wenet/rx_images/ \
--device /dev/bus/usb \
-p 5003:5003 \
-p $WEB_PORT:$WEB_PORT
ghcr.io/projecthorus/wenet:latest
elif [ "$SDR_TYPE" = "KA9Q" ] ; then
docker run -d \
--name wenet \
-e MYCALL=$MYCALL \
-e RXFREQ=$RXFREQ \
-e GAIN=$GAIN \
-e BIAS=$BIAS \
-e BAUD_RATE=$BAUD_RATE \
-e OVERSAMPLING=$OVERSAMPLING \
-e DEVICE=$DEVICE \
-e UDP_PORT=$UDP_PORT \
-e IMAGE_PORT=$IMAGE_PORT \
-e WEB_PORT=$WEB_PORT \
-e SDR_TYPE=$SDR_TYPE \
-v ~/wenet/rx_images/:/opt/wenet/rx_images/ \
-v /var/run/dbus:/var/run/dbus \
-v /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket \
--device /dev/bus/usb \
--network host \
ghcr.io/projecthorus/wenet:latest
else
echo "No valid SDR type specified! Please enter RTLSDR or KA9Q!"
exit 0
fi
echo "Navigate to http://localhost:5003/ in your web browser to see the Wenet interface!"