accept a raw IP
This commit is contained in:
parent
fa80af8447
commit
30fb1190bb
|
@ -36,7 +36,7 @@ class MainWindow(QMainWindow):
|
||||||
|
|
||||||
plots: List[PlotWidget]
|
plots: List[PlotWidget]
|
||||||
|
|
||||||
def __init__(self, uri: str | None = None):
|
def __init__(self, ip: str | None = None):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.config_path = DEFAULT_CONFIG
|
self.config_path = DEFAULT_CONFIG
|
||||||
|
@ -47,8 +47,8 @@ class MainWindow(QMainWindow):
|
||||||
vna_kwargs = dict(
|
vna_kwargs = dict(
|
||||||
frequency=self._frequency,
|
frequency=self._frequency,
|
||||||
)
|
)
|
||||||
if uri is not None:
|
if ip is not None:
|
||||||
vna_kwargs["uri"] = uri
|
vna_kwargs["ip"] = ip
|
||||||
self.vna = Charon(**vna_kwargs)
|
self.vna = Charon(**vna_kwargs)
|
||||||
|
|
||||||
mpl.use("QtAgg")
|
mpl.use("QtAgg")
|
||||||
|
@ -206,12 +206,17 @@ def main() -> None:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if e.args[0] == "No device found":
|
if e.args[0] == "No device found":
|
||||||
dialog = QInputDialog()
|
dialog = QInputDialog()
|
||||||
text, ok = dialog.getText(None, "Pluto IP Address", "IP Address", QLineEdit.Normal, "")
|
text, ok = dialog.getText(
|
||||||
|
None,
|
||||||
|
"Pluto IP Address",
|
||||||
|
"Enter Pluto IP Address",
|
||||||
|
QLineEdit.Normal,
|
||||||
|
"192.168.2.1",
|
||||||
|
)
|
||||||
match = re.match(r"(\d{1,3}\.){3}\d{1,3}", text)
|
match = re.match(r"(\d{1,3}\.){3}\d{1,3}", text)
|
||||||
if not match:
|
if not match:
|
||||||
raise ValueError(f"Invalid IP address: {text}")
|
raise ValueError(f"Invalid IP address: {text}")
|
||||||
uri = f"ip:{text}"
|
window = MainWindow(ip=text)
|
||||||
window = MainWindow(uri=uri)
|
|
||||||
else:
|
else:
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
|
|
@ -36,9 +36,11 @@ def generate_tone(f: float, fs: float, N: int = 1024, scale: int = 2**14):
|
||||||
class Charon:
|
class Charon:
|
||||||
FREQUENCY_OFFSET = 1e6
|
FREQUENCY_OFFSET = 1e6
|
||||||
|
|
||||||
|
calibration: rf.calibration.Calibration | None = None
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
uri: str = "ip:192.168.2.1",
|
ip: str = "192.168.2.1",
|
||||||
frequency: npt.ArrayLike = np.linspace(1e9, 2e9, 3),
|
frequency: npt.ArrayLike = np.linspace(1e9, 2e9, 3),
|
||||||
ports: Tuple[int] = (1,),
|
ports: Tuple[int] = (1,),
|
||||||
):
|
):
|
||||||
|
@ -46,7 +48,7 @@ class Charon:
|
||||||
self.frequency = frequency
|
self.frequency = frequency
|
||||||
|
|
||||||
# everything RF
|
# everything RF
|
||||||
self.sdr = adi.ad9361(uri=uri)
|
self.sdr = adi.ad9361(uri=f"ip:{ip}")
|
||||||
for attr, expected in [
|
for attr, expected in [
|
||||||
("adi,2rx-2tx-mode-enable", True),
|
("adi,2rx-2tx-mode-enable", True),
|
||||||
# ("adi,gpo-manual-mode-enable", True),
|
# ("adi,gpo-manual-mode-enable", True),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user