From b10de36e5ccf755b90bb74de775f8edba2cd152c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20M=C3=A4del?= Date: Thu, 31 Jan 2019 22:38:49 +0100 Subject: [PATCH] Added detection for non-modded PlutoSDRs --- PlutoSDR/PlutoSDRControllerDialog.Designer.cs | 4 ++-- PlutoSDR/PlutoSDRDevice.cs | 18 ++++++++++++++++-- PlutoSDR/PlutoSDRIO.cs | 4 ++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/PlutoSDR/PlutoSDRControllerDialog.Designer.cs b/PlutoSDR/PlutoSDRControllerDialog.Designer.cs index dda85c2..3373638 100644 --- a/PlutoSDR/PlutoSDRControllerDialog.Designer.cs +++ b/PlutoSDR/PlutoSDRControllerDialog.Designer.cs @@ -243,7 +243,7 @@ private void InitializeComponent() this.versionLinkLabel.Size = new System.Drawing.Size(82, 17); this.versionLinkLabel.TabIndex = 49; this.versionLinkLabel.TabStop = true; - this.versionLinkLabel.Text = "Version 0.5.2"; + this.versionLinkLabel.Text = "Version 0.5.3"; this.versionLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.versionLinkLabel_LinkClicked); // // connectButton @@ -283,7 +283,7 @@ private void InitializeComponent() this.connectionTabPage.Location = new System.Drawing.Point(4, 26); this.connectionTabPage.Name = "connectionTabPage"; this.connectionTabPage.Padding = new System.Windows.Forms.Padding(3); - this.connectionTabPage.Size = new System.Drawing.Size(291, 323); + this.connectionTabPage.Size = new System.Drawing.Size(291, 238); this.connectionTabPage.TabIndex = 0; this.connectionTabPage.Text = "Connection"; this.connectionTabPage.UseVisualStyleBackColor = true; diff --git a/PlutoSDR/PlutoSDRDevice.cs b/PlutoSDR/PlutoSDRDevice.cs index 0f971aa..8c1428a 100644 --- a/PlutoSDR/PlutoSDRDevice.cs +++ b/PlutoSDR/PlutoSDRDevice.cs @@ -12,8 +12,8 @@ public sealed class PlutoSDRDevice : IDisposable { private const uint DefaultFrequency = 405500000U; private const int DefaultSamplerate = 1000000; - private const uint MinFrequency = 237500000; - private const uint MaxFrequency = 3800000000; + public long MinFrequency = 70000000L; + public long MaxFrequency = 6000000000L; private const int MinBandwidth = 1500000; private const int MaxBandwidth = 28000000; private const uint SampleTimeoutMs = 1000; @@ -314,6 +314,20 @@ public bool createContext() if (_dev == null) throw new ApplicationException("Cannot open device ad9361-phy"); + // check if the frequency range was extended + try + { + // try to tune the LO to 100 MHz (outside of the AD9363 tuning range) + IIOHelper.SetAttribute(_dev, "altvoltage0", "frequency", "100000000", false); + IIOHelper.SetAttribute(_dev, "altvoltage0", "frequency", _centerFrequency.ToString(), false); + } + catch (Exception ex) + { + MinFrequency = 325000000L; + MaxFrequency = 3800000000L; + _centerFrequency = MinFrequency; + } + Utils.SaveSetting("PlutoSDRURI", _gui.deviceUriTextbox.Text); _gui.receiverPanel.Enabled = true; diff --git a/PlutoSDR/PlutoSDRIO.cs b/PlutoSDR/PlutoSDRIO.cs index 729d47a..6852d43 100644 --- a/PlutoSDR/PlutoSDRIO.cs +++ b/PlutoSDR/PlutoSDRIO.cs @@ -192,14 +192,14 @@ long ITunableSource.MinimumTunableFrequency { get { - return 70000000L; + return _PlutoSDRDevice.MinFrequency; } } long ITunableSource.MaximumTunableFrequency { get { - return 6000000000L; + return _PlutoSDRDevice.MaxFrequency; } }