1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

Web API: Airspy fixes

This commit is contained in:
f4exb 2018-05-26 02:01:59 +02:00
parent f8f976fd50
commit 1fda69c667
2 changed files with 5 additions and 2 deletions

View File

@ -668,7 +668,9 @@ int AirspyInput::webapiSettingsPutPatch(
settings.m_log2Decim = response.getAirspySettings()->getLog2Decim(); settings.m_log2Decim = response.getAirspySettings()->getLog2Decim();
} }
if (deviceSettingsKeys.contains("fcPos")) { if (deviceSettingsKeys.contains("fcPos")) {
settings.m_fcPos = (AirspySettings::fcPos_t) response.getAirspySettings()->getFcPos(); int fcPos = response.getAirspySettings()->getFcPos();
fcPos = fcPos < 0 ? 0 : fcPos > 2 ? 2 : fcPos;
settings.m_fcPos = (AirspySettings::fcPos_t) fcPos;
} }
if (deviceSettingsKeys.contains("biasT")) { if (deviceSettingsKeys.contains("biasT")) {
settings.m_biasT = response.getAirspySettings()->getBiasT() != 0; settings.m_biasT = response.getAirspySettings()->getBiasT() != 0;

View File

@ -32,7 +32,7 @@ def getInputOptions():
parser.add_option("--vol", dest="volume", help="audio volume", metavar="VOLUME", type="float", default=1.0) parser.add_option("--vol", dest="volume", help="audio volume", metavar="VOLUME", type="float", default=1.0)
parser.add_option("-c", "--create", dest="create", help="create a new device set", metavar="CREATE", action="store_true", default=False) parser.add_option("-c", "--create", dest="create", help="create a new device set", metavar="CREATE", action="store_true", default=False)
parser.add_option("--ppm", dest="lo_ppm", help="LO correction in PPM", metavar="PPM", type="float", default=0.0) parser.add_option("--ppm", dest="lo_ppm", help="LO correction in PPM", metavar="PPM", type="float", default=0.0)
parser.add_option("--fc-pos", dest="fc_pos", help="Center frequency position 0:inf 1:sup 2:cen", metavar="ENUM", default=2) parser.add_option("--fc-pos", dest="fc_pos", help="Center frequency position 0:inf 1:sup 2:cen", metavar="ENUM", type="int", default=2)
parser.add_option("--sq", dest="squelch_db", help="Squelsch threshold in dB", metavar="DECIBEL", type="float", default=-50.0) parser.add_option("--sq", dest="squelch_db", help="Squelsch threshold in dB", metavar="DECIBEL", type="float", default=-50.0)
parser.add_option("--sq-gate", dest="squelch_gate", help="Squelsch gate in ms", metavar="MILLISECONDS", type="int", default=50) parser.add_option("--sq-gate", dest="squelch_gate", help="Squelsch gate in ms", metavar="MILLISECONDS", type="int", default=50)
parser.add_option("--stereo", dest="stereo", help="Broadcast FM stereo", metavar="BOOL", action="store_true", default=False) parser.add_option("--stereo", dest="stereo", help="Broadcast FM stereo", metavar="BOOL", action="store_true", default=False)
@ -98,6 +98,7 @@ def setupDevice(deviceset_url, options):
exit(-1) exit(-1)
if options.device_hwid == "Airspy": if options.device_hwid == "Airspy":
settings['airspySettings']['LOppmTenths'] = int(options.lo_ppm * 10) # in tenths of PPM
settings["airspySettings"]["centerFrequency"] = options.device_freq*1000 settings["airspySettings"]["centerFrequency"] = options.device_freq*1000
settings["airspySettings"]["devSampleRateIndex"] = 1 settings["airspySettings"]["devSampleRateIndex"] = 1
settings['airspySettings']['log2Decim'] = options.log2_decim settings['airspySettings']['log2Decim'] = options.log2_decim