mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-21 07:41:46 -05:00
Compare commits
4 Commits
35aa393f11
...
618e234d6c
Author | SHA1 | Date | |
---|---|---|---|
|
618e234d6c | ||
|
4b37779e9e | ||
|
764bce52fe | ||
|
b37c7f6cb9 |
@ -2423,7 +2423,8 @@ void GLSpectrumView::peakWidth(const Real *spectrum, int center, int &left, int
|
||||
float prevRight = spectrum[center];
|
||||
left = center - 1;
|
||||
right = center + 1;
|
||||
while ((left > maxLeft) && (spectrum[left] < prevLeft) && (right < maxRight) && (spectrum[right] < prevRight))
|
||||
// Use <= as SSB spectrums have duplicated values
|
||||
while ((left > maxLeft) && (spectrum[left] <= prevLeft) && (right < maxRight) && (spectrum[right] <= prevRight))
|
||||
{
|
||||
prevLeft = spectrum[left];
|
||||
left--;
|
||||
|
12
swagger/sdrangel/examples/add_channel.py
Normal file → Executable file
12
swagger/sdrangel/examples/add_channel.py
Normal file → Executable file
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import requests, json, traceback, sys
|
||||
from optparse import OptionParser
|
||||
@ -12,12 +12,12 @@ def getInputOptions():
|
||||
parser = OptionParser(usage="usage: %%prog [-t]\n")
|
||||
parser.add_option("-a", "--address", dest="address", help="address and port", metavar="ADDRESS", type="string")
|
||||
parser.add_option("-d", "--device-index", dest="device_index", help="device set index", metavar="INDEX", type="int")
|
||||
parser.add_option("-c", "--channel-id", dest="channel_id", help="channel ID of channel to add", metavar="ID", type="string")
|
||||
parser.add_option("-c", "--channel-id", dest="channel_id", help="channel ID of channel to add (E.g. NFMDemod)", metavar="ID", type="string")
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
if options.address is None:
|
||||
options.address = "127.0.0.1:8888"
|
||||
options.address = "127.0.0.1:8091"
|
||||
|
||||
if options.device_index is None or options.device_index < 0:
|
||||
options.device_index = 0
|
||||
@ -37,12 +37,12 @@ def main():
|
||||
base_url = "http://%s/sdrangel" % options.address
|
||||
device_url = base_url + ("/deviceset/%d/channel" % options.device_index)
|
||||
r = requests.post(url=device_url, json={"direction": 0, "channelType": options.channel_id})
|
||||
if r.status_code / 100 == 2:
|
||||
if r.status_code // 100 == 2:
|
||||
print("Success")
|
||||
print json.dumps(r.json(), indent=4, sort_keys=True)
|
||||
print(json.dumps(r.json(), indent=4, sort_keys=True))
|
||||
else:
|
||||
print("Error adding channel. HTTP: %d" % r.status_code)
|
||||
print json.dumps(r.json(), indent=4, sort_keys=True)
|
||||
print(json.dumps(r.json(), indent=4, sort_keys=True))
|
||||
|
||||
except Exception as ex:
|
||||
tb = traceback.format_exc()
|
||||
|
24
swagger/sdrangel/examples/rtlsdr_settings.py
Normal file → Executable file
24
swagger/sdrangel/examples/rtlsdr_settings.py
Normal file → Executable file
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
import requests, json
|
||||
|
||||
base_url = "http://127.0.0.1:8091/sdrangel"
|
||||
@ -14,7 +14,7 @@ requests_methods = {
|
||||
|
||||
def getHwType():
|
||||
r = requests.get(url=base_url + "/deviceset/0")
|
||||
if r.status_code / 100 == 2:
|
||||
if r.status_code // 100 == 2:
|
||||
rj = r.json()
|
||||
devj = rj.get('samplingDevice', None)
|
||||
if devj is not None:
|
||||
@ -27,8 +27,8 @@ def getHwType():
|
||||
|
||||
def selectRtlSdr():
|
||||
r = requests.put(url=base_url + "/deviceset/0/device", json={"hwType": "RTLSDR"})
|
||||
if r.status_code / 100 == 2:
|
||||
print json.dumps(r.json(), indent=4, sort_keys=True)
|
||||
if r.status_code // 100 == 2:
|
||||
print(json.dumps(r.json(), indent=4, sort_keys=True))
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
@ -36,7 +36,7 @@ def selectRtlSdr():
|
||||
|
||||
def getRtlSdrSettings():
|
||||
r = requests.get(url=base_url + "/deviceset/0/device/settings")
|
||||
if r.status_code / 100 == 2:
|
||||
if r.status_code // 100 == 2:
|
||||
rj = r.json()
|
||||
hwType = rj.get('deviceHwType', None)
|
||||
if hwType is not None and hwType == "RTLSDR":
|
||||
@ -51,10 +51,10 @@ def getRtlSdrSettings():
|
||||
def patchRtlSdrSettings(settings):
|
||||
new_settings = {"deviceHwType": "RTLSDR", "direction": 0, "rtlSdrSettings": settings}
|
||||
r = requests.patch(url=base_url + "/deviceset/0/device/settings", json=new_settings)
|
||||
if r.status_code / 100 == 2:
|
||||
print json.dumps(r.json(), indent=4, sort_keys=True)
|
||||
if r.status_code // 100 == 2:
|
||||
print(json.dumps(r.json(), indent=4, sort_keys=True))
|
||||
else:
|
||||
print "Error HTTP:", r.status_code
|
||||
print("Error HTTP:", r.status_code)
|
||||
|
||||
|
||||
def deviceRun(run):
|
||||
@ -62,10 +62,10 @@ def deviceRun(run):
|
||||
r = requests.post(url=base_url + "/deviceset/0/device/run")
|
||||
else:
|
||||
r = requests.delete(url=base_url + "/deviceset/0/device/run")
|
||||
if r.status_code / 100 == 2:
|
||||
print json.dumps(r.json(), indent=4, sort_keys=True)
|
||||
if r.status_code // 100 == 2:
|
||||
print(json.dumps(r.json(), indent=4, sort_keys=True))
|
||||
else:
|
||||
print "Error HTTP:", r.status_code
|
||||
print("Error HTTP:", r.status_code)
|
||||
|
||||
|
||||
def main():
|
||||
@ -73,8 +73,10 @@ def main():
|
||||
if hwType is not None:
|
||||
if hwType != "RTLSDR":
|
||||
if not selectRtlSdr():
|
||||
print("Device set 0 is not an RTLSDR device")
|
||||
return
|
||||
else:
|
||||
print("Device set 0 does not exist")
|
||||
return
|
||||
settings = getRtlSdrSettings()
|
||||
if settings is not None:
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import requests, json, traceback, sys, time
|
||||
from optparse import OptionParser
|
||||
|
Loading…
Reference in New Issue
Block a user