-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathstart_tx_uart.sh
More file actions
executable file
·139 lines (118 loc) · 4.7 KB
/
start_tx_uart.sh
File metadata and controls
executable file
·139 lines (118 loc) · 4.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/bash
#
# Wenet TX-side Initialisation Script - Legacy UART Modulation
# 2025-08-27 Mark Jessop <vk5qi@rfhead.net>
#
# Run this to set up an attached RFM98W and start transmitting!
# Replace the transmit frequency and callsign with your own.
#
#
# A callsign which will be included in the Wenet Packets.
# This MUST be <= 6 characters long.
MYCALL=N0CALL
# The centre frequency of the Wenet transmission, in MHz.
TXFREQ=443.500
# Transmit power, in dBm
# Allowed values are from 2 through 17 dBm.
TXPOWER=17
# GPS Port and baud rate
# Note that we only support uBlox GPS units
# set this to none to disable GPS support
GPSPORT=/dev/ttyACM0
GPSBAUD=115200
# Image settings
# Image scaling - Scale the 'native' image resolution of the attached camera by this much
# before transmitting.
TX_IMAGE_SCALING=0.5
# White Balance settings
# Allowed Values: Auto, Daylight, Cloudy, Incandescent, Tungesten, Fluorescent, Indoor
WHITEBALANCE=Auto
# Exposure compensation
# Allowed values: -8.0 to 8.0
# You may wish to adjust this to bump up the exposure a little.
EXPOSURE=0.0
# Refer near the end of this file for image flipping and overlay options
# Baud Rate
# Known working transmit baud rates are 115200 (the preferred default).
# Lower baud rates *may* work, but will need a lot of testing on the receiver
# chain to be sure they perform correctly.
BAUDRATE=115200
# RFM98W SPI Device
# SPI device number of your RFM98W chip
# This will either be 0 or 1 on a RPi.
SPIDEVICE=0
# Modulation UART
# The UART used to modulate the RFM98W with our Wenet transmission
# We want to be using the PL011 UART, *not* the Mini-UART
# On a Pi Zero W, you may need to disable bluetooth. See here for more info:
# https://www.raspberrypi.com/documentation/computers/configuration.html#uarts-and-device-tree
SERIALPORT=/dev/ttyAMA0
# CHANGE THE FOLLOWING LINE TO REFLECT THE ACTUAL PATH TO THE TX FOLDER.
# i.e. it may be /home/username/dev/wenet/tx/
cd /home/pi/wenet/tx/
# Wait here until the SPI devices are available.
# This can take a few tens of seconds after boot.
timeout=20
echo "Checking that the SPI devices exist..."
while : ; do
[[ -e "/dev/spidev0.0" ]] && break
if [ "$timeout" == 0 ]; then
echo "Did not find SPI device in timeout period!"
exit 1
# At this point this script exits, and systemd should restart us anyway.
fi
echo "Waiting another 2 seconds for SPI to be available."
sleep 2
((timeout--))
done
echo "Waiting another 10 seconds before startup."
sleep 10
# OPTIONAL - Wait for the GNSS receiver to obtain lock before starting up the camera and transmitter.
# This may help with getting first GNSS lock after boot.
# --waitforlock 10 Wait for up to 10 minutes before timing out and continuing anyway
# --lockcount 60 Wait for 60 sequential valid 3D fixed before exiting (2 Hz update rate, so 60 -> 30 seconds)
# --locksats 6 Only consider a fix as valid if it has more than 6 SVs in use.
#python3 ublox.py --waitforlock 10 --lockcount 60 --locksats 6 --baudrate $GPSBAUD $GPSPORT
# Start the main TX Script.
#
# Additional configuration lines you may wish to add or remove before the $CALLSIGN line may include:
# Flip the image vertically and horizontally (e.g. if the camera is mounted upside down)
# --vflip --hflip \
#
# Add a logo overlay in the bottom right of the image. This must be a transparent PNG file.
# --logo yourlogo.png \
#
# Set a fixed focus position on a PiCam v3 (NOTE: The Picamv3 focus drifts with temperature - beware!!!)
# 0.0 = Infinity
# --lensposition 0.0 \
#
# Set a user-defined AutoFocus Window Area, for use wiith PiCam v3 in Autofocus Mode
# Must be provided as x,y,w,h , with all values between 0-1.0, where:
# x: Starting X position of rectangle within frame, as fraction of frame width
# y: Starting Y position of rectangle within frame, as fraction of frame height
# w: Width of rectangle, as fraction of frame width
# h: Height of rectangle, as fraction of frame height
# e.g:
# --afwindow 0.25,0.25,0.5,0.5 \
#
# Set a custom focus mapping range for the PiCam v3, which maps the autofocus range to a lens position.
# This can be used to constrain the autofocus range, or even completely unlock it to the full lens travel.
# e.g., for full lens travel, use:
# --afcustommap 0.0,0.0,15.0,1024.0 \
#
#
# Use the Focus Figure-of-merit metadata to select the transmitted image, instead of selecting on file size
# Only useful for lenses with autofocus (PiCam v3)
# --use_focus_fom
python3 tx_picamera2_gps.py \
--rfm98w $SPIDEVICE \
--baudrate $BAUDRATE \
--frequency $TXFREQ \
--serial_port $SERIALPORT \
--tx_power $TXPOWER \
--gps $GPSPORT \
--gpsbaud $GPSBAUD \
--resize $TX_IMAGE_SCALING \
--whitebalance $WHITEBALANCE \
--exposure $EXPOSURE \
$MYCALL