Added manual transmission script

master
Robert Östling 2024-01-06 18:26:08 +01:00
rodzic 2ff0ba4437
commit 00cf0af815
2 zmienionych plików z 48 dodań i 1 usunięć

Wyświetl plik

@ -6,7 +6,18 @@ Code for the WSPR protocol
```python3 encode.py callsign locator power```
Currently only simple callsigns and 4-symbol locators are accepted. Power is
in dBm.
in dBm. This can be used directly for producing transmission sequences for the
Arduino/AD9851 based transmitter below, or as a library to encode the WSPR
protocol.
## manual.py
```python3 manual.py callsign locator power```
Used to display the straight-key transmission sequence for a narrow-band
frequency shift transmitter. Please refer to
<a href="http://robos.org/sections/radio/wspr.html">my web page on
non-standard WSPR equipment</a> for more information.
## arduino_ad9851.ino

36
manual.py 100644
Wyświetl plik

@ -0,0 +1,36 @@
"""Display for manual WSPR transmission."""
from encode import wspr_encode
import datetime
import time
def display(symbols, output=False):
assert len(symbols) == 162, len(symbols)
baud = 1.4648
while True:
dt = datetime.datetime.utcnow()
# t is the offset from the start of the message
t = (dt.minute % 2) * 60 + dt.second + 1e-6*dt.microsecond - 1
n = int(t * baud)
current = '_' if n < 0 or n >= 162 else symbols[n]
bit0 = int(isinstance(current, int) and current % 2 == 1)
bit1 = int(isinstance(current, int) and current >= 2)
# Display a # if the resistors coming from the VCO voltage should be
# grounded. Left = bit0, right = bit1.
display = (' ' if bit0 else '#') + ' ' + (' ' if bit1 else '#')
print(f"\033[H\033[J{n:3d} {display}", flush=True)
delay = (n+1)/baud - t
time.sleep(delay)
if __name__ == '__main__':
import sys
if len(sys.argv) != 4:
print('Usage: %s callsign locator dbm' % sys.argv[0])
sys.exit(1)
callsign = sys.argv[1]
locator = sys.argv[2]
dbm = int(sys.argv[3])
symbols = wspr_encode(callsign, locator, dbm)
display(symbols, output=True)