kopia lustrzana https://github.com/projecthorus/wenet
Add systemd service file for wenet tx, add --picamhq option
rodzic
6cc9521d02
commit
81e5bb257d
|
@ -0,0 +1,65 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Wenet TX-side Initialisation Script - Systemd Unit Version
|
||||
# 2024-07-21 Mark Jessop <vk5qi@rfhead.net>
|
||||
#
|
||||
# Run this to set up an attached RFM22B/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=VK5ARG
|
||||
|
||||
# The centre frequency of the Wenet transmission.
|
||||
TXFREQ=443.500
|
||||
|
||||
# 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
|
||||
|
||||
# GPS Port
|
||||
# Note that we only support uBlox GPS units
|
||||
GPSPORT=/dev/ttyACM0
|
||||
|
||||
# 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
|
||||
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
|
||||
|
||||
#Uncomment to initialise a RFM22B (untested with Python 3)
|
||||
#python init_rfm22b.py $TXFREQ
|
||||
# Uncomment for use with a RFM98W
|
||||
python3 init_rfm98w.py --frequency $TXFREQ --baudrate $BAUDRATE
|
||||
|
||||
|
||||
# Start the main TX Script.
|
||||
# Do not add a & on the end of these lines when running via systemd!
|
||||
|
||||
# Note that you can also add --logo /path/to/logo.png to this to add a logo overlay.
|
||||
# If using a Picam HQ, add a --picamhq argument into this line before the --gps argument
|
||||
python3 tx_picam_gps.py --baudrate $BAUDRATE --gps $GPSPORT $MYCALL
|
||||
|
||||
# If you don't want any GPS overlays, you can comment the above line and run:
|
||||
# python WenetPiCam.py --baudrate $BAUDRATE $MYCALL
|
|
@ -357,6 +357,7 @@ if __name__ == "__main__":
|
|||
parser.add_argument("callsign", default="N0CALL", help="Payload Callsign")
|
||||
parser.add_argument("--txport", default="/dev/ttyAMA0", type=str, help="Transmitter serial port. Defaults to /dev/ttyAMA0")
|
||||
parser.add_argument("--baudrate", default=115200, type=int, help="Transmitter baud rate. Defaults to 115200 baud.")
|
||||
parser.add_argument("--picamhq", default=False, action="store_true", help="Use PiCamera HQ image resolutions.")
|
||||
args = parser.parse_args()
|
||||
|
||||
callsign = args.callsign
|
||||
|
@ -367,10 +368,20 @@ if __name__ == "__main__":
|
|||
|
||||
tx = PacketTX.PacketTX(serial_port=args.txport, serial_baud=args.baudrate, callsign=callsign)
|
||||
tx.start_tx()
|
||||
# Set the source and transmit image resolutions.
|
||||
# For the PiCam HQ, we have a higher source resolution that we want to make use of!
|
||||
# Note the transmit resolutions *must* be a multiple of 16.
|
||||
if args.picamhq:
|
||||
# Picam HQ Resolutions
|
||||
_src_res = (4056,3040)
|
||||
_tx_res = (1520,1136)
|
||||
else:
|
||||
# Picam V2 resolutions.
|
||||
_src_res = (3280,2464)
|
||||
_tx_res = (1488,1120)
|
||||
|
||||
|
||||
picam = WenetPiCam(src_resolution=(1920,1088),
|
||||
tx_resolution=(1920,1088),
|
||||
picam = WenetPiCam(src_resolution=_src_res,
|
||||
tx_resolution=_tx_res,
|
||||
callsign=callsign,
|
||||
num_images=5,
|
||||
debug_ptr=tx.transmit_text_message,
|
||||
|
|
|
@ -22,6 +22,7 @@ parser.add_argument("--gps", default="/dev/ttyACM0", help="uBlox GPS Serial port
|
|||
parser.add_argument("--logo", default="none", help="Optional logo to overlay on image.")
|
||||
parser.add_argument("--txport", default="/dev/ttyAMA0", type=str, help="Transmitter serial port. Defaults to /dev/ttyAMA0")
|
||||
parser.add_argument("--baudrate", default=115200, type=int, help="Transmitter baud rate. Defaults to 115200 baud.")
|
||||
parser.add_argument("--picamhq", default=False, action="store_true", help="Use PiCamera HQ image resolutions.")
|
||||
args = parser.parse_args()
|
||||
|
||||
callsign = args.callsign
|
||||
|
@ -150,9 +151,23 @@ def post_process_image(filename):
|
|||
return
|
||||
|
||||
|
||||
|
||||
# Finally, initialise the PiCam capture object.
|
||||
picam = WenetPiCam.WenetPiCam(src_resolution=(3280,2464),
|
||||
tx_resolution=(1488,1120),
|
||||
|
||||
# Set the source and transmit image resolutions.
|
||||
# For the PiCam HQ, we have a higher source resolution that we want to make use of!
|
||||
# Note the transmit resolutions *must* be a multiple of 16.
|
||||
if args.picamhq:
|
||||
# Picam HQ Resolutions
|
||||
_src_res = (4056,3040)
|
||||
_tx_res = (1520,1136)
|
||||
else:
|
||||
# Picam V2 resolutions.
|
||||
_src_res = (3280,2464)
|
||||
_tx_res = (1488,1120)
|
||||
|
||||
picam = WenetPiCam.WenetPiCam(src_resolution=_src_res,
|
||||
tx_resolution=_tx_res,
|
||||
callsign=callsign,
|
||||
num_images=5,
|
||||
debug_ptr=tx.transmit_text_message,
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
[Unit]
|
||||
Description=wenet_tx
|
||||
After=basic.target
|
||||
|
||||
[Service]
|
||||
# Update this path if not running as the pi user!
|
||||
ExecStart=/home/pi/wenet/start_tx_systemd.sh
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
# This one too!
|
||||
WorkingDirectory=/home/pi/wenet/
|
||||
|
||||
# NOTE - Wenet unfortunately needs to be run at root, else we can't easily set the system time.
|
||||
#User=pi
|
||||
SyslogIdentifier=wenet_tx
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Ładowanie…
Reference in New Issue