Frequency Tracker script updates

pull/340/head
f4exb 2019-05-06 10:47:54 +02:00
rodzic 30725b9651
commit 06bad02211
2 zmienionych plików z 29 dodań i 4 usunięć

Wyświetl plik

@ -10,4 +10,20 @@ pip install -r requirements.txt # Install requirements
<h2>freqtracking.py</h2>
This script is used to achieve frequency tracking with the FreqTracker plugin.
This script is used to achieve frequency tracking with the FreqTracker plugin. Ideally you would start it before connecting the Frequency Tracker plugin in SDRangel. It works continuously (daemon style) until stop via Ctl-C.
Options are:
- `-h` or `--help` show help message and exit
- `-A` or `--address` listening address (default `0.0.0.0`)
- `-P` or `--port` listening port (default `8888`)
- `-a` or `--address-sdr` SDRangel REST API address (defaults to calling address)
- `-p` or `--port-sdr` SDRangel REST API port (default `8091`)
With default options (no parameters) it will listen on all available interfaces including loopback at `127.0.0.1` and at port `8888`. It will identify the SDRangel API address with the first request from SDRangel and connect back at port `8091`.
Normal sequence of operations:
- Start `freqtracking.py` in a terminal
- In SDRangel connect the Frequency Tracker plugin by clicking on the grey square at the left of the top bar of the Frequency Tracker GUI. It opens the channel settings dialog. Check the 'Reverse API' box. Next to this box is the address and port at which the channel will be connected. If you use the defaults for `freqtracking.py` you may leave it as it is else you have to adjust it to the address and port of `freqtracking.py` (options `-A` and `-P`).
- In the same manner connect the channel you want to be controlled by `freqtracking.py`. You may connect any number of channels like this. When a channel is removed `freqtracking.py` will automatically remove it from its list at the first attempt to synchronize that will fail.

15
scriptsapi/freqtracking.py 100644 → 100755
Wyświetl plik

@ -44,7 +44,7 @@ def getInputOptions():
if options.addr == None:
options.addr = "0.0.0.0"
if options.port == None:
options.port = 8000
options.port = 8888
if options.sdrangel_port == None:
options.sdrangel_port = 8091
@ -112,7 +112,16 @@ def adjust_channels(sdrangel_ip, sdrangel_port):
if r.status_code / 100 != 2:
remove_keys.append(k)
for k in remove_keys:
TRACKING_DICT.pop(k, None)
tracking_item = TRACKING_DICT.pop(k, None)
if tracking_item:
request_content = tracking_item.get('requestContent')
if request_content:
channel_type = request_content.get('channelType')
else:
channel_type = 'Undefined'
device_index = k[0]
channel_index = k[1]
print(f'SDRangel: {sdrangel_ip}:{sdrangel_port} Removed {channel_type} [{device_index}:{channel_index}]')
# ======================================================================
@ -158,7 +167,7 @@ def channel_settings(deviceset_index, channel_index):
channel_type = content.get('channelType')
for freq_offset in gen_dict_extract('inputFrequencyOffset', content):
if channel_type == "FreqTracker":
print(f'SDRangel: {sdrangel_ip}:{SDRANGEL_API_PORT} Tracker: {freq_offset} Hz')
print(f'SDRangel: {sdrangel_ip}:{SDRANGEL_API_PORT} Tracker [{orig_device_index}:{orig_channel_index}] at {freq_offset} Hz')
TRACKER_OFFSET = freq_offset
TRACKER_DEVICE = orig_device_index
adjust_channels(sdrangel_ip, SDRANGEL_API_PORT)