kopia lustrzana https://github.com/projecthorus/wenet
Add options for baud rate to a few scripts, add comments into startup scripts as to baudrate settings.
rodzic
8707c374c4
commit
c4f4df30a2
|
@ -67,13 +67,13 @@ current_packet_time = datetime.datetime.utcnow().strftime("%Y%m%d-%H%M%SZ")
|
|||
# Open temporary file for storing data.
|
||||
temp_f = open("rxtemp.bin",'wb')
|
||||
|
||||
|
||||
while True:
|
||||
if args.hex:
|
||||
data = sys.stdin.readline().rstrip().decode('hex')
|
||||
else:
|
||||
data = sys.stdin.read(256)
|
||||
|
||||
|
||||
packet_type = decode_packet_type(data)
|
||||
|
||||
|
||||
|
|
|
@ -55,7 +55,11 @@ RX_FLOW=IQ
|
|||
# Modem Settings - Don't adjust these unless you really need to!
|
||||
#
|
||||
BAUD_RATE=115177 # Baud rate, in symbols/second.
|
||||
OVERSAMPLING=8 # FSK Demod Oversampling rate. 8X oversampling works best for 115k FSK
|
||||
OVERSAMPLING=8 # FSK Demod Oversampling rate.
|
||||
# Known-Working Modem Settings:
|
||||
# 115177 baud (Pi Zero W @ '115200' baud), 8x oversampling.
|
||||
# 9600 baud, 100x oversampling.
|
||||
# 4800 baud, 200x oversampling.
|
||||
|
||||
#
|
||||
# Main Script Start... Don't edit anything below this unless you know what you're doing!
|
||||
|
|
14
start_tx.sh
14
start_tx.sh
|
@ -10,6 +10,10 @@
|
|||
MYCALL=N0CALL
|
||||
TXFREQ=441.200
|
||||
|
||||
# Baud Rate
|
||||
# Known working transmit baud rates are 115200 (the preferred default), 9600 and 4800 baud.
|
||||
BAUDRATE=115200
|
||||
|
||||
# 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/
|
||||
|
@ -17,15 +21,11 @@ cd /home/pi/wenet/tx/
|
|||
#Uncomment to initialise a RFM22B
|
||||
#python init_rfm22b.py $TXFREQ
|
||||
# Uncomment for use with a RFM98W
|
||||
python init_rfm98w.py --frequency $TXFREQ
|
||||
python init_rfm98w.py --frequency $TXFREQ --baudrate $BAUDRATE
|
||||
|
||||
# Start the main TX Script.
|
||||
# Note, this assumes there is a uBlox GPS available at /dev/ttyACM0
|
||||
python tx_picam_gps.py $MYCALL &
|
||||
|
||||
# Start SHSSP-specific transmit script.
|
||||
# Needs a GPS connected, a BNO055 connected, and a PiCam and USB Webcam (Logitech C920)
|
||||
#python shssp.py &
|
||||
python tx_picam_gps.py --baudrate $BAUDRATE $MYCALL &
|
||||
|
||||
# If you don't want any GPS overlays, you can comment the above line and run:
|
||||
# python WenetPiCam.py $MYCALL &
|
||||
# python WenetPiCam.py --baudrate $BAUDRATE $MYCALL &
|
||||
|
|
|
@ -530,11 +530,19 @@ class BinaryDebug(object):
|
|||
|
||||
if __name__ == "__main__":
|
||||
""" Test script, which transmits a text message repeatedly. """
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
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.")
|
||||
args = parser.parse_args()
|
||||
debug_output = False # If True, packet bits are saved to debug.bin as one char per bit.
|
||||
|
||||
|
||||
tx = PacketTX(
|
||||
debug=debug_output,
|
||||
serial_port=args.txport,
|
||||
serial_baud=args.baudrate,
|
||||
udp_listener=55674)
|
||||
tx.start_tx()
|
||||
|
||||
|
|
|
@ -306,6 +306,8 @@ if __name__ == "__main__":
|
|||
|
||||
parser = argparse.ArgumentParser()
|
||||
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.")
|
||||
args = parser.parse_args()
|
||||
|
||||
callsign = args.callsign
|
||||
|
@ -314,10 +316,17 @@ if __name__ == "__main__":
|
|||
def post_process(filename):
|
||||
print("Doing nothing with %s" % filename)
|
||||
|
||||
tx = PacketTX.PacketTX(callsign=callsign)
|
||||
tx = PacketTX.PacketTX(serial_port=args.txport, serial_baud=args.baudrate, callsign=callsign)
|
||||
tx.start_tx()
|
||||
|
||||
picam = WenetPiCam(callsign=callsign, debug_ptr=tx.transmit_text_message)
|
||||
|
||||
picam = WenetPiCam(src_resolution=(1920,1088),
|
||||
tx_resolution=(1920,1088),
|
||||
callsign=callsign,
|
||||
num_images=5,
|
||||
debug_ptr=tx.transmit_text_message,
|
||||
vertical_flip=False,
|
||||
horizontal_flip=False)
|
||||
|
||||
picam.run(destination_directory="./tx_images/",
|
||||
tx = tx,
|
||||
|
|
|
@ -22,7 +22,7 @@ import argparse
|
|||
from SX127x.LoRa import *
|
||||
from SX127x.hardware_piloragateway import HardwareInterface
|
||||
|
||||
def setup_rfm98w(frequency=441.200, spi_device=0, shutdown=False):
|
||||
def setup_rfm98w(frequency=441.200, spi_device=0, shutdown=False, deviation = 71797):
|
||||
# Set this to 1 if your RFM98W is on CE1
|
||||
hw = HardwareInterface(spi_device)
|
||||
|
||||
|
@ -42,8 +42,12 @@ def setup_rfm98w(frequency=441.200, spi_device=0, shutdown=False):
|
|||
lora.set_freq(frequency)
|
||||
|
||||
# Set Deviation (~70 kHz). Signals ends up looking a bit wider than the RFM22B version.
|
||||
lora.set_register(0x04,0x04)
|
||||
lora.set_register(0x05,0x99)
|
||||
_dev_lsbs = int(deviation / 61.03)
|
||||
_dev_msb = _dev_lsbs >> 8
|
||||
_dev_lsb = _dev_lsbs % 256
|
||||
|
||||
lora.set_register(0x04,_dev_msb)
|
||||
lora.set_register(0x05,_dev_lsb)
|
||||
|
||||
# Set Transmit power to 50mW.
|
||||
# NOTE: If you're in another country you'll probably want to modify this value to something legal...
|
||||
|
@ -58,6 +62,7 @@ if __name__ == '__main__':
|
|||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--frequency", default=441.200, type=float, help="Transmit Frequency (MHz). Default = 441.200 MHz.")
|
||||
parser.add_argument("--spidevice", default=0, type=int, help="LoRa SPI Device number. Default = 0.")
|
||||
parser.add_argument("--baudrate", default=115200, type=int, help="Wenet TX baud rate. We chose a TX deviation based on this. Default=115200.")
|
||||
parser.add_argument("--shutdown",action="store_true", help="Shutdown Transmitter instead of activating it.")
|
||||
args = parser.parse_args()
|
||||
|
||||
|
@ -67,7 +72,19 @@ if __name__ == '__main__':
|
|||
print("Frequency out of 70cm band, using default.")
|
||||
tx_freq = 441.200
|
||||
|
||||
setup_rfm98w(frequency=tx_freq, spi_device=args.spidevice, shutdown=args.shutdown)
|
||||
|
||||
if args.baudrate == 9600:
|
||||
deviation = 4800
|
||||
elif args.baudrate == 4800:
|
||||
deviation = 2400
|
||||
else:
|
||||
deviation = 71797
|
||||
|
||||
print("Using deviation of %d Hz for Baud Rate %d bd." % (deviation, args.baudrate))
|
||||
|
||||
setup_rfm98w(frequency=tx_freq, spi_device=args.spidevice, shutdown=args.shutdown, deviation=deviation)
|
||||
|
||||
print("Frequency set to: %.3f MHz" % tx_freq)
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
|
|
|
@ -112,11 +112,11 @@ def post_process_image(filename):
|
|||
gps_state['ground_speed'],
|
||||
gps_state['ascent_rate'])
|
||||
else:
|
||||
gps_string = "No GPS"
|
||||
gps_string = ""
|
||||
except:
|
||||
error_str = traceback.format_exc()
|
||||
self.debug_message("GPS Data Access Failed: %s" % error_str)
|
||||
gps_string = "GPS Failure"
|
||||
gps_string = ""
|
||||
|
||||
# Build up our imagemagick 'convert' command line
|
||||
overlay_str = "convert %s -gamma 0.8 -font Helvetica -pointsize 30 -gravity North " % filename
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
# Released under GNU GPL v3 or later
|
||||
#
|
||||
|
||||
import PacketTX, sys, os
|
||||
import PacketTX, sys, os, argparse
|
||||
|
||||
# Set to whatever resolution you want to test.
|
||||
file_path = "../test_images/%d_raw.ssdv" # _raw, _800x608, _640x480, _320x240
|
||||
|
@ -35,7 +35,12 @@ def transmit_file(filename, tx_object):
|
|||
tx_object.wait()
|
||||
|
||||
|
||||
tx = PacketTX.PacketTX(debug=debug_output)
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--baudrate", default=115200, type=int, help="Transmitter baud rate. Defaults to 115200 baud.")
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
tx = PacketTX.PacketTX(debug=debug_output, serial_baud=args.baudrate)
|
||||
tx.start_tx()
|
||||
print("TX Started. Press Ctrl-C to stop.")
|
||||
try:
|
||||
|
|
Ładowanie…
Reference in New Issue